Hello, I would like to make some custom post process materials using the Custom HLSL node, and I need to do multiple texture lookups.
Previously, I would use the SceneTextureLookup function in hlsl to do this, but it no longer works in substrate. Here is some example code that should just return the same image without any changes:
float2 UV = GetViewportUV(Parameters) - 0.5;
// Adjust the UV coordinates to fit within the valid range (assuming 14 as your texture ID)
float2 FinalUV = ClampSceneTextureUV(ViewportUVToSceneTextureUV(UV + 0.5, 14), 14);
// Perform a simple scene texture lookup using the final UVs
float3 OutputColor = SceneTextureLookup(FinalUV, 14, true);
return OutputColor;
What’s strange is if I example the HLSL code output of the shader, it DOES in fact use the SceneTextureLookup function when using nodes like “SceneTexture”.
This right here is driving me mad. There was this obscure change, and we lost access to other things as well, and it’s horribly documented, and randomly answered with very personal fixes from others that don’t translate elsewhere.
I have a ton of HLSL that broke, and my heart hurts about it.
Yeah, I’m necro’ing this thread. All the other ones related to this should be as well, so we can get some solid insight on how to approach this.
Can’t get access to light data because “deferred” rendering (plenty of people have made plugins or otherwise augmented engine source to get at it, so this is a poor excuse), and simple texture lookups are an insane pain to use.
In case someone else wanders through on their searches for solutions, this is one bit that helped me along in some custom HLSL stuff:
If you make a variable called “SceneTexture” in you custom node and connect the SceneTexture:PostProcessInput0 color output up to it, you then have access to SceneTextureLookup. I thought you’d only get the float4 value returned.