- Timestamp:
- 11/29/08 18:24:53 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.