I don’t know if this is best forum section to post this question in…
I have a texture made from the output of an HLSL program…
Now this was/is only for testing purposes…as I am having problems getting the full blown HLSL to appear exactly as the static texture version of it…
Here is the faked HLSL texture/material
Here is what the texture/material looks like using custom HLSL node. Notice how the colors are washed out.
Here is the UE5.3 material with the custom HLSL node.
gradient2.zip (8.2 KB)
Here is screen cap of the material (if you prefer to look at this rather than the material in the zip file)
Here is the HLSL (again this is all set up already in the material in the zip file…but if you prefer having the actual text here it is)
#define HLSL
//#define GLSL
#ifdef HLSL
#define vec2 float2
#define vec3 float3
#define vec4 float4
#define mix lerp
#define fract frac
#define mat2 float2x2
#define mat3 float3x3
#define mod fmod
#define atan atan2
#endif
#define PI 3.141592654
vec4 firstColor = vec4(1.0,0.0,0.0,1.0); //red
vec4 middleColor = vec4(0.0,1.0,0.0,1.0); // green
vec4 endColor = vec4(0.0,0.0,1.0,1.0); // blue
double d = 0.0;
vec2 xy = UV.xy;
float h = 0.5; // adjust position of middleColor
vec4 col = mix(mix(firstColor, middleColor, xy.x/h), mix(middleColor, endColor, (xy.x - h)/(1.0 - h)), step(h, xy.x));
vec4 fragColor = col;
return fragColor;
As you can see…the real HLSL material does not appear the same as the fake HLSL material (a texture image export of HLSL output from Visual Studio Code). The question is why? Is there something I can do to fix it?