PDA

View Full Version : LiGhtninG and textures



VasRoG
09-12-2005, 02:17 AM
I've got a free form object and texture puttinG on it. And one liGht source. How can i make my texture to chanGe it pixels liGhtness accordinG to the location of the liGht source.

Vexator
09-12-2005, 04:50 AM
uh you should fix your g key :)
i can only guess what you want to do but you're probably talking about normal mapping. you will need to write shaders for that. here you can find tutorials on this technique: http://www.ultimategameprogramming.com/

VasRoG
09-12-2005, 10:17 AM
Oh, thank you. :)
I will try it right now.

VasRoG
09-22-2005, 01:25 AM
Sorry, i have to do this without shaders.
Maybe i should repeat my question more simple.
I have an object with texture and light source. Light source has no effect on texture. How can i do that?

09-22-2005, 02:20 AM
You need to calculate the normals for each vertex in your model, and then you'll be able light your object from any angle.

Read this for starters:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=07

Aeluned
09-22-2005, 05:06 AM
Also, you need to make sure that your texturing environment is set up as GL_MODULATE.

I think the default is GL_DECAL which does a straight replace of the fragment color with the texture sample. This will obliterate any lighting calculations since lighting is done first.