Sign in to follow this  
b3rs3rk

Help with ppl and lightmaps

Recommended Posts

if i have a scene with lightmaps, is there a way to light up a dark spot using a per pixel light? In my engine i got full ppl with dot3 bump mapping. it works very fine (i posted a demo on this forum few days ago,if someone wants..) and now i'm trying to add some "atmosphere" :) I've added lightmaps, but if i move my spotlight in a dark zone of the map nothing changes :/ How can i do?

Share this post


Link to post
Share on other sites
this way:

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, Cube_Map_Id);
glEnable(GL_TEXTURE_CUBE_MAP);

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, Normal_Map_Id);

glActiveTextureARB(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, Texture_Id);

glActiveTextureARB(GL_TEXTURE3_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, Lightmap_Id);


then i set the extensions like in the NeHe's article #20.
For GL_TEXTURE3_ARB i use GL_MODULATE. I've tryed to use another value, but nothing changes.

Share this post


Link to post
Share on other sites
You know,lightmaps don't support bumpmapping.Wouldn't it look weird if lightmapping and PPL bumpmapping were combined?The bumps will show only when the surfaces are lit by dynamic lights.I think the most you can do is just plain simple PPL lighting,without bumpmapping.

Share this post


Link to post
Share on other sites
Quote:
Original post by lc_overlord
ok then i don't know, it could be the order of the textures that is flawed.

mikeman: actuarly your wrong and it looks pretty good to.
Just go to http://esprit.campus.luth.se/~humus/ and look at the softshadows demo and the Volume Lightmapping demo in the openGL section, it's pretty l33t.


Hmmm...After a quick look on the shaders,I saw that he calculates diffuse and specular lighting the normal way for every pixel,and then he modulates the result with "shadow",a value sampled from the lightmap.From that I conclude that the lightmap indicates only if a point is in shadow or not,and does not include diffuse values.So he uses PPL bumpmapping for all light sources,and the lightmap only to implement shadows.When I said combining lightmap&bumpmapping will look weird,I meant full lightmapping for static lights,and PPL bumpmapping for dynamic ones.

Share this post


Link to post
Share on other sites
So what's all the fuss about.
If you want to combine bumpmaps with lightmaps and use the lightmap for lightinfo and only use static light's( and not as humus does it, use it for shadows), then just increase the resolution on the lightmap and bake the bumpiness into it, easy quick and simple.

However, if you want a static light(static position that is) in a static world with soft shadows, bumpmaps, paralax efect and some varying degree of controll over the intensety and color of the light.
This method allso gives you accurate specular highlight's, true lightmaps can not.

Combining the two(true lightmapping and dynamic lights) is pretty easy, but don't even try doing it in a single pass(light is addative, so just add the different passes together).
You can use lightmaps pretty effectively to simulate some fake radiosity.

Share this post


Link to post
Share on other sites
Quote:
Original post by lc_overlord
So what's all the fuss about.
If you want to combine bumpmaps with lightmaps and use the lightmap for lightinfo and only use static light's( and not as humus does it, use it for shadows), then just increase the resolution on the lightmap and bake the bumpiness into it, easy quick and simple.


It would need a huge resolution to do that.

Share this post


Link to post
Share on other sites
Quote:
Original post by python_regious
Half-Life 2 uses a method that combines lightmaps and standard ppl, there's a paper on the nvidia developers site, perhaps you should take a look.


Do you have a link to that?I can't find it.

Share this post


Link to post
Share on other sites
It seems interesting.They use a technique called "Radiosity Normal Mapping",but I can't figure it out.What are they storing in the lightmap?
Quote:

Computing Light map Values:

•Traditionally, when computing light map values using a radiosity preprocessor,
single color value is calculated
•In Radiosity Normal Mapping, we transform our basis into tangent space
compute light values for each vector.

At the pixel level. . .
Transform the normal from a normal map into our basis
Sample three light map colors, and blend between them based the transformed vector
lightmapColor[0] * dot( bumpBasis[0], normal )+lightmapColor[1] * dot( bumpBasis[1], normal )+lightmapColor[2] * dot( bumpBasis[2], normal )


When they say "compute light values for each vector",do they mean that,when building the radiosity map,they use T,B,N vectors as normals and calculate 3 different light values?And then,at the pixel level,perform some kind of weighting between these 3 values based on the direction of the normal obtained from the normalmap?


[Edited by - mikeman on September 5, 2004 10:24:24 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this