SceneTextureLookup(UV, 14, false) sampling with incorrect/scaled UV in viewport.

Issue

Image : https://pasteboard.co/tfTL27yXuGfv.png

If SceneTextureLookup is used in a custom node with exact UVs as SceneTexture node. SceneTextureLookup samples the screen with a different UVs than SceneTextureNode.

It seems that the amount by which uv is scaled depends upon the ratio between screen size and viewport size.

  1. It only happens in editor if the viewport is not fullscreen.
  2. It give CORRECT results if viewport is fullscreen, or playing in standalone mode.
  3. tested in 4.27 as well as 5.2.1, happens in both.

Exacts steps to replicate.

  1. Create a material, set Domain to postProcess.
  2. Add custom node with following code return SceneTextureLookup(UV, 14, false);
  3. Add 2 inputs in custom node for Color, and UV.
  4. Add SceneTexture node with SceneTextureId=PostProcessInput0, Connect it to Color.
  5. Add TexCoord[0] node , Connect it to UV.

I am running into the exact same issue.

hi,

you need to get uv scaled to viewport. to do this use the function ViewportUVToSceneTextureUV(UV, TextureIndex)

float2 NewUV = ViewportUVToSceneTextureUV(UV, 14); 
SceneTextureLookup(NewUV, 14, false)
3 Likes