SceneTexture Node does not ouput the same result as SceneTextureLookup

I am currently using a custom node to write a Postprocessing shader that makes use of the function “SceneTextureLookup” to get the color of each pixel. However, I keep running into an issue where the color outputted from the function does not seem to match the color outputted from the SceneTexture Node. This is mainly a problem for me because the image generated by the “SceneTextureLookup” function appears to have substantially more noise in it than the Node.
One other important detail is that the post processing effect I use is applied before tone mapping, and this disparity goes away when it is applied after tone mapping.(However, it causes other problems so I would like to be able to continue to apply it before)
You can see the difference in these two images.



I am very new to working with shaders so I apologize if this is a very simple mistake, but thank you for any help!

1 Like

I stand corrected, I was able to reproduce the issue. Seems to be an issue with exposure compensation, so long as the exposure compensation is 0, it matches, but if you deviate then the output from the HLSL is different… No clue why…

Original reply

Works fine for me (5.2):

return SceneTextureLookup(GetDefaultSceneTextureUV(Parameters, 14), 14, false);

Edit:

1 Like

Looks like when sampling before tonemapping you need to multiply the scenetexture by View.OneOverPreExposure… honestly don’t know why. But if you try this it should work:

return float4(View.OneOverPreExposure.xxx, 1) * SceneTextureLookup(GetDefaultSceneTextureUV(Parameters, 14), 14, false);

For what it’s worth in order to figure this out I just compared the generated material HLSL code before/after tonemapping with PostProcessInput0 plugged into emissive. Might be helpful for future debugging.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.