PDA

View Full Version : bump mapping



jide
02-08-2006, 08:39 AM
I tried to create emboss bump mapping, but I think I failed because the results are not convincing. I followed this help:

http://www.opengl.org/resources/tutorials/advanced/advanced98/notes/node107.html

But I'm not really sure how to do shifting. Here is how I actually do it:


nt[6*i+0] = t[6*i+0] + l[0]*im_w;
nt[6*i+1] = t[6*i+1] + l[1]*im_h;with nt are the new texture coordinates, t the normal ones, l the transform light-view vector in tangent space and im_w and im_h the texture size.
The main problems are im_w and im_h which I think are not really consistent, but didn't found out any other better solution.
I can see a little displacement between normal texcoords and shifted ones when I alternatively
display the object with both tex coords.

Also, I'm not totally sure on the steps, here is what I actually do:

1. Render the object normally.
2. Render the object with shifted texcoords with blend func set to (one,one).
3. Render again the object with normal texcoords with blend func set to (dst_color, src_color)
4. Render again the object with normal texcoords but with gouraud shading only.

dorbie
02-08-2006, 10:54 AM
Here's how I did it:

http://www.sgi.com/products/software/performer/brew/bumplogo.html

I don't know why you have two ordinary passes in there unless you're modulating by texture, but you say you just gouraud shade..... on top of your bump map result?

jide
02-09-2006, 03:10 AM
I try to do it exactly as the help stipples it. I do not use multitextures for the moment. So I render exactly the same object several times using blending but without using the accum buffer.

And yes I gouraud shade on the top of the previous passes. When I simply avoid that last pass, I can't notice any difference at all.

I think I do it exactly as stippled here:
http://www.opengl.org/resources/tutorials/advanced/advanced98/notes/node108.html

I also read the document you gave in link, but didn't really helped me for the moment. I don't really understand what derivative to use, in fact I don't see regarding what dimension the derivative is made (something like dx/dt or du/dx would have had helped me).

Korval
02-09-2006, 09:59 AM
I tried to create emboss bump mapping, but I think I failed because the results are not convincing.Of course not. It's emboss bump mapping; it almost never looks convincing, even when correctly implemented.

The emboss technique is a poor approximation of per-pixel lighting. Unless you are just investigating the technique, or your target hardware is pre-GeForce1 hardware, it is better to use other bump mapping techniques.

dorbie
02-09-2006, 10:55 AM
Go look at my example, if you can't get it looking as good as that you're doing something wrong. I show the results after each pass you should be seeing too you can do this also as a means of verifying correctness.

Don't forget the glBlendFUnc option to boost brightness in that last pass because you have to avoid the clamp in the second pass.

jide
02-11-2006, 05:14 AM
What to understand when saying object space coordinate ? I was beleiving it's the the space of the object when it doesn't have been transformed at all (no translation, no rotation...). But I could have read somewhere that I must do as if all vertices of the object where center to the origin.

dorbie
02-11-2006, 04:27 PM
Yes, object space is the untransformed object vertices.

Another way of describing this space is the untransformed object coordinates relative to the local object origin.

Basically the numbers you send to glVertex*() are object space coordinates.