-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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 transparency support for LightmapGI #90109
Add transparency support for LightmapGI #90109
Conversation
c509bef
to
e6faa54
Compare
1132cab
to
715275c
Compare
88f5148
to
eccdae5
Compare
eccdae5
to
0f3bfa5
Compare
Thanks! |
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.
Tested locally, I can't get transparent shadows to show up for a static object regardless of its transparency mode. Shadows are always fully opaque. This is with Alpha, but the same happens with Alpha Scissor:
The DirectionalLight3D in the scene has the Static bake mode. I'm using the Compatibility rendering method in the test project (it bakes via a local RenderingDevice that uses Vulkan), but this also happens with Forward+. I've also tried disabling Use Texture for Bounces in LightmapGI (then baking lightmaps again) to no avail.
Testing project: test_transparent_shadows.zip
0f3bfa5
to
3c906c0
Compare
@Calinou I'm not able to repro it, even from the artifact builds.
¹ If the shadows don't match it's because the bottom of the cube has a different view of the noise texture. I noticed that alpha scissor didn't correctly work on the current commit (it only discarded alpha under the threshold but kept the same alpha if not, now it's binary) so it's fixed. |
Baking lightmaps while using Compatibility was implemented in #87386. |
3c906c0
to
37db35d
Compare
Will it fix #89402 ? |
Sorry for the delay in my response.
No, it only apply when a ray hit a surface.
¹ This should be done for another PR as it's out of scope for this one (and can be a breaking change in some scenario) |
I had limited time, but after the rendering meeting yesterday I had a look through and this looked fairly sensible from what I could see. It is also possible to do translucent colors in a similar way, but maybe for a later PR. I think @clayjohn mentioned wanting to double check some of the changes didn't affect some of the other GI paths. |
There is a PR for translucent colors |
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 don't know why, but when baking with this PR in the Forward+ backend the resulting lightmap is completely black. When baking the MRP, with 4.3 dev 5 I get the same result that Calinou did, but with this PR I get a totally black lightmap.
Have you done something to the MRP to make it work with this PR?
No, except for the second screenshot where I needed to tweak the point lights size. |
This might be due to #90627. |
@@ -360,6 +360,7 @@ class ParticlesStorage : public RendererParticlesStorage { | |||
virtual void set_code(const String &p_Code); | |||
virtual bool is_animated() const; | |||
virtual bool casts_shadows() const; | |||
virtual RendererRD::MaterialStorage::ShaderData::CullMode get_cull_mode() const; |
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.
We shouldn't expose this, instead we should read the cull mode from the shader directly.
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.
Documentation is fine. It's gonna be really cool to implement this in due time.
@guerro323 Are you available to rebase this PR to fix merge conflicts? If not, no worries – let me know and I can label this as |
Yes, I've just done an oopsie when trying to use the git's stash function to see if the missing code for compatibility was here (spoiler: it wasn't) and broke my branch. I'll get it done for this week along with some perf improvements I found while making my own raytracer. |
Any update on this? I needed this feature since my game relies on baked lighting for visuals, so I rebased against 4.3.x (4.3.1rc1 as of writing), and the only conflict was renaming alpha_scissor to alpha_scissor_threshold which was easily resolved. Rebasing against 4.4 proved to be more confusing, as #95828 also improved the lightmapper's shader and logic. I am still looking into it and wouldn't mind helping. |
I got busy with life and personal projects so I'll not be able to work on it for an undefined amount of time. |
@guerro323 understandable. If its not much to ask, can you rebase the branch? |
37db35d
to
cb7de2e
Compare
a270bdb
to
45e6c7e
Compare
Co-authored-by: Guerro323 <kaltobattle@gmail.com>
45e6c7e
to
a5a4005
Compare
Fixes #77590
Scene from the original issue
master
size=0
size=0.1
Test Scenes
The culling logic was updated in the Lightmapper to correctly support
Back
andDisabled
cull modes.To preserve the current behavior and to not have any breaking change, the first direct light rays will retain the old behavior where light is blocked even if it should be culled.
This behavior is still needed otherwise there would be holes in the shadows of penetrated meshes (which can be quite common) and would need the material to be updated to
Disabled
cull mode, which may not be intuitive in most cases.TL;DR: There should be no breaking changes on existing scenes. This do need some more testing but all my scenes looked correct.
note: I've split the colored shadows into another PR (#90132)