Shading objects
I have a few questions about shading objects.
To calculate how bright they are, you compare the polygon''s normal to the angle between the polygon and the light? Is this how an OpenGL light works?
The other thing was about blending textures and colours. If I have a current colour that is not (1,1,1,1) then it affects the colors in the texture when it''s rendered, doesn''t it?
So if I wanted a particular polygon to be shaded a particular colour, could I set the current color and then draw that polygon? Would this be faster than blending a lightmap over the object?
Are multiple calls to glBegin...glEnd drawing a single poly at a time very much slower than a single call to glBegin...glEnd with all the polys inside that? Can I change the current colour inside glBegin...glEnd?
Also, does anyone have some good links where I can find information about calculating a lightmap for a particular object?
Sorry to have a whole heap of questions like this, it''s just that I''ve heard that using GL''s lights is quite slow, and I thought if I can set up some kind of shading value for each poly myself, even if I just do it at the beginning when I load the data, it might be faster...
1:yep, that''s how opengl calculates light
2:you can do so... it''s faster.. but you need to remember, that a lighmap can be way more detailed.. also with multitexturing the speed difference on newest systems might be small (assuming you have got a prerendered lightmap.. changing a lightmap on the fly might cost you plenty unless you use somekind of trick (there''s a source somewhere around about fake lighting...))
3:YES!!!! pack as much between glbegin/end as you can.. also use display lists and triangle strips as often as possible.. trinagle strips give a HUGE speed boost.
4:lightmap..well.. search in gamedev.net,flipcode.com and gamasutra.com... there are few tuts surelly, don''t remember exact urls atm, sorry
5:if you don''t use dynamic lights but a prerendered lightmap it will be MUCH faster and also quality can be way better if used big enough lightmap.. a lightmap 4 times smaller then texture should give NICE effects. Problem with lightmaps starts when you try to use dynamic lights.. althrough you can get over it nicely too(quake does it
hope it helps
With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
2:you can do so... it''s faster.. but you need to remember, that a lighmap can be way more detailed.. also with multitexturing the speed difference on newest systems might be small (assuming you have got a prerendered lightmap.. changing a lightmap on the fly might cost you plenty unless you use somekind of trick (there''s a source somewhere around about fake lighting...))
3:YES!!!! pack as much between glbegin/end as you can.. also use display lists and triangle strips as often as possible.. trinagle strips give a HUGE speed boost.
4:lightmap..well.. search in gamedev.net,flipcode.com and gamasutra.com... there are few tuts surelly, don''t remember exact urls atm, sorry
5:if you don''t use dynamic lights but a prerendered lightmap it will be MUCH faster and also quality can be way better if used big enough lightmap.. a lightmap 4 times smaller then texture should give NICE effects. Problem with lightmaps starts when you try to use dynamic lights.. althrough you can get over it nicely too(quake does it

hope it helps

With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
With best regards, Mirek Czerwiñski
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement