Changeset 3195 for GTP/trunk/App
- Timestamp:
- 11/29/08 18:24:53 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp
r3193 r3195 175 175 ambient.x = ambient.y = ambient.z = 0.2f; 176 176 //diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 177 diffuse.x = 0. 8f; diffuse.y = 0.8f; diffuse.z = 0.4f;177 diffuse.x = 0.4f; diffuse.y = 0.6f; diffuse.z = 0.6f; 178 178 //diffuse.x = diffuse.y = diffuse.z = 1.0f; 179 179 spec.x = spec.y = spec.z = .0f; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3194 r3195 544 544 // multisampling is difficult / costly with deferred shading 545 545 // at least do some edge blurring 546 if (useAntiAliasing) AntiAliasing(fbo, light); //else546 if (useAntiAliasing) AntiAliasing(fbo, light); else 547 547 Output(fbo); // just output the latest buffer 548 548 … … 729 729 730 730 // read the second buffer, write to the first buffer 731 FlipFbos(fbo);731 //FlipFbos(fbo); 732 732 // end of the pipeline => just draw image to screen 733 //FrameBufferObject::Release();733 FrameBufferObject::Release(); 734 734 735 735 // the neighbouring texels … … 954 954 whiteLum = log(WHITE_LUMINANCE); 955 955 956 957 956 //////////////////// 958 957 //-- linear interpolate brightness key depending on the current sun position -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3194 r3195 7 7 8 8 //#define NUM_SAMPLES 8 9 #define NUM_SAMPLES 1610 //#define NUM_SAMPLES 249 //#define NUM_SAMPLES 16 10 #define NUM_SAMPLES 24 11 11 12 12 // for quadratic falloff 13 //#define SAMPLE_INTENSITY 0. 5f14 #define SAMPLE_INTENSITY 0.5f13 //#define SAMPLE_INTENSITY 0.9f 14 #define SAMPLE_INTENSITY 2.0f 15 15 16 16 //#define SAMPLE_INTENSITY 0.075f 17 17 //#define SAMPLE_INTENSITY 0.2f 18 18 19 //#define SAMPLE_RADIUS 8e-1f20 19 #define SAMPLE_RADIUS 8e-1f 20 //#define SAMPLE_RADIUS 15e-1f 21 21 22 22 //#define DISTANCE_SCALE 1e-1f … … 30 30 //#define NUM_SSAO_FILTERSAMPLES 80 31 31 #define NUM_SSAO_FILTER_SAMPLES 16 32 #define NUM_SSAO_FILTER_WIDTH 12.0f33 #define SSAO_CONVERGENCE_WEIGHT 200.0f32 #define SSAO_FILTER_WIDTH 12.0f 33 #define SSAO_CONVERGENCE_WEIGHT 300.0f 34 34 35 35 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3193 r3195 68 68 normalFactor = max(dot(sampleNorm, centerNormal), 1e-3f); 69 69 //convergenceFactor = min(100.0f, aoSample.y); 70 convergenceFactor = aoSample.y ;70 convergenceFactor = aoSample.y + 1.0f; 71 71 72 72 // combine the weights … … 133 133 //samplePos = ReconstructSamplePos(ssaoTex, sampleTexCoord.xy, bl, br, tl, tr); 134 134 135 len = min(SqrLen(centerPos - samplePos), 1e 3f);135 len = min(SqrLen(centerPos - samplePos), 1e2f); 136 136 137 137 spatialFactor = 1.0f / max(len, 1e-3f); 138 138 139 normalFactor = max(step(.01f, dot(sampleNorm, centerNormal)), 1e-3f);139 //normalFactor = max(step(.0f, dot(sampleNorm, centerNormal)), 1e-2f); 140 140 //normalFactor = max(dot(sampleNorm, samplePos), 1e-3f); 141 convergenceFactor = min(convergenceThresh, aoSample.y + 1); 141 convergenceFactor = aoSample.y + 1.0f; 142 //convergenceFactor = max(step(0.5f + NUM_SAMPLES, aoSample.y), 1e-2f); 142 143 //convergenceFactor = aoSample.y; 143 144 144 145 // combine the weights 145 w = convergenceFactor * spatialFactor* normalFactor;146 w = convergenceFactor * convergenceFactor * spatialFactor;// * normalFactor; 146 147 //w = spatialFactor * normalFactor; 147 148 … … 177 178 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 178 179 180 float4 dummy; 181 const float xoffs = .5f / 1024.0f; 182 const float yoffs = .5f / 768.0f; 183 184 dummy.x = tex2Dlod(ssaoTex, float4(IN.texCoord + float2(xoffs, 0), 0, 0)).y; 185 dummy.y = tex2Dlod(ssaoTex, float4(IN.texCoord + float2(0, yoffs), 0, 0)).y; 186 dummy.z = tex2Dlod(ssaoTex, float4(IN.texCoord + float2(-xoffs, 0), 0, 0)).y; 187 dummy.w = tex2Dlod(ssaoTex, float4(IN.texCoord + float2(0, -yoffs), 0, 0)).y; 188 189 const float convergence = min(min(dummy.x, dummy.y), min(dummy.z, dummy.w)); 190 //const float convergence = max(max(dummy.x, dummy.y), max(dummy.z, dummy.w)); 191 //const float convergence = ao.y; 192 193 // filter reaches size 1 after thres samples 194 const float thres = 500.0f; 195 179 196 // filter up to a certain convergance value and leave out background (sky) by checking depth 180 if (( ao.y < 500.0f) && (col.w < 1e10f))197 if ((convergence < thres) && (col.w < 1e10f)) 181 198 //if (col.w < 1e10f) 182 199 { … … 185 202 const float distanceScale = 1.0f; 186 203 187 const float convergence = ao.y + 1;188 const float convergenceScale = SSAO_CONVERGENCE_WEIGHT / (convergence + SSAO_CONVERGENCE_WEIGHT);189 190 const float scale = NUM_SSAO_FILTER_WIDTH * convergenceScale * distanceScale;204 const float convergenceWeight = thres / (SSAO_FILTER_WIDTH - 1.0f); 205 const float convergenceScale = convergenceWeight / (convergence + convergenceWeight); 206 207 const float scale = SSAO_FILTER_WIDTH * convergenceScale * distanceScale; 191 208 192 209 // the filtered ssao value … … 199 216 OUT.illum_col.xyz = col.xyz; 200 217 201 //OUT.illum_col.xyz = float3(ao.x, ao.x, ao.x); 202 //OUT.illum_col.xyz = float3(0, clamp(1.0f - ao.y * 1e-2f, 0, 1), 1); 218 OUT.illum_col.xyz = float3(ao.x, ao.x, ao.x); 219 //OUT.illum_col.xyz = float3(0, clamp(1.0f - ao.y * 1e-3f, 0, 1), 1); 220 //OUT.illum_col.xyz = float3(0, 1.0f - step(0.5f + NUM_SAMPLES, convergence), 1); 203 221 OUT.illum_col.w = col.w; 204 222 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3193 r3195 64 64 OUT.color = col; 65 65 // store scaled view vector so wie don't have to normalize for e.g., ssao 66 OUT.color.w = color.w;// / length(IN.view); 67 //OUT.color = color; 66 //OUT.color.w = color.w / length(IN.view); 67 OUT.color.w = color.w; 68 68 69 return OUT; 69 70 } … … 164 165 165 166 float shadowTerm = CalcShadowTerm(IN, shadowMap, sampleWidth, lightSpacePos.xy, lightSpacePos.z, samples, weights, noiseTex); 166 167 167 diffuse *= shadowTerm; 168 168 } … … 296 296 pixel pix; 297 297 298 const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0 ,0)).xyz); 298 //const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0 ,0)).xyz); 299 const float3 normal = tex2Dlod(normalsTex, float4(IN.texCoord, 0 ,0)).xyz; 299 300 const float3 difVec = tex2Dlod(diffVals, float4(IN.texCoord, 0 ,0)).xyz; 300 301 … … 302 303 float4 color = tex2Dlod(colorsTex, float4(IN.texCoord, 0, 0)); 303 304 305 306 float4 dummy; 307 const float xoffs = .5f / 1024.0f; 308 const float yoffs = .5f / 768.0f; 309 310 dummy.x = tex2Dlod(colorsTex, float4(IN.texCoord + float2(xoffs, 0), 0, 0)).w; 311 dummy.y = tex2Dlod(colorsTex, float4(IN.texCoord + float2(0, yoffs), 0, 0)).w; 312 dummy.z = tex2Dlod(colorsTex, float4(IN.texCoord + float2(-xoffs, 0), 0, 0)).w; 313 dummy.w = tex2Dlod(colorsTex, float4(IN.texCoord + float2(0, -yoffs), 0, 0)).w; 314 color.w = max(max(dummy.x, dummy.y), max(dummy.z, dummy.w)); 315 304 316 // store scaled view vector so wie don't have to normalize for e.g., ssao 305 317 color.w /= length(IN.view); 306 //color.w = 1;307 318 308 319 // do reprojection and filter out the pixels that are not save -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/normalMapping.cg
r3168 r3195 125 125 float3x3 tangToWorldTrafo = transpose(float3x3(tangent, bitangent, normal)); 126 126 127 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz * 2.0f - float3(1.0f); 127 //const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz * 2.0f - float3(1.0f); 128 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz; 129 pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 130 //pix.normal = tangentSpaceNorm; 128 131 129 pix.normal = normalize(mul(tangToWorldTrafo, tangentSpaceNorm));130 131 132 return pix; 132 133 } … … 171 172 float3x3 tangToWorldTrafo = transpose(float3x3(IN.tangent.xyz, IN.bitangent.xyz, IN.normal.xyz)); 172 173 const float3 tangentSpaceNorm = tex2Dlod(normalMap, float4(IN.texCoord.xy, 0, 0)).xyz; 173 pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 174 //pix.normal = mul(tangToWorldTrafo, tangentSpaceNorm); 175 pix.normal = tangentSpaceNorm; 174 176 175 177 return pix; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3193 r3195 393 393 if (eyeSpaceDepth < 1e10f) 394 394 { 395 //ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight);396 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals);395 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight); 396 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 397 397 } 398 398 else
Note: See TracChangeset
for help on using the changeset viewer.