I have a material on some props that has an input for pixel depth offset. This material also has the Runtime Virtual Texture Output node.
This material is on some objects that write to an RVT in one of our levels. This works fine on PC but Mac crashes immediately when it tries to render it. From reading the error and the code around the crash point it appears that the RVT is not liking the fact that we’re trying to write depth (PDO) to it.
This doesn’t really feel like it should crash the editor, just throw a warning that depth will not be written.
I couldn’t find a way of turning off PDO only in the RVT pass. Is that something that exists?
Steps to Reproduce
All on a mac:
Create a material and add some value to the PDO pin. Add a Runtime Virtual Texture Output node and plug anything into one of the pings (I did zero into specular).
Put that material on a mesh in a level and have that mesh write to an RVT.
Crash
I think I found a fix for this, but would still love some input/guidance if it’s not an ideal solution or you see potential issues:
// Whether the material shader should output pixel depth offset
#define OUTPUT_PIXEL_DEPTH_OFFSET (WANT_PIXEL_DEPTH_OFFSET && !IS_NANITE_PASS && ((MATERIALBLENDING_SOLID || MATERIALBLENDING_MASKED) || (TRANSLUCENT_WRITING_VELOCITY)))
// Added fix:
// Disabling for all though to see if it also affects some other mysterious crashes around RVT we were seeing.
// IS_VIRTUAL_TEXTURE_MATERIAL is set in RuntimeVirtualTextureRenderer.cpp in FShader_VirtualTextureMaterialDraw::ModifyCompilationEnvironment
#if defined(IS_VIRTUAL_TEXTURE_MATERIAL)
#undef OUTPUT_PIXEL_DEPTH_OFFSET
#define OUTPUT_PIXEL_DEPTH_OFFSET 0
#endif
This is in MaterialTemplate.ush
Hi Calin,
Apologies for the delay, yeah the fix that we added to Main for 5.7 is:
#define OUTPUT_PIXEL_DEPTH_OFFSET (WANT_PIXEL_DEPTH_OFFSET && !VIRTUAL_TEXTURE_OUTPUT && !IS_NANITE_PASS && ((MATERIALBLENDING_SOLID || MATERIALBLENDING_MASKED) || (TRANSLUCENT_WRITING_VELOCITY)))
Thanks,
Carl