Changeset 3144 for GTP/trunk/App/Demos
- Timestamp:
- 11/19/08 17:37:11 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3143 r3144 477 477 #endif 478 478 479 /////// 479 ///////// 480 480 //-- pcf tabs for shadowing 481 481 … … 526 526 case SSAO: 527 527 ComputeSsao(fbo, tempCohFactor); 528 SmoothSsao(fbo);528 //SmoothSsao(fbo); 529 529 CombineSsao(fbo); 530 530 break; … … 810 810 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 811 811 GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 812 GLuint ssaoTex = mIllumFbo->GetColorBuffer(2 - mIllumFboIndex)->GetTexture();813 //GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetTexture();812 //GLuint ssaoTex = mIllumFbo->GetColorBuffer(2 - mIllumFboIndex)->GetTexture(); 813 GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetTexture(); 814 814 815 815 FlipFbos(fbo); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3128 r3144 287 287 static ShaderProgram *sDefaultVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultVertexMrt"); 288 288 289 //static ShaderProgram *sNormalMappingVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("normalMappingVertexMrt");290 //static ShaderProgram *sNormalMappingFragmentProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("normalMappingFragmentMrt");289 static ShaderProgram *sNormalMappingVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("normalMappingVertexMrt"); 290 static ShaderProgram *sNormalMappingFragmentProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("normalMappingFragmentMrt"); 291 291 292 292 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.cpp
r3128 r3144 44 44 CGerror lastError = cgGetError(); 45 45 46 if (lastError)46 if (lastError) 47 47 { 48 48 printf("Cg error, exiting...\n"); … … 124 124 125 125 126 //ShaderProgram *normalMappingVertexMrt, *normalMappingFragmentMrt;127 128 //normalMappingVertexMrt = CreateFragmentProgram("normalMapping", "vtx", "normalMappingVertexMrt");129 //normalMappingFragmentMrt = CreateFragmentProgram("normalMapping", "frag", "normalMappingFragmentMrt");126 ShaderProgram *normalMappingVertexMrt, *normalMappingFragmentMrt; 127 128 normalMappingVertexMrt = CreateVertexProgram("normalMapping", "vtx", "normalMappingVertexMrt"); 129 normalMappingFragmentMrt = CreateFragmentProgram("normalMapping", "frag", "normalMappingFragmentMrt"); 130 130 131 131 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3135 r3144 471 471 //-- load some dynamic stuff 472 472 473 //resourceManager->mUseNormalMapping = true;474 resourceManager->mUseNormalMapping = false;475 476 //LoadModel("fisch.dem", dynamicObjects);477 LoadModel("hbuddha.dem", dynamicObjects);473 resourceManager->mUseNormalMapping = true; 474 //resourceManager->mUseNormalMapping = false; 475 476 LoadModel("fisch.dem", dynamicObjects); 477 //LoadModel("hbuddha.dem", dynamicObjects); 478 478 479 479 resourceManager->mUseNormalMapping = false; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/normalMapping.cg
r3131 r3144 2 2 /* Shader for normal mapped geoemtry */ 3 3 /*******************************************/ 4 5 /**************************************************************/6 /* Shader computing the MRT output for normal mapped geoemtry */7 /**************************************************************/8 9 4 10 5 // input … … 13 8 float4 position: POSITION; 14 9 float4 normal: NORMAL; 15 float4 tangent: COLOR0;10 float4 color: COLOR0; 16 11 float4 texCoord: TEXCOORD0; 17 12 }; … … 24 19 float4 texCoord: TEXCOORD0; 25 20 26 float4 tangent: COLOR0;21 float4 tangent: TEXCOORD6; 27 22 // eye position 28 23 float4 eyePos: TEXCOORD1; … … 31 26 float4 worldPos: TEXCOORD3; 32 27 float4 oldWorldPos: TEXCOORD4; 33 float4 bitangent: TEXCOORD5 28 float4 bitangent: TEXCOORD5; 34 29 }; 35 30 … … 38 33 struct fragin 39 34 { 40 float4 tangent: COLOR0;35 float4 tangent: TEXCOORD6; 41 36 float4 texCoord: TEXCOORD0; 42 37 … … 47 42 float4 worldPos: TEXCOORD3; 48 43 float4 oldWorldPos: TEXCOORD4; 49 float4 bitangent: TEXCOORD5 44 float4 bitangent: TEXCOORD5; 50 45 }; 51 46 … … 69 64 vtxout OUT; 70 65 71 OUT. color= IN.color;66 OUT.tangent = IN.color; 72 67 OUT.texCoord = IN.texCoord; 73 68 … … 84 79 OUT.tangent = mul(glstate.matrix.invtrans.modelview[0], IN.color); 85 80 86 OUT.bitangent = cross(IN.tangent, IN.normal);81 OUT.bitangent = float4(cross(IN.color.xyz, IN.normal.xyz), 1); 87 82 88 83 return OUT; 89 84 } 85 86 87 88 /**************************************************************/ 89 /* Shader computing the MRT output for normal mapped geoemtry */ 90 /**************************************************************/ 90 91 91 92 … … 126 127 // as it is the inverse of a rotation matrix 127 128 float3x3 tangToWorldTrafo = transpose(float3x3(IN.tangent, IN.bitangent, IN.normal)); 128 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy ).xyz);129 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz; 129 130 pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 130 131 … … 133 134 134 135 135 pixel frag(fragin IN, uniform float4x4 viewMatrix) 136 pixel frag(fragin IN, 137 uniform float4x4 viewMatrix, 138 uniform sampler2D normalMap: TEXUNIT1) 136 139 { 137 140 pixel pix; 138 141 // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 139 pix.col = glstate.material.diffuse + glstate.material.emission;142 pix.color = glstate.material.diffuse + glstate.material.emission; 140 143 // save world space normal in rt => transform back into world space by 141 144 // multiplying with inverse view. since transforming normal with T means to 142 145 // multiply with the inverse transpose of T, we multiple with Transp(Inv(Inv(view))) = Transp(view) 143 pix.norm = mul(transpose(viewMatrix), IN.normal).xyz;146 pix.normal = mul(transpose(viewMatrix), IN.normal).xyz; 144 147 // eye space depth 145 pix.col .w = length(IN.eyePos.xyz);148 pix.color.w = length(IN.eyePos.xyz); 146 149 // the scene entity id 147 150 //pix.id = glstate.fog.color.xyz; … … 149 152 pix.offsVec = IN.oldWorldPos.xyz - IN.worldPos.xyz; 150 153 151 pixel pix;152 154 // compute tanget space in world space => transform basis vectors back into world space by 153 155 // multiplying with inverse view. since transforming normal with T means to … … 160 162 // compute tangent space - world space transform which is the transpose, 161 163 // as it is the inverse of a rotation matrix 162 float3x3 tangToWorldTrafo = transpose(float3x3(IN.tangent , IN.bitangent, IN.normal));163 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy ).xyz);164 float3x3 tangToWorldTrafo = transpose(float3x3(IN.tangent.xyz, IN.bitangent.xyz, IN.normal.xyz)); 165 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz; 164 166 pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 165 167 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3142 r3144 1 1 #include "../shaderenv.h" 2 2 3 3 4 //////////////////// … … 5 6 // based on shader of Alexander Kusternig 6 7 8 7 9 #define USE_EYESPACE_DEPTH 1 8 9 10 10 11
Note: See TracChangeset
for help on using the changeset viewer.