|
Author Topic:   Textures & Lighting
Hamish
New Member
posted March 02, 2000 05:28 AM            
Hi all,

I am currently doing some research on lighting. Although I have some knowledge of 3D and some basic programming skills I am walking around in the dark here. I am not asking for a fully detailed solution, I just would like to have some hints & basics.

How do I incoorporate lighting into textures.?

To give you an example, the headlights of a car. I can map these lights onto a plane, and super-impose these over the another bitmap (eg. terrain texture). The super-imposing, should that be done in normal memory, or perhaps the texture memory on the 3D card? Are there functions built-in into the Glide API? or OpenGl?

As you can see I am still wet behind the ears here.

Thanks for your time,

Hamish

IP:

MarkBatten
Member
posted March 02, 2000 08:38 AM            
The easiest way to add lighting to a scene is to directly adjust the r/g/b values of the affected vertices (in OpenGl, the glColor3f() values); raise those values, and the 3D card will naturally blend a "light" with the texture mapped on those vertices. It works both for static lighting, like the sun, and for dynamic lighting.

IP:

Hamish
New Member
posted March 02, 2000 09:22 AM            
Thanks for your answer.

If understand correctly, vertex lighting is possible.
This means that the 'resolution'/density of the mesh greatly affects the level of detail in the lighting.
That's something I'd like to avoid, but perhaps this _is_ the best solution possible on today's hardware.

I'd rather do it at texture level. Or perhaps combines the (lightmap & vertexlighting). Anyone else experience here?

[This message has been edited by Hamish (edited March 02, 2000).]

IP:

MarkBatten
Member
posted March 03, 2000 08:56 AM            
Yes, with vertex lighting the resolution of the mesh does make a difference, although the effects often look quite good in my experience. Doing it with textures can be expensive if not done properly (I guess that's true of everything ); it works most effectively and easily when you have a card with a multitexturing extension (which I think may be standard in OpenGL 1.2 and so gradually more widely available).

IP:

Tim
Member
posted March 07, 2000 05:49 PM            
Instead of doing data modifies like that, just make one 'headlights on the ground' texture, and use alpha blending as a mask on your ground texture.

The headlight texture is mapped to a quad, and the quad slides around on the ground. Or with multi-texture, the texture coordinates slide around.

This sorta thing is what a lot of people call a 'lightmap', a texture that stores lighting information.

IP:

Siggen
New Member
posted March 24, 2000 05:20 AM            
Don't use alpha-blend on light-maps, because they won't look right. When a light shine on a surface, the surface only reflects colors that the light emits (like if you've got a totally red light ahining on a totally green surface it will look black). Using multiply blending will give much more convincing results (GL_DST_COLOR,GL_ZERO in openGL)...

[This message has been edited by Siggen (edited March 24, 2000).]

IP: