Changeset 3097
- Timestamp:
- 11/05/08 01:09:27 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3095 r3097 74 74 75 75 // store scaled view vector so wie don't have to normalize for e.g., ssao 76 OUT.color.w = color.w;// / length(IN.view); 76 OUT.color.w = color.w / length(IN.view); 77 //OUT.color.w = color.w; 77 78 78 79 return OUT; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3095 r3097 55 55 { 56 56 const float eyeSpaceDepth = tex2Dlod(tex, float4(texcoord, 0, 0)).w; 57 float3 viewVec = normalize(Interpol(texcoord, bl, br, tl, tr)); 57 //float3 viewVec = normalize(Interpol(texcoord, bl, br, tl, tr)); 58 float3 viewVec = Interpol(texcoord, bl, br, tl, tr); 58 59 float3 samplePos = -viewVec * eyeSpaceDepth; 59 60 … … 146 147 //else trafo = inverseModelTrafo * oldModelViewProj; 147 148 148 float4 dummyPt = worldPos - float4(oldEyePos, 0);149 float4 dummyPt = worldPos - float4(oldEyePos, 0); 149 150 150 151 // reproject into old frame and calculate texture position of sample in old frame … … 161 162 162 163 // vector from eye pos to old sample 163 const float3 viewVec = normalize(Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr)); 164 const float3 oldWorldPos = oldEyeSpaceDepth * (-viewVec) + oldEyePos; 164 //const float3 viewVec = normalize(Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr)); 165 const float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 166 const float3 oldWorldPos = oldEyePos - oldEyeSpaceDepth * viewVec; 165 167 //const float3 oldWorldPos = - viewVec * eyeSpaceDepth; 166 168 //const float3 dummy14 = Interpol(texcoord0, bl, br, tl, tr); … … 232 234 uniform sampler2D noiseTex, 233 235 uniform float2 samples[NUM_SAMPLES], 234 uniform float3 currentNormal,236 uniform float3 normal, 235 237 uniform float3 centerPosition, 236 238 uniform float scaleFactor, … … 279 281 280 282 // angle between current normal and direction to sample controls AO intensity. 281 const float cosAngle = max(dot(dirSample, currentNormal), 0.0f);283 const float cosAngle = max(dot(dirSample, normal), .0f); 282 284 283 285 // the distance_scale offset is used to avoid singularity that occurs at global illumination when … … 290 292 // => compensate for this (on the other hand, projected sampling area could be larger!) 291 293 292 const float viewCorrection = 1.0f + VIEW_CORRECTION_SCALE * dot(viewDir, currentNormal);294 const float viewCorrection = 1.0f + VIEW_CORRECTION_SCALE * dot(viewDir, normal); 293 295 total_ao += cosAngle * aoContrib * viewCorrection; 294 296 #else … … 327 329 328 330 // reconstruct position from the eye space depth 329 const float3 viewDir = normalize(IN.view); 331 //const float3 viewDir = normalize(IN.view); 332 const float3 viewDir = IN.view; 330 333 const float eyeSpaceDepth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w; 331 const float4 eyeSpacePos = float4( eyeSpaceDepth * (-viewDir), 1.0f);334 const float4 eyeSpacePos = float4(-viewDir * eyeSpaceDepth, 1.0f); 332 335 333 336
Note: See TracChangeset
for help on using the changeset viewer.