Guys, im stuck at so simple task.
I trying to see how something are done in Epic code, various HLSL but with no luck.
How to taking single specific channel from float2-float4?
As example:
float4 x = inVec;
return x;
I want to return some single channel, R, G, B or A.
Currently the code are always return A and ignore any other channels.
Cel
September 20, 2020, 6:18am
2
I could be misunderstanding, but here.
Im not sure if a component mask can be changed at runtime so I included a method to filter with another vector4
1 Like
Niels
September 20, 2020, 7:19am
3
The bottom pin is just the alpha, the top pin is rgb, so you need to combine them to get the float4
1 Like
There’s a few things going on, not sure which part you need answering so ignore the ones you don’t need :
Unreals float3/4 params return, from top down:
RGB
R
G
B
A
so you need to append RGB and A to get the actual float4 it contains.
In the custom node you’d have to write float4 var = input.x or input.xyzw etc
And make sure your custom node is returning a float4
1 Like
I need to stop trying to code when im almost fall asleep
I was remember what in 4.23+ we have already combined RGBA output, and when look at my float4 in 4.20 be like - “Okay! The pins says its (0,0,0,0.132) its float4!”
1 Like
Yeah, i just complitely forgot that we doesnt have already combined RGBA output in 4.20
Just append outputs and everything works.
So now predicted syntaxis are work, like:
return xx.x, or return xx.y;
1 Like