-
-
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
[Merged by Bors] - bevy_gltf: Add support for loading lights #3506
Conversation
When the range is not specified, gltf says it should be infinite. I think that is a bad idea and would instead like to implement an intensity threshold mechanism where the range is calculated as sqrt(intensity / intensity threshold) considering the light intensity falloff is as 1 / distance^2. I’d like to test this idea a little bit to get something that works well in practice and I want to do this for all point lights anyway to limit their range for clustering. |
I've now done a bunch of testing of point lights of different intensities and calculating the range of the light based on an illuminance threshold and I empirically landed on a threshold of 0.1 lumens / m^2 which was the same value as aclysma found to be safe in their experiments for rafx. I thought a higher value was going to be safe but then I tried a dimmer light and 0.1 was needed. Note that I did this testing using my https://github.com/superdump/bevy/tree/point-light-range-example branch and also having removed the additional attenuation term ( I'll probably go through and retest some examples now to see if this makes the cluster stuff explode, and if so, manually limit the range of lights in those examples, commenting why. I also fixed up some documentation. |
This adds support for the KHR_punctual_lights extension which supports point, directional, and spot lights, though we don't yet support spot lights. Inserting light bundles when creating scenes required registering some more light bundle component types.
Radius is the size of the inside of the light and defaults to 0 in bevy. It is unspecified in gltf. Co-authored-by: François <mockersf@gmail.com>
This got a little bigger than I was expecting so I'll move the light range stuff out into a separate PR and return this one back to being just about loading lights from gltf. |
I've now removed the lighting calculation stuff from this PR so this is just loading lights from gltf. |
Looks good to me! |
bors r+ |
# Objective - Add support for loading lights from glTF 2.0 files ## Solution - This adds support for the KHR_punctual_lights extension which supports point, directional, and spot lights, though we don't yet support spot lights. - Inserting light bundles when creating scenes required registering some more light bundle component types.
# Objective - Add support for loading lights from glTF 2.0 files ## Solution - This adds support for the KHR_punctual_lights extension which supports point, directional, and spot lights, though we don't yet support spot lights. - Inserting light bundles when creating scenes required registering some more light bundle component types.
bors retry |
# Objective - Add support for loading lights from glTF 2.0 files ## Solution - This adds support for the KHR_punctual_lights extension which supports point, directional, and spot lights, though we don't yet support spot lights. - Inserting light bundles when creating scenes required registering some more light bundle component types.
Objective
Solution