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.x] Add soft shadows to the CPU lightmapper #50184

Merged
merged 1 commit into from
Jul 14, 2021

Conversation

JFonS
Copy link
Contributor

@JFonS JFonS commented Jul 5, 2021

Adds the light_size property to Lights. It's only considered in baked lightmaps for soft shadowing purposes.

Based on @RandomShaper's work in JFonS#3

@JFonS JFonS added this to the 3.4 milestone Jul 5, 2021
@JFonS JFonS requested a review from Calinou July 5, 2021 16:26
@JFonS JFonS requested review from a team as code owners July 5, 2021 16:26
Adds the "light_size" property to Lights. It's only considered in baked
lightmaps for soft shadowing purposes.
@JFonS JFonS force-pushed the cpu_lightmapper_soft_shadows branch from be0c545 to a2ba791 Compare July 5, 2021 17:02
@lawnjelly
Copy link
Member

Did you think about making light_size a Vector3? That way maybe you could have e.g. long thin lights and rotate them with the transform. Of course you can use emission to have more control over a light volume but a Vector3 is quite handy.

One thing I remember is if you place a volumetric light by a wall, you can end up getting light cast on objects from the other side of the wall, it can be kind of annoying in a confined space like a room. I think I solved it by doing a ray check from the centre of the light to the light start position before doing the main ray trace to the surface. If there is no path from the centre to the light start, the ray fails.

@JFonS
Copy link
Contributor Author

JFonS commented Jul 14, 2021

@lawnjelly sorry, I missed this somehow.

I would keep the light_size property as a float because it will have forward compatibility with master, also most people just want to soften shadows, with a Vector3, they would have to set the 3 components to the same value, so it less usable for the common case.

Light leaking is most likely a problem here too (I haven't tested), but I'm a bit swamped with things to do right now. I think we can merge the PR as it is and add some optional checks if we see it reported often.

@akien-mga akien-mga merged commit aa3a5c9 into godotengine:3.x Jul 14, 2021
@akien-mga
Copy link
Member

Thanks!

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.

3 participants