Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparency/depth management in FPS foreground pass #39

Open
gewl opened this issue Jan 20, 2022 · 1 comment
Open

Transparency/depth management in FPS foreground pass #39

gewl opened this issue Jan 20, 2022 · 1 comment

Comments

@gewl
Copy link

gewl commented Jan 20, 2022

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.

@alelievr
Copy link
Owner

alelievr commented Apr 6, 2024

Hello,

Can you try the FPS pass V2 in the latest master? It should be an improvement from the V1 even though it consumes a bit more memory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants