Jump to content
  • Advertisement

Itun

Member
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

102 Neutral

About Itun

  • Rank
    Member
  1. Itun

    UVW mapping

    This model was exported from 3DS Max. Here is the original model: [font=verdana, arial, sans-serif]http://www.speedyshare.com/files/28223821/clown.zip.[/font]
  2. Itun

    UVW mapping

    [color=#333333]I want to know how the third texture coordinate influence to my model and there is such a situation:Here is model in DAE format: http://www.speedyshare.com/files/28222811/clown.rar If you have not Collada importer, look at this snippet: <mesh> <source id="geom-Line01-positions"> <float_array id="geom-Line01-positions-array" count="3969">-4.574107 9.329709 0.08463868 -0.4054546 8.766739 1.292424 1.775585 8.825006 0.075146 2.263489 6.411057 0.1705481 ...</float_array> <technique_common> <accessor source="#geom-Line01-normals-array" count="2944" stride="3"> <param name="X" type="float"/> <param name="Y" type="float"/> <param name="Z" type="float"/> </accessor> </technique_common> </source> <source id="geom-Line01-normals"> <float_array id="geom-Line01-normals-array" count="8832">0.03413525 0.9753383 0.2180594 0.06667629 0.979407 ..</float_array> <technique_common> <accessor source="#geom-Line01-normals-array" count="2944" stride="3"> <param name="X" type="float"/> <param name="Y" type="float"/> <param name="Z" type="float"/> </accessor> </technique_common> </source> <source id="geom-Line01-map1"> <float_array id="geom-Line01-map1-array" count="4704">0.7679129 0.9745173 0.5042325 0.7959707 0.9707325 0.56463 0.8106505 0.9711242 0.5037578 0.8139344 0.954895 0.5085286 0.8090085 0.9120827 0.5159985 0.8043709 0.8602077 0.5033876 0.8214802 0.8594028 0.5001622 0.8328388 0.8622966 0.5 0.8367841 0.8614986 0.5 0.8301358 0.8596589 0.5 0.8179256 0.8579739 0.5003169 0.800105 0.8595144 ...</float_array> <technique_common> <accessor source="#geom-Line01-map1-array" count="1568" stride="3"> <param name="S" type="float"/> <param name="T" type="float"/> <param name="P" type="float"/> </accessor> </technique_common> </source> <vertices id="geom-Line01-vertices"> <input semantic="POSITION" source="#geom-Line01-positions"/> </vertices> <triangles material="Material__166_1" count="1302"> <input semantic="VERTEX" source="#geom-Line01-vertices" offset="0"/> <input semantic="NORMAL" source="#geom-Line01-normals" offset="1"/> <input semantic="TEXCOORD" source="#geom-Line01-map1" offset="2" set="0"/> <p>0 0 0 1 1 ...</p> </triangles> <triangles material="klown1" count="1032"> <input semantic="VERTEX" source="#geom-Line01-vertices" offset="0"/> <input semantic="NORMAL" source="#geom-Line01-normals" offset="1"/> <input semantic="TEXCOORD" source="#geom-Line01-map1" offset="2" set="0"/> <p>140 162 517 ...</p> </triangles> </mesh> Here you can see three texture coordinates per vertex, how I can use the third? You may note that there is not 3D texture here, I don`t think that this is the projective texturing. The other thing which I have heard is UVW mapping and from the brief description of this technique I can assume that this is it.
  3. Itun

    UVW mapping

    I must recalculate texture coordinates due to the third coordinate, do not I? Could you explain in more detail or give a link with the explanation? How is this technique named?
  4. Itun

    UVW mapping

    Yes, I know. But I need to implement UVW mapping with GLSL.
  5. Your answer helps me. Thank you!
  6. Yes, you are right. I realize this in the evening after adding this post.
  7. I cannot find what how to do UVM mapping. Please, explain me or give me a link.
  8. I use this paper to make dual quaternion skinning. They use this algorithm: Input: dual quaternions ˆq1,...,ˆqp (uniform parameters) vertex position v and normal vn joints indices j1,..., jn and weights w1,...,wn Output: transformed vertex position v` and normal vn` ˆb = w1 ˆqj1 +...+wnqˆ jn // denote the non-dual part of ˆb as b0 and the dual one as b? c0 = b0/||b0|| c? = b?/||b0|| // denote the scalar part of c0 as a0 and its vector part as d0 // denote the scalar part of c? as a? and its vector part as d? v` = v+2d0 ×(d0 ×v+a0v)+2(a0d? ?a?d0 +d0 ×d?) vn` = vn +2d0 ×(d0 ×vn +a0vn) // note that vn` must be transformed by the inverse transpose matrix They have noted that I must use the inverse transpose matrix, but what matrix and Why do they use direct normal transformation without changes ( If it will be the matrices they must to use inverse transpose matrix), I think that quaternion must be changed, but don`t know how.
  9. I have written an animated render with Bump mapping. The model which I have used for test have an artifact. I want to know is it due to me or due to a modeler. Share an animated model with bump mapping with me. Thank you.
  10. [font=Arial,]Advise me how to store joint`s matrix (different transformations, matrices, quaternions, dual quaternions, etc )? And how to store interpolation information about animation(angles, quaternion, dual quaternion, matrices and etc)?[/font]
  11. [color="#333333"]In my project I have skinned model with bump mapping. I calculate tangent array in offline. But I don`t do Gram-Schmidt orthogonalization (because of the bones` transformations tangent and normal could become not orthogonal to each other, so I do this in the vertex shader after skinning). I pass an unnormalized tangent to the vertex shader. And this is my vertex shader: [color="#333333"] uniform mat4 MatrixArray[100]; varying vec3 lightVec; varying vec3 halfVec; attribute vec4 Weights; attribute vec4 Bones; attribute vec4 tangent; void main( void ) { gl_TexCoord[0] = gl_MultiTexCoord0; vec4 index = Bones; vec4 weight = Weights; vec4 normal = vec4( gl_Normal.xyz, 0.0 ); vec4 position = vec4( 0.0, 0.0, 0.0, 0.0 ); vec4 tempNormal = vec4( 0.0, 0.0, 0.0, 0.0 ); vec4 tangent0 = vec4( tangent.xyz, 0.0 ); vec4 tempTangent = vec4( 0.0, 0.0, 0.0, 0.0 ); for( float i = 0.0; i < 4.0; i += 1.0 ) { // Apply influence of bone i position = position + weight.x * (MatrixArray[int(index.x)] * gl_Vertex); tempNormal = tempNormal + weight.x * (MatrixArray[int(index.x)] * normal); tempTangent = tempTangent + weight.x * (MatrixArray[int(index.x)] * tangent0); // shift over the index/weight variables, this moves the index and // weight for the current bone into the .x component of the index // and weight variables index = index.yzwx; weight = weight.yzwx; if (weight == 0.0) break; } tempNormal = normalize(tempNormal); // Gram-Schmidt orthogonalization vec3 resTangent = tempTangent.xyz - tempNormal.xyz * dot (tempTangent.xyz, tempNormal.xyz); resTangent = normalize(resTangent); gl_TexCoord[0] = gl_MultiTexCoord0; // Building the matrix Eye Space -> Tangent Space vec3 n = normalize (gl_NormalMatrix * tempNormal.xyz); vec3 t = normalize (gl_NormalMatrix * resTangent); vec3 b = cross (n, t) * tangent.w; vec3 vertexPosition = vec3(gl_ModelViewMatrix * position); vec3 lightDir = normalize(gl_LightSource[0].position.xyz - vertexPosition); vertexPosition = normalize(vertexPosition); vec3 eyeDir = - vertexPosition; // transform light and half angle vectors by tangent basis vec3 v; v.x = dot (lightDir, t); v.y = dot (lightDir, b); v.z = dot (lightDir, n); lightVec = normalize (v); v.x = dot (eyeDir, t); v.y = dot (eyeDir, b); v.z = dot (eyeDir, n); vec3 eyeVec = normalize (v); halfVec = normalize(eyeVec + lightVec); gl_Position = gl_ModelViewProjectionMatrix * position; } [color="#333333"]Check me please. Is it an optimized shader?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!