Pentagram
06-03-2002, 10:54 AM
Hello
I implemented bump mapping in the quake engine but I have a problem on "some" (most of them are fine) polygons the light seems to dark.
You can see a shot of it here: http://studwww.rug.ac.be/~cholleme/tenebrae/bugshot.jpg
(Compare the floor to the wall and you will see what I mean)
I wondered if anyone recognized this specific error. (everyone seems to be doing bump maps here http://www.opengl.org/discussion_boards/ubb/wink.gif )
Some info on the techique:
-Normalization cube map with nomal map. (My tangent space is ok since it is used for texture coordinate genereation, anyway |N.(S x T)| = 1 and I have checked it multiple times)
-Distance attent. is ok (I havend changed it since I'm using bump maps)
Oh and if you're interested in the code that is done per vertex it is. (The if is due to the way Quake stores it's normals)
//calculate local light vector and put it into tangent space
VectorSubtract(lightOr,cl.worldmodel>vertexes[ind].position,lightDir);
tsLightDir[0] = DotProduct(lightDir,surf->texinfo->vecs[0]);
tsLightDir[1] = DotProduct(lightDir,surf->texinfo->vecs[1]);
if (surf->flags & SURF_PLANEBACK) {
tsLightDir[2] = -DotProduct(lightDir,surf->plane->normal);
} else {
tsghtDir[2] = DotProduct(lightDir,surf->plane->normal);
}
Actually i'm against pasting code because it is so boring to read all those posts with tons of code pasted into.
I implemented bump mapping in the quake engine but I have a problem on "some" (most of them are fine) polygons the light seems to dark.
You can see a shot of it here: http://studwww.rug.ac.be/~cholleme/tenebrae/bugshot.jpg
(Compare the floor to the wall and you will see what I mean)
I wondered if anyone recognized this specific error. (everyone seems to be doing bump maps here http://www.opengl.org/discussion_boards/ubb/wink.gif )
Some info on the techique:
-Normalization cube map with nomal map. (My tangent space is ok since it is used for texture coordinate genereation, anyway |N.(S x T)| = 1 and I have checked it multiple times)
-Distance attent. is ok (I havend changed it since I'm using bump maps)
Oh and if you're interested in the code that is done per vertex it is. (The if is due to the way Quake stores it's normals)
//calculate local light vector and put it into tangent space
VectorSubtract(lightOr,cl.worldmodel>vertexes[ind].position,lightDir);
tsLightDir[0] = DotProduct(lightDir,surf->texinfo->vecs[0]);
tsLightDir[1] = DotProduct(lightDir,surf->texinfo->vecs[1]);
if (surf->flags & SURF_PLANEBACK) {
tsLightDir[2] = -DotProduct(lightDir,surf->plane->normal);
} else {
tsghtDir[2] = DotProduct(lightDir,surf->plane->normal);
}
Actually i'm against pasting code because it is so boring to read all those posts with tons of code pasted into.