Hello Johannes, On 2016-10-21 02:40, Johannes Brunen wrote: > currently I'm working on a shader shadow engine example and have > realized that the light information is not available in the shader as I > expected. I did expected that the OSGLightNActive variables are defined > and that the OpenGL light structure gl_LightSource is valid. The reason > is, imho, that the Light::renderEnter method does not perform any > action, but delegates all the work to the engine's runOnEnter method. > Obviously the ShaderShadowMapEngine:: runOnEnter does not care about that. > > I have a couple of Questions for that: > 1. Is my analysis correct?
I think so and you have probably looked much closer at this than I have in a while ;) > 2. Is it a bug or is it intentional? I think that was the intention, basically having a LightEngine takes over how to render that light - including which state needs to be set. Basically it swaps out the lights implementation (in terms of how it affects rendering) while keeping the interface (the standard light cores). > I'm planning to use more lights than the 8 OpenGL standard lights. > Additionally these lights may carry some extra information compared to > the standard ones. In the end, I would like to have an uniform buffer > object that does contain all the light information in an array of light > structures. > > 3. How would you design such a scenario? > I have not yet understand what would be the correct place to setup the > UBO of the lights. I would like to use light cores/chunks as usual in my > scene graph, i.e. not bypassing the system by directly defining the UBO > myself. I could imagine that a core at the top the scene graph could be > responsible for accumulation of the light information and setting up the > UBO for shader based rendering. But if your lights have additional information you will have to extend the standard light cores anyway, so you might as well drop them entirely and build ones that construct the necessary state for your shaders? I think either writing a LightEngine that populates the UBO or a completely different set of lights is what I'd look at for this. Cheers, Carsten ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users