Hey—I'm very new to HDRP & custom passes, this repo has been a godsend. Thanks so much for putting it together.
I'm using your FPS foreground pass to handle rendering both 3D meshes and 2D UI elements to create a HUD. I adapted the pass a little to handle both ortho and perspectival cameras, which seems to be working great.
However, I've been having some trouble with both backface rendering and handling transparent materials in the foreground layer. With the original pass from your repo, I was (seemingly arbitrarily) seeing backfaces from some meshes writing over the same mesh's frontfaces. After checking that the model's normals were correct, I seem to have fixed this by changing line 72 from:
depthState = new DepthState(false, CompareFunction.Always),
to
depthState = new DepthState(true, CompareFunction.LessEqual)
Also, transparent objects in the foreground layer are showing as opaque. Nothing I do to ForegroundPass.cs seems to change this behavior. Turning my camera component on (for one frame, because ForegroundPass.cs immediately turns it back off) does make the material render as transparent, but it ZWrites over everything else in the foreground layer and only alpha blends with the base camera's output. Changing the material's rendering pass to Before refraction makes the object transparent & correctly alpha blend with both the foreground and background layers, but I'd prefer not to lose refraction if possible.
Did I break something somewhere? Do you have any recommended fixes for this?
Thanks, happy to provide more info if you need it.
Hey—I'm very new to HDRP & custom passes, this repo has been a godsend. Thanks so much for putting it together.
I'm using your FPS foreground pass to handle rendering both 3D meshes and 2D UI elements to create a HUD. I adapted the pass a little to handle both ortho and perspectival cameras, which seems to be working great.
However, I've been having some trouble with both backface rendering and handling transparent materials in the foreground layer. With the original pass from your repo, I was (seemingly arbitrarily) seeing backfaces from some meshes writing over the same mesh's frontfaces. After checking that the model's normals were correct, I seem to have fixed this by changing line 72 from:
depthState = new DepthState(false, CompareFunction.Always),
todepthState = new DepthState(true, CompareFunction.LessEqual)
Also, transparent objects in the foreground layer are showing as opaque. Nothing I do to ForegroundPass.cs seems to change this behavior. Turning my camera component on (for one frame, because ForegroundPass.cs immediately turns it back off) does make the material render as transparent, but it ZWrites over everything else in the foreground layer and only alpha blends with the base camera's output. Changing the material's rendering pass to
Before refraction
makes the object transparent & correctly alpha blend with both the foreground and background layers, but I'd prefer not to lose refraction if possible.Did I break something somewhere? Do you have any recommended fixes for this?
Thanks, happy to provide more info if you need it.