# Normal map & Light map

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

## Recommended Posts

Hey guys&girls,

I am using q3bsp-styled world loading in my engine. While adding normal mapping I stuck in one question, how can I combine lightmaps and normal maps together to look good? Lightmap is just an image 512x512.

All normal maps basics says that you need LightDirection, but it's just an image. Who could help me?

Edited by NekoCode

##### Share on other sites

You usually want the direction to come from the same as your global light, unless you want to get fancy and approximate bounce lighting by placing more lights in the scene.  As long as your direction is static (like, the sun, if you don't have day/night cycles), you can just write it right into the shader.

##### Share on other sites

With traditional light-mapping, you can't combine them with normal maps (unless like StarMire says above -- if your lightmap only contains direct sun lighting, you can use a fixed sun direction).

You need to re-create the light-maps again in a different form. This was a big advancement in Half-Life 2, which they called "radiosity normal mapping".

If you're using existing Q3 levels, with existing lightmaps, then you're out of luck.

##### Share on other sites

I got a new formula to make light map into the direction.

    float axisLight = dot( N, vec3(0.0, 0.0, 1.0) );
vec3 final = decalMap.rgb * (lightMap.rgb * 2.0) * axisLight;



I will experiment with it and post what I'll get. And thanks for the link Hodgman! Useful information.

Edited by NekoCode

##### Share on other sites

btw bsp files come with entity data and its a simple text (like in map file - not compiled bsp) where light data is given - position, radius etc

const int    kEntities = 0; // Stores player/object positions, etc...

if (Lumps[kEntities].Length > 0 ) {
Entities=new char[Lumps[kEntities].Length];

Edited by WiredCat

1. 1
2. 2
Rutin
20
3. 3
khawk
16
4. 4
A4L
14
5. 5

• 11
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633756
• Total Posts
3013710
×