PDA

View Full Version : Parallax Mapping Types/ Lighting



Swiftless
09-28-2006, 05:04 PM
Hi,

I have finally gotten around to implementing tangent space calculations into my program, and I now have basic Parallax Mapping working beautifully. But now I don't know which way to head.

I have read up on Parallax Occlusion Mapping and Steep Parallax Mapping and both seem impressive. Although I find the example for Steep Parallax Mapping, even more so.

Does anyone with experience with these two recommend a specific one, or is there some other method out there that I should head towards?

I am going for decent quality, but I still want it to run in real time. So relief mapping seems out of the equation.

Also, how does Parallax Mapping differ from Offset Parallax Mapping?

---

On a different topic, I have lighting in my program which seems to work (specifically diffuse). But I have noticed that on large flat surfaces, the light seems to create a cone from the light position outwards in one direction. So where the light is, the lighting is *tighter* from behind the light, and spreads alot further from the other side of the light. My light is not set to directional, but it seems to eminate from the light in a certain direction, even though it shouldn't.

Imagine pointing a torch at a wall on an angle. The light spreads outward along the wall, and doesn't spread so much where it first contacts the wall.

I will post some images later of this problem, as I am not on my computer at the moment (argh, school). The torch reference was the closest thing I could think of.

Any help would be greatly appreciated.
Thanks.

Vexator
09-28-2006, 11:41 PM
there was an example in the ati sdk (which i think was written by humus, so you should find it on his website as well: humus.ca)

Swiftless
10-22-2006, 11:37 PM
Hi, I have checked out humus's site and I must say I like it :)

I have worked out which parallax technique I am going with, but I still have my lighting dilemma.

Here is an image of what my lighting looks like.

http://swiftless.cdadc.com/pics/lighting.JPG

As you can see, the light appears to focus on a point (the white ball is the light position), then spreads out in a cone. It is supposed to spread out evenly in all directions.

If anyone can recognize this or knows what might be causing it, I would be very grateful.

I have checked my normals, they are correct, I have checked my tangents and binormals, and they are correct. My lighting shader is pretty much identical to the ones humus and other people have used. My lighting's w component is set to 1.0 (for a point light).

I have tried many different lighting shaders and just cannot figure out what is going wrong. If I invert my normals, it appears to focus in the other direction, with a smaller spread to either side of the apparent focus point.

**EDIT**

I just tested my code with a normal map, and the normal map lights up according to the light, but when I change this line:


vec3 bumptex = texture2D(texture_normal, texCoord);
bumptex = normalize(bumptex * 2.0 - 1.0); So that the 2.0 - 1.0 is something like 2.0 - 1.5, I get the same effect as in the screen shot above.

Komat
10-23-2006, 02:44 AM
Do you normalize the light vector and half vector inside the vertex shader? If you do, try to remove that normalization.

Swiftless
10-23-2006, 04:42 PM
No, I am not normalizing the light vector in the vertex shader.

And at this point I am not using the half vector. From what I have read, the half vector is mainly used for the specular component.

At the moment, I am just trying to get the diffuse component to work correctly.

Because I can get it to work with a normal map, it tends to suggest that my normals are incorrect. But there is nothing wrong with my normals. I have checked my normal calculation function with many found on the internet, and it appears correct. I will post the code for it if no one can recognize what might be causing this error.