how to extend the 8 lights limit in openGL?

Started by
16 comments, last by Gammastrahler 22 years, 2 months ago
hi, i have a Direct3D demo from NVidia that renders up to 300 hardware-accelerated lights. I have a Geforce 2. but in open GL, you can only pass from 0 to light 7 or 8. how to break this limitation?
Advertisement
300 light sources on a G2? Do you know how slowly that scene would render, in 3DMark2001 in the high poly count test with 8 lights my G2 only does about 5fps, granted that probably has a lot to do with the fact that there is an immense number of polygons in that scene, but still, I think 300 light sources are a bit much. So basically I don''t know the answer to your question, sorry to crap your thread
first of all if the hardware/driver supports more than 8 lights than it should come with documentation stating what the constants "GL_LIGHT8 .. GL_LIGHTn" would be. if it doesn''t then it doesn''t.

if that''s the case you will need to implement lighting through software (i.e. lightmaps, or by doing OpenGL lighting calculations by yourself). the lighting calculations performed by OpenGL are well documented in the OpenGL programmer''s guide.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Lots of hardware lights makes things very slow. Also, you will _never_ need more than 8 lights acting on a triangle at a time, so I don''t really see what your problem is.

www.elf-stone.com

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

    http://developer.nvidia.com/docs/IO/1253/ATT/Lights.zip    


if you don´t believe it.

quote:Also, you will _never_ need more than 8 lights acting on a triangle at a time, so I don't really see what your problem is.
. Look at games like quake. There are rooms with dozens of candles, each one has its own light source. i don´t want to use lightmapping

Edited by - gammastrahler on February 1, 2002 11:46:59 AM
Basiclly, an OpenGL implementation is not required to support more than 8 lights but it may. If you have a graphics card which can render these 300 lights with Direct3d, then it is likely that the OpenGL implementaion *for your card* will also support more than 8. If you want to find out how many lights are supported, call one of the glGet*() functions passing GL_MAX_LIGHTS.
Typiclly you would be using some other approach, such as lightmaps in a game. But if you do use OpenGL lights, then it doesn''t mean you can only use 8 lignts for the level. You could render 1 room, move the lights into position for the next room, and render the next room. You could even do it on a per-polygon basis. And as someone mentioned previosly, you''ll never want more than 8 lights on a polygon.
Hope that helps!
quote:
Look at games like quake. There are rooms with dozens of candles, each one has its own light source. i don´t want to use lightmapping

Edited by - gammastrahler on February 1, 2002 11:46:59 AM


That''s a bad example. Quake uses lightmapping. It doesn''t use hardware lighting at all.

Honestly, you will never need more than 8 lights acting on a single triangle at a time. There''s nothing to stop you enabling the nearest 8 lights to every mesh in your scene before you draw each mesh. You''re not actually restricted to 8 lights per scene or anything like that.

If you post a link to a description of that demo then I''ll take a look. I don''t have time to download it on my 56k connection.


www.elf-stone.com

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

here are your options.

a) use lightmaps.
b) use the maximum number of lights supported by the driver.
c) implement lighting in software.
d) rewrite the driver.
e) use another API (i.e. Direct3D).
f) none of the above.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
@benjamin bunny

here´s the URL:
    http://developer.nvidia.com/view.asp?IO=Lights_Demo    


sorry but i don´t know the UBB code for posting a link...

Edited by - gammastrahler on February 1, 2002 1:13:07 PM
In the nvidia demo where there are 300 light lighting (what appears to be) a single large quad, the actuality is that the quad is highly tesselated, and each triangle or quad in that tesselated mesh is drawn with the nearest N lights enabled (where N <= max number of lights...8)

Fr all practical purposes, the only time you can really see any significant difference from more than 4 or so lights on a single triangle is when that triangle is really large on screen. If you expect a given triangle will ever appear large on screen, you should probably think about tesselating that triangle. As is, even if an infinite number of lights were allowed, the fact is that hardware lights are implemented per-vertex, not per-pixel. So, if a triangle gets large on the screen, you are going to start seeing strange/inaccurate lighting anyway. Just another incentive to tesselate.
Ron FrazierKronos Softwarewww.kronos-software.comMiko & Molly - Taking Puzzle Games to A Whole New Dimension

This topic is closed to new replies.

Advertisement