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

Add a material flag to render a material after the depth buffer was cleared #3405

Closed
webnetweaver opened this issue Oct 9, 2021 · 3 comments

Comments

@webnetweaver
Copy link

Describe the project you are working on

A futuristic fps.

Describe the problem or limitation you are having in your project

I want to implement a fps with a weapon object that doesn't get clipped by walls.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a material flag for things like fps weapons. This flag can be called depth_clear or something similar.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The standard solution to the fps weapon clipping issue is to render all other scene objects first, then clear the depth buffer, and then render the weapon object keeping the z-buffer enabled the whole time. Materials with the depth_clear flag would be grouped and rendered last in the scene after clearing the depth buffer. Im not sure if this would work for a deferred rendering pipeline but it's definitely feasible for forward rendering.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No

Is there a reason why this should be core and not an add-on in the asset library?

This feature is heavily used for fps games.

@Calinou
Copy link
Member

Calinou commented Oct 9, 2021

Related to #956 (which is ultimately about the same problem).

@Calinou Calinou changed the title New Material Flag to Support Depth Clear Add a material flag to render a material after the depth buffer was cleared Oct 9, 2021
@clayjohn
Copy link
Member

clayjohn commented Oct 9, 2021

It sounds like you are describing the FLAG_DISABLE_DEPTH_TEST which renders an object after the opaque pass and ignores the z-buffer. I don't see why you would want to clear the z-buffer as it is needed for post-processing effects.

@webnetweaver
Copy link
Author

Right, thinking about it more, I'm starting to see that this request isn't very feasible. Maybe 20 years ago, but not with today's rendering pipeline. I'm gonna remove this request. Also, problem can be circumvented by putting fps weapon inside player collision shape.

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

No branches or pull requests

3 participants