Monday, January 18, 2010

Faking Parallax

Faking parallax is one trick i've learned in videogame texturing, its applicable in non-videogame surfacing as long as it is used in the mid to far background. The bulb inside this headlight is created using the above technique, as we turn and look from the side, the bulb will become occluded, achieving a small sense of depth. The basic concept is to take the camera normal and use it to offset the UV normal Ns = normalize(transform("camera", N)); float x = xcomp(Ns); float y = ycomp(Ns); float z = zcomp(Ns); result = x; the above code is like facing direction, but only in the x direction, make another one for y. Invert y, set a new min/max with remap. The input min/max should be -1 to 1 and the new min/max should be something less than +/-0.25, depends on your texture and how much shift you want. Connect to a manifold slbox with the following snippet, float ss = s+v3; float tt = t+v4; result_Q = point(ss,tt,0); result_dQu = (0,0,0); result_dQv = (0,0,0); where v3 and v4 are the x and y from above. and then connect to your textures/shapes ST. You can do this in maya as well, just connect the camera normal from sampler info to uv offset of a place2d node. With a setrange in between, something like that, out of the top of my head.

2 comments:

Stuart Tozer said...

Great blog! :)

I've been interested in being able to do this in Maya for awhile. Any chance you could show how this is achieved in the hypershade in more detail, if not too busy sometime?

Cheers :)Ekar

Stuart Tozer said...

Alright- no worries now... figured out. Thanks again.

Post a Comment