-
-
Notifications
You must be signed in to change notification settings - Fork 236
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 problems #621
Comments
You normally control this via In your demo, water has a lower transparency index (1) than glass (3) and leaves (2), therefore their sides will be culled. The first screenshot shows a different problem which I'm not sure how to fix. Godot uses a relatively primitive transparency sorting to render transparent objects. The way it does that means it sometimes causes issues where one shows on top of the other even if it's actually behind. Chunks batch each material into a single mesh surface, so if glass and water are using the same material, they will be part of the same surface, and Godot might be unable to sort them, so whichever the graphics card draws last will show on top of the other (but I'm unsure if it will even with different surfaces). |
Although I prefer that this error does not occur either, to obtain a minimum quality in my game I would be satisfied if I can solve the following two problems: 1 - Transparency Index Priority
I think because of this logic I will never be able to get the desired result. 2 - Water Z-Fighting MRP |
I've been thinking and have come up with two possible solutions that might work, at least temporarily until better solutions are found:
|
Except, as I mentionned, leaves should have lower transparency index, and don't cull neighbor faces either using the
I'm not sure yet about changing that, as it might cause other problems elsewhere.
I want to avoid adding more exceptions if possible, especially if that involves large lookup tables for the algorithm to fetch. This logic is quite sensitive because it runs in a very calculation-intensive part, so the simpler it is, the better. If the former solution (changing
Currently this will happen with leaves if they have In cases models are such that the water faces are legitimally neither culled front nor back, Z-fighting could happen either way. But in Minecraft, this happens (non-waterlogged stairs): For glass, there would be another issue: with transparency indices doing Looking at your second MRP: |
Take a look at this configuration: It's almost perfect, but it has 3 problems:
I honestly wouldn't mind continuing my game with this configuration. In any case, the fact that I cannot set the cull neighbors of the leaves to disabled is what hurts me the most because I feel that the game loses a lot of visual charm. The second problem is very hard to see so I don't care. I have also tried using a shared material and using Depth Pre-Pass instead of Alpha but some serious problem always appeared. This article could be interesting for this topic: |
I don't follow. You want to see both grass and glass on either side? Minecraft doesn't do that and this is a recipe for Z-fighting too.
I don't believe seeing underwater glass from outside water specifically causes Z-fighting. That would either be caused by transparency sorting, or the fact that your configuration makes water faces not be culled next to glass and then material settings trigger actual Z-fighting (which would show up regardless of being inside or outside water).
In Minecraft, leaves don't have it enabled. Why can't you disable it? Do you mean you actually want it to be enabled, so that leaves cull other leaves?
Which ones? I tried disabling it, and the only Z-fighting issue was caused by water, I already described how it could be handled. But otherwise I'm not sure.
It's still unclear as to how it should be reviewed though. One actionable change would be the way to handle separate checks for backfaces on some models like water, but apart from that I'm not decided. I would need very specific cases (but constraints should remain reasonable, the reference being mainly Minecraft, and I would like to keep baked checks as simple as possible). |
Ideally you should be able to see the face of the glass through the leaves and the face of the leaves through the glass, like in minecraft: But in my current configuration (the best at the moment although I am still researching a better one) I have to choose:
I have chosen to always see the leaves because with the case B, render priority problems occur. I always have to put one of the two materials with cull mode = disabled because if not the faces disappear depending on which side you look from:
This is what happens to me when I disable cull neighbors. In my mind what should happen is that you can see the faces of the leaves if the neighbors are also leaves. I don't know what the ideal solution may be, I am a humble programmer with no studies XD. I also want to try modifying this line, as you suggested above, to see if it works in my game.
|
Describe the bug
I am trying to replicate the behavior of Minecraft transparent objects using this engine since some time ago.
To reproduce
In the attached MRP there are 3 types of transparent objects: water, leaves and glass.
See the material configurations and models in the library and how they interact in the game.
mrp.zip
Expected behavior
I would especially like to be able to place transparent objects under water without them disappearing.
In the screenshots section I make a comparison of the current behavior with that of Minecraft.
Screenshots
Environment
The text was updated successfully, but these errors were encountered: