- Timestamp:
- 11/23/08 21:31:29 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp
r3153 r3154 115 115 geom->mTangents[line].z = tangent.y; 116 116 117 geom->mTexcoords[line] = tex; 117 geom->mTexcoords[line].first = tex.first; 118 geom->mTexcoords[line].second = 1.0f - tex.second; 118 119 119 120 static int dummy = 0; 120 121 121 if (dummy ++ < 5) cout << "tangent: " << geom->mTangents[line] << endl; 122 122 ++ line; … … 176 176 177 177 ambient.x = ambient.y = ambient.z = 0.2f; 178 diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 179 spec.x = spec.y = spec.z = .0f; 178 //diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 179 diffuse.x = diffuse.y = diffuse.z = 1.0f; 180 spec.x = spec.y = spec.z = .0f; 180 181 emm = spec; 181 182 … … 217 218 218 219 // set boundary to repeat 219 int boundS = 1; int boundT = 1; 220 int boundS, boundT; 221 boundS = boundT = 1; 220 222 221 223 ofile.write(reinterpret_cast<char *>(&boundS), sizeof(int)); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
r3153 r3154 86 86 Vector3 normal = Normalize(mNormals[i]); 87 87 88 float dotProd = DotProd(tangent,normal); 89 90 tangent -= normal * dotProd; 91 tangent = Normalize(tangent); 88 float dotProd = DotProd(tangent, normal); 89 //tangent -= normal * dotProd;tangent = Normalize(tangent); 92 90 93 91 //mTangents[i] = tangent; 94 mTangents[i] = Vector3(0,1,0);//tangent * 0.5f + Vector3(0.5f);92 mTangents[i] = tangent * 0.5f + Vector3(0.5f); 95 93 } 96 94 … … 98 96 ((Vector3 *)data)[mNumVertices * 2 + i] = mTangents[i]; 99 97 100 for (int i = 0; i < 3; ++ i)101 cout << ((Vector3 *)data)[mNumVertices * 2 + i] << " ";102 103 98 currentPData += mNumVertices * 3; 104 99 } … … 125 120 if (mTangents) 126 121 { 127 cout << "dotprods: " << endl;128 129 for (int i = 0; i < 1000; ++ i)122 //cout << "dotprods: " << endl; 123 124 /*for (int i = 0; i < 100; ++ i) 130 125 { 131 126 //cout << mTangents[i] << " " << mNormals[i] << " " << DotProd(Normalize(mTangents[i]), Normalize(mNormals[i])) << endl; … … 135 130 } 136 131 cout << endl; 132 */ 137 133 134 for (int i = 0; i < 50; ++ i) 135 { 136 cout << mTexCoords[i].first << "," << mTexCoords[i].second << " "; 137 } 138 138 139 glColorPointer(3, GL_FLOAT, 0, (char *)NULL + currentPVbo); 139 140 currentPVbo += mNumVertices * sizeof(Vector3); … … 159 160 if (mHasTangents) 160 161 { 161 cout<<"x";162 162 glEnableClientState(GL_COLOR_ARRAY); 163 163 } 164 164 165 if (state->GetCurrentVboId() != mVboId) 165 166 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3153 r3154 377 377 378 378 const bool delGeometry = false; 379 return new Geometry(vertices, normals, texcoords, vertexCount, delGeometry, tangents);379 return new Geometry(vertices, normals, texcoords, vertexCount, delGeometry, NULL);//tangents); 380 380 } 381 381 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3151 r3154 13 13 //#define SAMPLE_INTENSITY 0.07f 14 14 15 #define SAMPLE_INTENSITY 0.075f 15 //#define SAMPLE_INTENSITY 0.075f 16 #define SAMPLE_INTENSITY 0.2f 16 17 17 18 #define SAMPLE_RADIUS 8e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
r3147 r3154 97 97 //float4 col = float4(w, w, w, 0); 98 98 //float4 col = float4(centerNormal * 0.5f + float3(0.5f), 0); 99 //col = step(.0f, col); 99 100 //float4 col = float4(centerNormal, 0); 100 101 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3153 r3154 74 74 // store scaled view vector so wie don't have to normalize for e.g., ssao 75 75 OUT.color.w = color.w;// / length(IN.view); 76 OUT.color = color;76 //OUT.color = color; 77 77 return OUT; 78 78 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/normalMapping.cg
r3153 r3154 64 64 vtxout OUT; 65 65 66 //float4 tangent = float4(IN.color.xyz * 2.0f - 1.0f, 1.0f); 67 //float4 tangent = float4(1,0,0,1); 68 float4 tangent = IN.color; 66 float4 tangent = float4(IN.color.xyz * 2.0f - float3(1.0f), 1.0f); 67 //float4 tangent = IN.color; 69 68 70 69 //float4 tangent = IN.color; … … 79 78 // transform the old vertex position into world space 80 79 OUT.oldWorldPos = mul(oldModelMatrix, IN.position); 80 81 81 // the normal has to be correctly transformed with the inverse transpose 82 // convert to view space 82 83 OUT.normal = mul(glstate.matrix.invtrans.modelview[0], IN.normal); 83 OUT.tangent = tangent;//mul(glstate.matrix.invtrans.modelview[0], tangent); 84 85 //OUT.bitangent = float4(cross(IN.color.xyz, IN.normal.xyz), 1); 86 //OUT.bitangent = float4(cross(OUT.tangent.xyz, OUT.normal.xyz), 1); 87 OUT.bitangent = float4(cross(OUT.normal.xyz, tangent.xyz), 1); 84 OUT.tangent = mul(glstate.matrix.invtrans.modelview[0], tangent); 85 86 OUT.bitangent = float4(cross(OUT.tangent.xyz, OUT.normal.xyz), 1); 87 //OUT.bitangent = float4(cross(OUT.normal.xyz, OUT.tangent.xyz), 1); 88 88 89 89 return OUT; … … 111 111 pix.offsVec = IN.oldWorldPos.xyz - IN.worldPos.xyz; 112 112 113 // compute tanget space in world space => transform basis vectors back into world space by 114 // multiplying with inverse view. since transforming normal with T means to 113 // compute tanget space to world space trafo => 114 // transform basis vectors back into world space by multiplying with inverse view. 115 // since transforming normal with T means to 115 116 // multiply with the inverse transpose of T, we multiple with 116 117 // Transp(Inv(Inv(view))) = Transp(view) 117 float3 normal = mul(transpose(viewMatrix), IN.normal).xyz;118 float3 tangent = mul(transpose(viewMatrix), IN.tangent).xyz;119 float3 bitangent = mul(transpose(viewMatrix), IN.bitangent).xyz;118 const float3 normal = normalize(mul(transpose(viewMatrix), IN.normal).xyz); 119 const float3 tangent = normalize(mul(transpose(viewMatrix), IN.tangent).xyz); 120 const float3 bitangent = normalize(mul(transpose(viewMatrix), IN.bitangent).xyz); 120 121 121 122 // compute tangent space - world space transform which is the transpose, 122 123 // as it is the inverse of a rotation matrix 123 float3x3 tangToWorldTrafo = transpose(float3x3(IN.tangent.xyz, IN.bitangent.xyz, IN.normal.xyz)); 124 const float3 tangentSpaceNorm = normalize(tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz); 125 //const float3 tangentSpaceNorm = tex2D(normalMap, IN.texCoord.xy).xyz; 124 float3x3 tangToWorldTrafo = transpose(float3x3(tangent, bitangent, normal)); 125 //float3x3 tangToWorldTrafo = transpose(float3x3(bitangent, tangent, normal)); 126 //float3x3 tangToWorldTrafo = transpose(float3x3(tangent, normal, bitangent)); 127 //float3x3 tangToWorldTrafo = transpose(float3x3(normal, bitangent, tangent)); 128 //float3x3 tangToWorldTrafo = transpose(float3x3(normal, tangent, bitangent)); 126 129 127 pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 130 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz * 2.0f - float3(1.0f); 131 //const float3 tangentSpaceNorm = float3(0, 1, 0); 132 //const float3 tangentSpaceNorm = float3(0, 0, 1); 133 134 pix.normal = normalize(mul(tangToWorldTrafo, tangentSpaceNorm)); 135 //pix.normal = normalize(tangentSpaceNorm); 128 136 //pix.color.xyz = float3(abs(dot(tangent.xyz, normal.xyz))); 137 //pix.color.xyz = float3(abs(dot(bitangent.xyz, tangent.xyz))); 129 138 //pix.color.xyz = float3(abs(dot(normalize(IN.normal.xyz), normalize(IN.tangent.xyz)))); 130 pix.color.xyz = float3(abs(dot(IN.normal.xyz, IN.tangent.xyz)));139 //pix.color.xyz = float3(abs(dot(IN.normal.xyz, IN.tangent.xyz))); 131 140 //pix.color.xyz = normal.xyz; 132 pix.color.xyz = IN.tangent.xyz; 133 141 //pix.color.xyz = IN.tangent.xyz; 142 //pix.color.xyz = float3(IN.texCoord.x,0,0); 143 //pix.color.xyz = float3(0,IN.texCoord.y,0); 144 134 145 return pix; 135 146 }
Note: See TracChangeset
for help on using the changeset viewer.