PDA

View Full Version : More than eight light sources possible?



Luanah
04-23-2009, 02:29 AM
hi, I'm working on a openGL viewer with Qt. What I know by now is, that the final scenes loaded in that viewer need to consist of far more than eight lights.
All my searching in the web, on forums and all book reading was leading to the same results. You can enable Light0 - Light7, and thats it.

Am I wrong with the following thoughts?:
Blender can cope with "n" Light souces, and as far as I know Blender is completely based on OpenGL. So there must be a possibility to implement that.

I would be very thankful for every little piece of information you can give to that toppic.

ZbuffeR
04-23-2009, 03:04 AM
I don't know how Blender handles that, but it has 2 different 'lighted' viewing modes : the fastest only take 1 or 2 artificial lightsources, placed relative to current view.
The better looking one can be very slow at times, it looks like the vertex lighting and colors is pre-calculated on cpu when it changes, and then drawn with no GL lighting at all. And specular lighting is off.

dletozeun
04-23-2009, 04:39 AM
This can be done via shaders. You just have to pass light parameters through shader program custom uniforms not through the glsl built-ins.

IMO, when you have a complex light set the better approach is deferred shading. This way you do not have to transform light position, etc, at each vertex. The lighting pass is done after the geometry is rasterized. Search "Deferred Shading" on Google forr more information.

Nighthawk
04-23-2009, 04:41 AM
* Consider replacing directional lights(infinte distance) with a environment map.

* If you have no transparent objects you can do multipass rendering:
- Render scene once with ambient light only
- Set blend mode to additive
- Render the scene again for each light source to sum up the light contribitions from each light source

* In game engines, there is often a algorithm to use only the N(like 4) "most important" lights per object(based on distance etc).

dukey
04-23-2009, 05:52 AM
you can render the model again and blend the result in the back buffer

So if you needed 16 lights just render an extra pass.

Luanah
04-27-2009, 05:35 AM
Well, thanks for all your answers. Looks like I'll have to learn lot more about shaders and buffers to get this thing work at last.
I'm still a dumb noob to OpenGL. Dissapointing...

First I will finish my wavefront.obj Loader, and then tackle this problem, looking forward to post my advances soon :-)

And once more thanks