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

[3.2] Workaround for alpha scissoring with opaque pre-pass in SpatialMaterial #45288

Closed
wants to merge 1 commit into from

Conversation

Avogine
Copy link

@Avogine Avogine commented Jan 18, 2021

This implements a workaround for broken alpha scissoring with opaque pre-pass in 3.2.

Video:
https://user-images.githubusercontent.com/55308941/104935573-af48de00-59ab-11eb-8308-e909c4e7deea.mp4

with workaround:
https://user-images.githubusercontent.com/55308941/104942616-fab3ba00-59b4-11eb-937e-325d82ce2d6d.mp4

This doesn't fix the real issue, because alpha scissoring will still be broken if used with ALPHA_SCISSOR=alpha_scissor_threshold;, but this will be reimplemented in 4.0, so I think this workaround is good enough for now.

(workaround by AsherGlick and Arnklit here: #36669)

MRP: alpha_scissor_workaround.zip

@Calinou Calinou added this to the 3.2 milestone Jan 18, 2021
@clayjohn
Copy link
Member

I'm not sure about this. This changes behaviour for both GLES2 and GLES3, while it seems like the original bug was GLES3 only.

I also don't like the idea of changing engine source to add a workaround that was suggested for users to add to their own shaders. We would potentially break user's materials who are not running into this bug.

What we need is a PR that fixes the underlying bug which is likely in drivers/gles3/shaders/scene.glsl.

@Avogine
Copy link
Author

Avogine commented Jan 18, 2021

You are right, I don't like this workaround either, but I don't think I can fix the glsl code, because I'm not really experienced with the source of godot.
I did this in the first place, because all my 3d models with alpha scissor are broken, and as far as I know I can't convert an imported SpatialMaterial into a shader.

@Avogine
Copy link
Author

Avogine commented Jan 18, 2021

I got another Idea, what if we expose the function to convert a SpatialMaterial to a Shader, so users can do this workaround inside an import script. This is what I wanted to do in the first place, but I wasn't able to find a function for converting.

@Avogine
Copy link
Author

Avogine commented Jan 19, 2021

I'm closing this, someone wih better experience should fix this properly.

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

Successfully merging this pull request may close these issues.

4 participants