I created a post process material chain. One material creates an outline User Scene Texture. Without rendering to the texture, using the material as the final display looks great. Once I output as a texture and input to another material, a number of lines are present and appear to be affected by camera distance. Images attached.
I am using the SceneDepth and WorldNormal passes to create the outline. The lines go away when I cut the Depth pass, if that helps narrow the issue down.
Apologies for the delay. When you use PPM_DepthPass alone the resolution it samples from and outputs to is the same so you can use
float2 TexelSize = GetSceneTextureViewSize(1).zwBut when you use PPM_DepthPass in a UserSceneTexture chain, the input and output resolution no longer are the same - in this case the internal render resolution is smaller than the DepthOutput scene texture. You can verify this by first enabling r.PostProcessing.UserSceneTextureDebug 1 so you can see the UserSceneTextures in use and their output resolutions. Then run stat Unit to show the internal Render resolution. If you force the internal render resolution to be 100% the lines should go away (in Editor use the viewport menu option Performance > Screen percentage > Custom Override + 100).
However, to make your shader support different resolutions you should be able to use GetSceneTextureBufferSize instead.
float2 TexelSize = GetSceneTextureBufferSize(1).zw;This is what the SceneTextureFetchFunc helper function does:
#define SceneTextureFetch(SceneTextureIndex, PixelOffset) SceneTextureFetchFunc(Parameters, SceneTextureIndex, PixelOffset)
/**
* Utility function and macro to streamline Custom HLSL fetching from SceneTextures or UserSceneTextures with a pixel offset from default UVs, including
* multiplication by texture size and clamping. Example that fetches at offset 1,1 from the default sample:
*
* SceneTextureFetch(PPI_PostProcessInput0, float2(1,1));
*/
float4 SceneTextureFetchFunc(FMaterialPixelParameters Parameters, int SceneTextureIndex, float2 PixelOffset)
{
#if SCENE_TEXTURES_DISABLED || !POST_PROCESS_MATERIAL
return float4(0,0,0,0);
#else
float2 UV = ClampSceneTextureUV(GetDefaultSceneTextureUV(Parameters, SceneTextureIndex) + GetSceneTextureBufferSize(SceneTextureIndex).zw * PixelOffset, SceneTextureIndex);
#if SHADING_PATH_MOBILE
return MobileSceneTextureLookup(Parameters, SceneTextureIndex, UV);
#else
return SceneTextureLookup(UV, SceneTextureIndex, true);
#endif
#endif
}
I was able to repro in the clean project. Odd thing: the lines don’t appear when I fire up the level, but as soon as I open an editor for the depthpass mat or instance I made.. they show up.