Refraction texture offset

Started by
0 comments, last by Prune 16 years, 4 months ago
In making an ice shader, I have a surface texture, and cube-map refraction and reflection, but also two subsurface textures which I want to be accessed with offsets in their texture coordinates based on the refraction vector. My question is the proper way to compute the offsets. The way I did it is by transforming the refraction ray to the local tangent space (untransformed, it is used to get the usual cube-map refraction), and then, assuming the subsurface texture lives 0.2 units under the surface, the offset I add to the texture coordinates is 0.2 * inner.xy / inner.z; However, I don't know if this is correct... and also should I normalize the interpolated inner before the division?
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
Advertisement
:?
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)

This topic is closed to new replies.

Advertisement