i'm trying render environment map sphere surrounding scene. able sample environment map, panoramic photo, using uv coordinates derived direction vector (where origin fixed @ (0,0,0)).
how can project direction calculate 2d uv coordinates, can sample environment map?
calculating texture coordinates reflection map or environment map here.
vec3 r = reflect( -veyevec, n ); float m = 2. * sqrt(pow( r.x, 2. ) + pow( r.y, 2. ) + pow( r.z + 1., 2.0)); vreflectioncoord = r.xy / m + .5; vreflectioncoord.y = -vreflectioncoord.y;
Comments
Post a Comment