opengl - Normal mapping, confusion on space -
opengl - Normal mapping, confusion on space -
up now, normal mapping encountered maps in world space extracted info texture , transformed them normal matrix.
now wanted seek utilize normal map in tangent space, became confused.
what i've in code up-to-now is
vertex shader
... passedposition = modelviewmatrix*vec4(vertexposition,1.0); ...
fragment shader
vec3 v = normalize(-passedposition .xyz); // eye vector ... vec3 l_dir = passedposition .xyz - lights[i].lightposition.xyz; vec3 l = normalize(l_dir); ...
and proceed lighting calculations.
all tutorial came across alter lite directions , view vector tangent space (in vertex shared) , extract normal texture , maintain going (in fragment). issue here i'd avoid access lights info in vertex shared, questions are:
does create sense pass fragment shared t,b,n vectors transform lite directions there? should consider access lighting info in vertex shared (i have array of lite struck has more position) , passed them on fragment shared? i'd avoid, if much improve can think of it. there way perform normal mapping more compatible i've (snippets above posted). should consider alter calculations view space world space? in case, how can perform normal mapping? opengl glsl normals
Comments
Post a Comment