• Advertisement

Archived

This topic is now archived and is closed to further replies.

Why do people use lightmaps?

This topic is 5710 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay why do people use lightmaps and do I have to use them? Why can''t I just use a whole bunch of the lights that come with (DirectX, OGL)?

Share this post


Link to post
Share on other sites
Advertisement
1. The OpenGL and D3D lighting is only calculated on vertex edges and is blended over the polygone, so when you place a light directly in front of a poly it will have only one color istead of a bright spot in the middle
2. Hardware only supports 8 lights in one scene
3. You calculate the lighting in the preprocessing step when you use lightmaps which allows neater effects such as shadow casting and radiosity.

Share this post


Link to post
Share on other sites
Calculateing the lighting from alot of little lights is very expensive, lightmaps arent, plus as someone mentioned, lighting is per vertex, while lightmaps can make it look perpixel, o bye the way, are you talking about projected light maps, or regular light maps like in Quake 3, that are just applied as a 2nd regular texture over the object, Im pretty sure thats how they do it anyway.

Share this post


Link to post
Share on other sites
quote:
Original post by noVum
2. Hardware only supports 8 lights in one scene



Its 8 lights PER-POLYGON, and 8 is only the minimum required, implementations can support more.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
quote:
Its 8 lights PER-POLYGON, and 8 is only the minimum required, implementations can support more


This is a quote DIRECTLY from OpenGL Game Programming,
quote:
OpenGL lets you have as many as eight lights in your scene at any one time

page 168

Share this post


Link to post
Share on other sites
quote:
at any one time


You can have eight simultaneously active lights. You can have more than eight, you just can''t have all of them active at the same time.

Share this post


Link to post
Share on other sites
and if you have cool hardware(wildcat 3) you can have 24 lights =)

Share this post


Link to post
Share on other sites
I never saw any game that used hardware lights. Prove me if I''m wrong.

Share this post


Link to post
Share on other sites
quote:
Original post by Rickwi22
This is a quote DIRECTLY from OpenGL Game Programming,



That doesnt mean its right. That book wasnt written by SGI was it? I doubt it. It IS 8 lights PER POLYGON. It makes sense if you think about it instead of blindly believing what you are told. If you setup all 8 lights, render a polygon, setup all 8 lights again differently, and render another polygon, then youve just done what cant be done according to that book (as its 16 different lights for the scene so far). Keep going and youve done more lights for that scene.

Lesson here: the book is WRONG. Its PER POLYGON.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
OpenGL is a state machine, so it''s 8 lights minimum whenever you draw something, and those lights are whatever you have set at the time.

No point arguing over phrasings of the same concept.

And a lot of games use hardware lighting. Quake 3 uses them for characters, but lightmaps for the environment.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites
Yeah, it''s just a question of which words you use. Technically it''s not 8 per polygon, because a call to glDrawElements might draw 2000 polygons, but only 8 lights can be active for that call. But "scene" is misleading too. So basically, when using hardware lighting, you''d have to know which lights are close enough to affect the geometry you''re drawing, and if there''s more than 8 than you''d have to choose the 8 best ones.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
Quake 3 uses a precalculated light grid for the charracters. Look at the tool source if you don''t believe that.

Share this post


Link to post
Share on other sites
Yes you are right, you could use some selection process to decide which lights may be active in a scene.

quote:
That doesnt mean its right. That book wasnt written by SGI was it? I doubt it. It IS 8 lights PER POLYGON. It makes sense if you think about it instead of blindly believing what you are told. If you setup all 8 lights, render a polygon, setup all 8 lights again differently, and render another polygon, then youve just done what cant be done according to that book (as its 16 different lights for the scene so far). Keep going and youve done more lights for that scene.

Lesson here: the book is WRONG. Its PER POLYGON.


I firmly believe the book is right.
I dont know how you ment it, but you could draw a polygon, then change the light settings around and position them differnetly, and then draw another polygon, but that is not the sense I took it in at the time. It looks like a double misunderstanding of each others comments, no need to get offensive.

Rickwi22

Share this post


Link to post
Share on other sites
I didnt mean to be offensive, so I appologize is thats the way it came out. I was just trying to emphasize certain points.

You could look at it either way, but I look at it the same way as texturing. You cant change textures in the glDrawElements block, but that doesnt mean you can only have X number of textures in the scene (where X is the TMU count on your hardware). You can change the texture once per polygon (thatll get slow), or simply never. Same goes with lighting.

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
Hardware TnL performance absolutely crashes through the floor like you wouldn''t believe with 8 hardware lights.

Share this post


Link to post
Share on other sites
quote:

Hardware TnL performance absolutely crashes through the floor like you wouldn''t believe with 8 hardware lights.



It''s not that dramatic. It does cost but not too huge an amount if you really need 8 lights. On my DX8.1 app on a GF3Ti 200 a 20k triangle scene with 1 directional light ran at ~200fps. With 8 point lights ( point lights are more expensive than directional ). It dropped to ~150fps. Not too bad. I think it is a little worse on the original Geforce though.

Jack

Share this post


Link to post
Share on other sites
quote:
Original post by noVum
Quake 3 uses a precalculated light grid for the charracters. Look at the tool source if you don''t believe that.


But that doesn''t mean it didn''t use hardware lights to perform the lighting caculations. The light grid simply designates which hardware lights to setup for the characters.

Hardware lighting is very, very common. In practical use, 8 is plenty. But, more hardware lights never hurts because it allows you to reduce render setup (but in general, 8 is plenty to achieve any desired visual effect).

Share this post


Link to post
Share on other sites
quote:
Original post by noVum
I never saw any game that used hardware lights. Prove me if I''m wrong.


That would actually be quite easy to prove as it''s extremely common in games to use dynamic, per vertex calculated (hardware) lighting for ambient or directional light of characters or game objects. On some platforms it''s practically a standard technique.

Share this post


Link to post
Share on other sites
quote:
That doesnt mean its right. That book wasnt written by SGI was it? I doubt it. It IS 8 lights PER POLYGON. It makes sense if you think about it instead of blindly believing what you are told. If you setup all 8 lights, render a polygon, setup all 8 lights again differently, and render another polygon, then youve just done what cant be done according to that book (as its 16 different lights for the scene so far). Keep going and youve done more lights for that scene.

Lesson here: the book is WRONG. Its PER POLYGON.

That''s entirely up to your definition of a "scene".
IMO, if you turn on 8 lights for a polygon, then turn the off and activate 8 different lights for another polygon, you are simply drawing the polygons as different scenes. You never had more than 8 in one. That''s what the book means. And the visuals will say the same thing, the polygons look like they are in totally different scenes, because they have differen''t light sources.

------------
http://aud.vze.com <-- Newbie alert, look at your own risk. Can induce severe laughing fits and other variations of hysterical outburst.

Share this post


Link to post
Share on other sites

  • Advertisement