# lightmapping + normal mapping.

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

## Recommended Posts

Hello people. My ideia is to integrate lightmapping with normal mapping rendering. Unfortenatly, I don't have the enought resources to make something similar to the HL2 technique. What I only have is perfectaly normal lightmaps (generated by Gile[s]) and surfaces with normal maps. I need some sort of technique to blend them togheter. I does not have to be very precise ans should not have any pre-processing time (at least to complicated pre-processing). My ideia is only to have a bit of bump effect in my pre-lighted scenes. I have thought to do somethig like this: per fragment: float light = dot(normal, float3(0,0,1)); float4 final = albedo * (lightmap*2) * light; But this does not give a very good result. In fact, the result could be perfectaly baked on the albedo map instead of using a normal map. Any ideas?

##### Share on other sites
if you want to know how HL2 does it: clicky

regards,
m4gnus

##### Share on other sites
Speaking of HL2 shading, do you know how ambient cube works/is computed? I know it's some sort of computing light intensity in each of 6 basis directions (+/- X/Y/Z), but i still don't get the point.

Filami, HL2 NM-radiosity works blending 3 lightmaps computed from 3 different directions (forming a known basis) using the normal on the fragment (look at the paper).

##### Share on other sites
The method I've used and I'm happy with the results, is to store the strongest light direction per vertex. Then:

a) calculate the light colour via the smoothed normal stored per vertex.
b) calculate the light colour via the bumped normal

Given these and the light maps were constructed using the smoothed normal an effective approximation is to add the difference between the two values (a and b) to the lightmap and then modulate with the diffuse.

mike

##### Share on other sites
People, thanks to the anwser but I thinck you misunderstood me :p .
I know how HL2 shading works and in fact I know a bit how to generate those kind of lightmapping (at least I tyhinck I understand it). But, I don't have an editor, time to implement a radiosity solution specific for that case and gile[s] does not generate that kind of lightmapping.
Solution:
- Not using bump mappping......
or
- Use a fake bumpmapping algorithm with the lightmapping generated by gile[s].....
or
- Not using lightmaps, use per pixel light (Doom3 like ilumination..... no radiosity solutions, fear :\ ).

For now, I may be thincking by not using bump mapping in the scenes and use in models.

##### Share on other sites
well I presume you have max and the mental ray renderer ?

Then you can use Max and MaxScript to screw your normals before creating lightmaps using the Mental Ray renderer to generate the HL2 lightmaps. This works fine for us so far, allthough that I not really impressed by the normal mapped radiosity alone. You still have to add some per pixel lighting on top of it, or some CSM, POM or any other advanced per pixel effect to make your radiosity solution look good. But this was the only solution as far as I know which uses normal maps to compute the ambient illumination. You can perhaps also use PRT but this uses to many memory for us.

The ambient cubemaps are the easy part. Once you have your scene with lightmaps and everything, place a few dummy position in and editor, or max again, and from that position, render a cubemap (using only lightmaps, or light and diffuse, or perhaps with some extra illumination). Download the textures from you GPU and save them. Then use the ATI Cubegen tool to blur the cubemaps. Ingame sample the cubemaps with a little offset normal direction depending on your current position, to fake the infinity problem with cubemaps (see GPU Gems 1 - article 1), or a nVidia GDC presentation where they explain there demo's for some more information on this.

Regards,
Kenzo

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634060
• Total Posts
3015300
×