Enviroment mapping probelm
Hallo;
i am working on a magig cube and finally i want to add enviroment mapping. as it is a cube, the simple methode by just using the vertex normals wont work(flat faces), because they all have the same direction and so they point to the same uv at env_map.
so i use the common spherical uv technique.
i have a vector V, from my origin(0,0,- focus) to the vertexpoint.
V is not a unitvec.
Further i have my vertexnormal N(unit vec) and the reflecting vector R(no unit vec),
calculated by: R = V - (2*N*V)*N;
Then i get a m = 2 * sqrt(r.x² + r.y² + (r.z+1)²)
now i have the u,v coordinate:
u = (r.x/m + 0.5) * envmap_width;
v = (r.y/m + 0.5) * envmap_heigth;
it works fine for the case that there is no rotation,
but comes only a z-rotating into play erverything is distorted.
everything looks like a broken mirror.
i cant show u an image, but i hope that some did allready implement something like this or that
and can help me.
thanks
unwritten letters
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement