Johannes Brunen
2016-10-21 07:40:55 UTC
Hello,
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?
2. Is it a bug or is it intentional?
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.
Finally, I'm heading to use a shadow map engine that I'm planning to write that performs shadowing on these lights.
I would really appreciate some help on these two related topics.
To be clear, the problem with the OSGLightNActive and the gl_LightSource structure relates to the simple first example with the ShaderShadowMapEngine that I'm writing. I did have tried to use an off- the-shelf light shader and it did not work, because of the missing information. But what I really would like to solve is the scenario with many shadowing lights in a forward rendering approach.
Best,
Johannes
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?
2. Is it a bug or is it intentional?
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.
Finally, I'm heading to use a shadow map engine that I'm planning to write that performs shadowing on these lights.
I would really appreciate some help on these two related topics.
To be clear, the problem with the OSGLightNActive and the gl_LightSource structure relates to the simple first example with the ShaderShadowMapEngine that I'm writing. I did have tried to use an off- the-shelf light shader and it did not work, because of the missing information. But what I really would like to solve is the scenario with many shadowing lights in a forward rendering approach.
Best,
Johannes