how to create lights
hi,
how may i create lights as many as i can,
i think there is somthing called light mapping what is it?
"The Railgun Master"
DaHeR
I''ve had a few drinks tonight, but i''m pretty certain the brain still remembers the answer:
lightmaps are simply a texture that has be pre-made to look as though a light is being shone on it. You can only have a max of 8 lights in OGL or DX, so lightmapping allows you to have more by making a texture which ''looks'' as though it has a light on it, which is then simply mapped onto a poly.
hope i''ve kind of explained it there.
lightmaps are simply a texture that has be pre-made to look as though a light is being shone on it. You can only have a max of 8 lights in OGL or DX, so lightmapping allows you to have more by making a texture which ''looks'' as though it has a light on it, which is then simply mapped onto a poly.
hope i''ve kind of explained it there.
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
Hi, I'm sober 
Lightmaps are like textures, just they tell how much light there is on a given texel instead of what color. This is then blended togehter with the actual texture. Lightmaps are usually smaller too.
Edited by - geekster on January 9, 2002 7:01:46 AM

Lightmaps are like textures, just they tell how much light there is on a given texel instead of what color. This is then blended togehter with the actual texture. Lightmaps are usually smaller too.
Edited by - geekster on January 9, 2002 7:01:46 AM
thanx guys,
but, should i blend a texture? or use:
glColor3f(light_intensity_R,
light_intensity_G,
light_intensity_B)
?
as an idea...
"The Railgun Master"
DaHeR
but, should i blend a texture? or use:
glColor3f(light_intensity_R,
light_intensity_G,
light_intensity_B)
?
as an idea...
"The Railgun Master"
DaHeR
If you use standard lights in OpenGL you''ll have to activate them :
glEnable(GL_LIGHTING); // Enable lighting in OpenGL
glEnable(GL_LIGHT0); // Activate light source #1
glEnable(GL_LIGHT1); // Activate light source #2
...
Once a light is defined, you have to set the light source properties (mainly, the light color) and the material properties (the object color and shininess).
Then for each vertex you have to tell the normals using glNormal3f.
OpenGL will do all the computations to enlight the vertices correctly.
At this moment, glColor can give weird results if you don''t know exactly what you do. Don''t use it (at least, not before you know more about the lights).
Lightmaps are very powerful, but are a bit complex to use. I recommend you begin to learn "standard" lights (eg light activated by glEnable(GL_LIGHTING)). Just keep in mind that lightmaps are a new way of lighting, and you shall use them later for particular purposes (realistic rendering, fast rendering, etc).
glEnable(GL_LIGHTING); // Enable lighting in OpenGL
glEnable(GL_LIGHT0); // Activate light source #1
glEnable(GL_LIGHT1); // Activate light source #2
...
Once a light is defined, you have to set the light source properties (mainly, the light color) and the material properties (the object color and shininess).
Then for each vertex you have to tell the normals using glNormal3f.
OpenGL will do all the computations to enlight the vertices correctly.
At this moment, glColor can give weird results if you don''t know exactly what you do. Don''t use it (at least, not before you know more about the lights).
Lightmaps are very powerful, but are a bit complex to use. I recommend you begin to learn "standard" lights (eg light activated by glEnable(GL_LIGHTING)). Just keep in mind that lightmaps are a new way of lighting, and you shall use them later for particular purposes (realistic rendering, fast rendering, etc).
thanx vincoof,
but how may i create more lights that 8?
they are not enough for big scenes, do they?
"The Railgun Master"
DaHeR
but how may i create more lights that 8?
they are not enough for big scenes, do they?
"The Railgun Master"
DaHeR
You may not use more than 8 lights.
It''s possible to go over, but as do not recommend to do so, as the OpenGL specifications are "There are n light sources, indexed by i = 0, ..., n-1. (n is an implementation dependant maximum that must be at least 8.)"
So, if you use more than 8 lights, you''ll encounter some problems (like checking if the driver or the graphics card support them) which are not worthy of the pain.
8 is more than enough, believe me.
Moreover, you may not use too many lights in a scene as they tend to slow down dramatically the GPU on most graphics cards. I''d say you shall not use more than 4 lights on current cards.
The number 8 represents the number of visible lights in the current viewing frustum.
Of course your world may contain more than 8 lights, but not all the 8 will be visible simultaneously, hopefully.
It''s possible to go over, but as do not recommend to do so, as the OpenGL specifications are "There are n light sources, indexed by i = 0, ..., n-1. (n is an implementation dependant maximum that must be at least 8.)"
So, if you use more than 8 lights, you''ll encounter some problems (like checking if the driver or the graphics card support them) which are not worthy of the pain.
8 is more than enough, believe me.
Moreover, you may not use too many lights in a scene as they tend to slow down dramatically the GPU on most graphics cards. I''d say you shall not use more than 4 lights on current cards.
The number 8 represents the number of visible lights in the current viewing frustum.
Of course your world may contain more than 8 lights, but not all the 8 will be visible simultaneously, hopefully.
ah, so u mean that i would create lights as many as i can,
but i should activate only the visible close lights only...
did u?
"The Railgun Master"
DaHeR
but i should activate only the visible close lights only...
did u?
"The Railgun Master"
DaHeR
Yes that''s exactly that !
But if you have more than 8 lights, you have to deal with creating some sort of buffer of lights.
If you have less than 8 lights, initialize them all as soon as you can, and then show or hide them just by switching with glEnable/Disable(GL_LIGHTn) where n goes from 0 to 7.
But if you have more than 8 lights, you have to deal with creating some sort of buffer of lights.
If you have less than 8 lights, initialize them all as soon as you can, and then show or hide them just by switching with glEnable/Disable(GL_LIGHTn) where n goes from 0 to 7.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement