Page MenuHome

Sun angle to angular diameter
ClosedPublic

Authored by Tim Stullich (tstullich) on May 7 2019, 4:27 PM.

Details

Summary

This patch introduces the ability to set the size of the Sun light property through the use of the angular diameter as viewed from Earth.
There are two unanswered questions regarding this change:

  1. The default value of 0.526 radians is not properly set in the EEVEE UI and is instead set to 0
  2. How the new 'sun_angle' property is meant to be used within the renderer is still unclear. To me it looks like that value can be set through the UI but internal rendering code does not actually use this property in any meaningful way.

Once these two issues are addressed these changes should be able to be shipped.

Diff Detail

Repository
rB Blender

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.May 9 2019, 7:50 PM

The default value of 0.526 radians is not properly set in the EEVEE UI and is instead set to 0

This should be initialized in two places. One is in BKE_light_init for new lights.

The other is in versioning code, which you already have in version_update.py but it's only applying to files saved in 2.79. It's easier to remove that and do it in C. The following code can be added at the end of versioning_280.c (I didn't test it):

if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "sun_angle")) {
  LISTBASE_FOREACH (Light *, light, &bmain->lights) {
    light->sun_angle = 2.0f * atanf(light_size / 2.0f);
  }
}
intern/cycles/blender/addon/properties.py
940–947

This can be removed entirely, Cycles and Eevee can share the same property. It should just read light.sun_angle always instead of using the Cycles property.

source/blender/draw/engines/eevee/shaders/lights_lib.glsl
281–290 ↗(On Diff #15190)

Easiest is no to change any GLSL code, but rather update the code that passes the parameters to it. That's in light_shape_parameters_set.

This revision now requires changes to proceed.May 9 2019, 7:50 PM
Tim Stullich (tstullich) marked 2 inline comments as done.May 10 2019, 2:41 PM
Tim Stullich (tstullich) updated this revision to Diff 15256.

I addressed the comments made by @Brecht Van Lommel (brecht) and updated the diff according to the suggested changes.

I removed some unneeded Python code out of version_update.py

Will commit with some fixes.

This revision is now accepted and ready to land.May 15 2019, 4:19 PM
This revision was automatically updated to reflect the committed changes.