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

Take alpha antialising options into account when setting up materials #71261

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

clayjohn
Copy link
Member

This restores the functionality of the alpha antialising options

Fixes: #64501

#58954 made it so that alpha scissor and alpha hash materials always go through the opaque pipeline. However, alpha antialising is more like depth prepass in that it can be used for depth pass and shadows, but still needs to be drawn with a transparent pipeline so that proper MSAA can be done.

Image comparison - cropped and scaled
Before:

Screenshot from 2023-01-11 21-40-35-cropped-scaled

After:

Screenshot from 2023-01-11 21-40-10-cropped-scaled

comparison slider for fun

As a bonus:

Alpha edge antialising is a very important tool to combat aliasing that occurs when using alpha scissor or alpha hashing. Alpha scissor allows you to take advantage of the depth prepass to get proper sorting of semi-transparent objects (like leaves or grass) within a mesh.

Plain alpha
Ordinary alpha looks nice and smooth, but suffers from a chaotic layering of the individual branches (branches that are near the bottom that should be hidden are drawn over top) and casts no shadows.

Screenshot from 2023-01-11 22-03-33

Alpha scissor allows us to properly order the branches and cast shadows but the edges are rough looking and the aliasing is even worse when the camera moves

Screenshot from 2023-01-11 22-03-24

Depth prepass alpha looks nice and smooth like alpha, and even casts shadows, but lower branches are still getting drawn over upper branches

Screenshot from 2023-01-11 22-03-30

Alpha scissor with Alpha blend retains the positive characteristics of alpha scissor, but smooths out the aliasing artifacts.

Screenshot from 2023-01-11 22-03-12

Comparison

This restores the functionality of the alpha antialising options
@akien-mga akien-mga merged commit 1f171ff into godotengine:master Jan 12, 2023
@akien-mga
Copy link
Member

Thanks!

@clayjohn clayjohn deleted the RD-alpha-aa branch January 12, 2023 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants