Hi!
I created a simple command for rendering custom depth (with front culling, when we got back polygons) in Custom pass.
I do it with this code:
CoreUtils.SetRenderTarget(cmdList, Depth_Back_Buffer, ClearFlag.All);
CustomPassUtils.DrawRenderers(ctx, CustomLayer, RenderQueueType.AllOpaque, CustomVFmaterial, 0, overrideRenderState: new RenderStateBlock(RenderStateMask.Depth){depthState = new DepthState(true, CompareFunction.LessEqual)});
And very simple VF shader pass:
Blend Off
ZWrite Off
ZTest LEqual
Cull Front
PackedVaryingsType Vert(AttributesMesh inputMesh)
{
VaryingsType varyingsType;
//VR REQUIREMENT
UNITY_SETUP_INSTANCE_ID(inputMesh);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(varyingsType);
varyingsType.vmesh = VertMesh(inputMesh);
return PackVaryingsType(varyingsType);
}
float4 Frag(PackedVaryingsToPS packedInput) : SV_Target
{
//VR REQUIREMENT
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
return 0;
}
Everything work is okay, when I’m trying to use it in standart mode (without VR mock), I got texture (one slice ) and correct depth with Front culling (example with standart Cube in attached files “Not XR”)
But if I want to use XR mode (with MockHMD in Single-Pass Instanced rendering mode), it returned depth (in two eyes) with Back culling mode (example with standart Cube in attached files “XR”, first slice - left eye, and second slice have a correct camera offset but anyway Back culling depth).
Why is it happening and how can I solve it? (Unity 2022.2.3f1, HDRP 14.0.5, XR Plugin Management 4.2.1)
If you needed to reproduce it, I can create a simple Unitypackage.
Thanks in advance!