-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Use dual-source blending for rendering the sky #17672
Conversation
@mate-h this one is for you :) |
I've had an initial look at this, and using dual source blending is a great idea, the diff looks good to me. I went to test things out and noticed some inaccuracies between what I expect to see ground truth, vs the results seem to be shifting colors in the rendered geometry toward orange. I pushed all my testing code to the https://github.com/mate-h/bevy/tree/atmosphere-test branch and will keep working on that. ![]() |
thanks @mate-h for more debugging help and your fancy reference raymarcher!
@@ -118,6 +118,23 @@ fn sample_transmittance_lut(r: f32, mu: f32) -> vec3<f32> { | |||
return textureSampleLevel(transmittance_lut, transmittance_lut_sampler, uv, 0.0).rgb; | |||
} | |||
|
|||
//should be in bruneton_functions, but wouldn't work in that module bc imports. What to do wrt licensing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just leave a comment saying that the license in the bruneton_functions.wgsl
file applies to this function, or come up with some way to reorganize the imports. Also just in general, since the code is not exaclty the same as bruneton's verison, it is a WGSL re-write, not sure how the licensing works because I am no legal expert. but does it still apply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's a direct port with no significant practical changes then I'd say the license still applies.
@alice-i-cecile this one is ready for final review and merge when you get a chance! |
Needs a second rendering review :) |
@@ -118,6 +118,23 @@ fn sample_transmittance_lut(r: f32, mu: f32) -> vec3<f32> { | |||
return textureSampleLevel(transmittance_lut, transmittance_lut_sampler, uv, 0.0).rgb; | |||
} | |||
|
|||
//should be in bruneton_functions, but wouldn't work in that module bc imports. What to do wrt licensing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be resolved before we can merge. I'd leave a little comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! There is a couple issues on main that may be unrelated to this PR:
So we might see light on objects in this example because of shadows maps not working, and the directional light not being occluded by the atmosphere or the planet earth. As far as I can tell this has not changed compared to main. |
I tested this PR on macOS and main on windows so that would make sense! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed on windows. LGTM pending other comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment about the license needs to be resolved before I can merge this. To resolve this:
- Mention that this is related to the bruneton_functions
- Credit the original author in the comment
- Name the license that it's used under in that comment.
6eafc05
to
cbb5a27
Compare
@alice-i-cecile fixed! :) |
Objective
Since previously we only had the alpha channel available, we stored the mean of the transmittance in the aerial view lut, resulting in a grayer fog than should be expected.
Solution
render_sky
with two samples from the transmittance lut