Offset limiting in parallax mapping

What is the best way to limit offset in parallax mapping? The original paper advises to drop division by zth component of view vector, but I think, that there was a solution to divide by tangent of something, not sure what…

Well, from what i’ve seen, offset limiting is simply normalizing the Eye vector and adding a bias to the heightmap.

Heres the fragshader code i use:

		//get height of fragment
		float VDCoord = texture2D(HeightMap,gl_TexCoord[0].xy).x;
		// Bias height (so that white is not too high, and black is 'deep')
		VDCoord = VDCoord * 0.03 - 0.015;
		// Normalize frag->Eye vector
		vec3 EyeTemp = normalize(EyePos);
		//Apply Parallax mapping to texcoords
		gl_TexCoord[0].xy = VDCoord * EyeTemp.xy + gl_TexCoord[0].xy;
   

This is the only way Ive seen, so i think its the best way, but if anyone has a faster/better way i’d be glad to see it too.

Looks like Twixn isn’t doing the divide by z, just like M/\dm/
said. (Wow, M/\dm/
is hard to type fast.) I originally took out the divide by z because it gives a decent effect and it’s faster than doing any fancy extra math.

If I recall correctly, you was first to suggest parallax mapping, yes? Cool effect :slight_smile:
I implemented the method by reading pdf about it, and I am ommiting z too. Gives speedup and seems to work nice, but I think I read somewhere about some tg stuff. Maybe I’m just mistaking something.