I’ve been experimenting with parallax, maping yesterday, but faced some problems.
What I’ve been doing was:
1st: gluLookAt
2nd: draw geometry stage + passing tangent, binormal, normal to vp
3rd: passing eyepos, + MVP,MV,MVIT matrices to cg vp
4th: cg vp -> mul(mvit,eyepos), E=eyepos-IN.pos, mul(TBN, E)
5th: cg fp, fetch height from texture, normalize E, use the function to calculate offset offset=(h*E.xy/E.z)
The problem seems to be connected with transformations, as the texture appears to rotate vhen crossing some point (moving with gluLookAt)
Whoups, yes you’re right :eek: must start coding more carefully.
Now it’s only sharp angle artifacts to get rid of
I’ll have to sit a while to translate fp code to Cg, unfortunately I mised good ol’ assembly But docs rely on it…
Well, I also wrote a parallax mapping app (about 5 minutes ago) and so far i can see, my vp looks exact ys yours one.
Are you drawing some sort of patch? This would explain your static TBN vectors
Yup, right now I’m trying to sort things out on plane, then I’ll go into 3D + I think I’ll pass only 2 of 3 TBN vectors to GPU, 3rd will be cross on GPU (gonna see how FX5200 will handle that). And I’ve learned that uniform parameters are real pain in a** when you have 10+ shaders in one app.
[This message has been edited by M/\dm/
(edited 02-09-2004).]
But I noticed that there are prety ugly artifacts when parallax is applied on some of my textures:
W/O parallax http://www.lapas.dau.lv/salitis/1.bmp
W parallax http://www.lapas.dau.lv/salitis/2.bmp
Tried experimenting with biases, but that doesn’t seem to be a good solution, as you’ll have flaws or no parallax
Of course my textures arn’t very nice as they have a lot of sharp angles.