I am implementing custom PBR shading with point light sources. I took GLTF2/PBR sample material as the base.
So far I have been able to guess most of the Ogre's material semantics myself, but here's one thing I can understand:
I created 3 point light source in the scene. Inside gLTF2_PBR.material there is a standard parameter:
Code: Select all
param_named_auto u_LightDirection light_position 0
param_named_auto u_LightDirection1 light_position 1
param_named_auto u_LightDirection1 light_position 2
But in reality I see my assumption is wrong. Once I start moving any of the 3 lights in the scene around 3d model, I am getting switch from one source position to another which is a function of light's location. E.g, moving light#0 along Z performs correct shading of the surface till it gets to a distance of 100 units from the center ,than it stops working, and the direction of light#1 which was located closer to the surface takes effect. If I leave only one light source in the scene, it works perfectly.
I found it the docs this:
I tried the last one (which I assumed to be getting all the light sources in one pass),but it doesn't change.iteration once
The pass is only executed once which is the default behaviour.
iteration once\_per\_light point
The pass is executed once for each point light.
iteration 5
The render state for the pass will be setup and then the draw call will execute 5 times.
iteration 5 per\_light point
The render state for the pass will be setup and then the draw call will execute 5 times. This will be done for each point light.
iteration 1 per\_n\_lights 2 point
So here is my question: How do I iterated over all the light source in a single pass shader program? I have 3 point lights in the scene.
Thanks.
Thanks!