Hi,
We are attempting to use Mesh Decals but are running into a few limitations which are problematic for us. Looking at the engine code, they seem avoidable, so we wanted to ask about the rationale for how things are structured today.
We are attempting to replicate the standard decal projection using the WorldPositionBehindTranslucency and then mapping the WorldPos -> Instance Local Space to compute the UV. This works, however, it’s not possible to use material expressions like UMaterialExpressionObjectLocalBounds/UMaterialExpressionBounds/UMaterialExpressionPreSkinnedLocalBounds in decals, so we need to specify the mesh bounds manually. After removing the explicit blocking in MaterialExpressions.cpp and FHLSLMaterialTranslator::CheckPrimitivePropertyCompatibity ffor MD_DeferredDecal everything seems to work fine, so we were wondering what the purpose of these checks are?
Secondly our game has a UI effect based on Custom Stencil values. The bOutputTranslucentVelocity=true + OpacityMaskClipValue works here and the stencil write can be masked to a region of the decal, however practically that region depends on the output of WorldPositionBehindTranslucency which depends on SceneDepth. CustomDepth renders after the depth pre-pass so this data should be available, however it uses the generic FDepthOnlyPS shader which sets SCENE_TEXTURES_DISABLED=1 (since generally they are not, for example rendering shadow maps). Locally we were able to fix this by adding a variant of FDepthOnlyPS specific to FCustomDepthPassMeshProcessor which sets SCENE_TEXTURES_DISABLED=0 if ShouldForceFullDepthPass(Parameters.Platform), which for our project is true (and I suspect many projects also). Is this something Epic would consider supporting or are there other side-effects doing this we should be aware of? Maybe we need a more granular version of SCENE_TEXTURES_DISABLED which only allows SceneDepth to be safe?
Thanks,
Lucas
[Attachment Removed]