Fix broken lightdata iterator in shaders#366
Conversation
|
Thanks for spotting the issue. I have merged and then updated the built-in ShaderSets within the VSG itself: vsg-dev/VulkanSceneGraph@d3c67c1 I thought I had put in a check for intensity to avoid assigning lights that are off to the ViewDependentState's lightData but I have just done a code review and haven't spotted one. I think the right way to tackle that wold be to add a check to the RecordtTraversal::apply(*Light&) implementations so that the lights that are off aren't added at all. I will have a think about the required mods to RecordTraversal. |
|
Thanks. |
|
Do you have a scene that tests out the lights with low intensity? |
|
I have added a RecordTraversal::intensityMinimum control for culling lights that are switched off via the intensity. vsg-dev/VulkanSceneGraph@adb8770 Could you test VSG master? |
|
Test with new master and old shader with early check. Yes, it works too. I think RecordTraversal::intensityMinimum by default should be the same 0.001f as default brightnessCutoff value in shaders, not 0.00001 |
|
As well as default values it make be worth changing the naming to make it more consistent. May also be worth passing the value to the shader, though this involves extra complexity. For now I'll stick with simplicity. |

Default shaders now have two brightness check to near-zero value for Directional or Spot Lights. First check is before than all increments of lightdata iterator are done, so each Light with zero intensity brake all next lights in buffer. In this PR I simple remove this early check from shaders. May be it is better to rewrite vsg::ViewDependentState::traverse() to don't add zero-brightness lights to buffer