How do I use the SceneTextureLookup function in HLSL? (Viewport is distorted)

I’m inside of a Post Process Material and am just testing to understand how some stuff works. I have a “Screen Position” node and feed the ViewportUV into a custom node. Inside of the code I use only a single line returning SceneTextureLookup(ScreenUV,0,false).

I already understood that I need to have a SceneTexture node in my material for this to work, so I did that and Lerp’ed between the PPInput0 and my custom node. In theory booth should output just an undistorted image of the screen (no post processing applied). What I get however is this:

Now if I resize the window I get a different result:

So it seems to be somehow failing to respect the view size in a correct way. I just can’t figure out in what way and how to fix it.

Update: I got it to work by not using the ScreenPosition node, but instead putting “GetDefaultSceneTextureUV(Parameters, 0)” into the function. Seems like they use different UVs. Weird but well…

It seems to be aligned now, but something is still weird. It doesn’t look like the normal game, but somehow sharpened and darker.

EDIT: Second update: I changed the Blendable Location to “Before Tonemapping” and the it solved it.

1 Like