Changeset 2988 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 10/02/08 10:05:06 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2986 r2988 83 83 OUT.color = col; 84 84 85 OUT.color.xyz = color.w / 1e3f;85 OUT.color.xyz = color.w; 86 86 87 87 #if 1 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r2984 r2988 95 95 // hack: squeeze some information about ambient into the texture 96 96 //pix.col.w = glstate.material.emission.x; 97 pix.col.w = length( currentPos - IN.worldPos);97 pix.col.w = length((currentPos - IN.worldPos) * maxDepth); 98 98 99 99 return pix; … … 118 118 // hack: squeeze some information about the ambient term into the target 119 119 //pix.col.w = glstate.material.emission.x; 120 pix.col.w = length( currentPos - IN.worldPos);120 pix.col.w = length((currentPos - IN.worldPos) * maxDepth); 121 121 122 122 return pix; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2987 r2988 55 55 } 56 56 57 57 58 float3 Interpol(float2 w, float3 bl, float3 br, float3 tl, float3 tr) 58 59 { 59 60 //float3 x1 = lerp(oldColor.w, logLumScaled, 0.1f); 60 float3 x1 = bl * (1.0f - w.x) + br * w.x;61 float3 x2 = tl * (1.0f - w.x) + tr * w.x;62 63 float3 v = x1 * (1.0f - w.y) + x2 * w.y;61 float3 x1 = lerp(bl, tl, w.y); //bl * (1.0f - w.x) + br * w.x; 62 float3 x2 = lerp(br, tr, w.y); //tl * (1.0f - w.x) + tr * w.x; 63 64 float3 v = lerp(x1, x2, w.x); //x1 * (1.0f - w.y) + x2 * w.y; 64 65 65 66 return v; 66 67 } 68 69 70 float2 Interpol2(float2 w, float2 bl, float2 br, float2 tl, float2 tr) 71 { 72 //float3 x1 = lerp(oldColor.w, logLumScaled, 0.1f); 73 float2 x1 = lerp(bl, tl, w.y); //bl * (1.0f - w.x) + br * w.x; 74 float2 x2 = lerp(br, tr, w.y); //tl * (1.0f - w.x) + tr * w.x; 75 76 float2 v = lerp(x1, x2, w.x); //x1 * (1.0f - w.y) + x2 * w.y; 77 78 return v; 79 } 80 67 81 68 82 /** The ssao shader returning the an intensity value between 0 and 1 … … 81 95 uniform float3 br, 82 96 uniform float3 tl, 83 uniform float3 tr, 84 uniform float maxDepth 97 uniform float3 tr 85 98 ) 86 99 { … … 92 105 float numSamples = 0; 93 106 94 const float y_angle = 0.43633231299858239423092269212215;95 const float x_angle = 0.58177641733144319230789692282954;96 107 97 108 for (int i = 0; i < NUM_SAMPLES; ++ i) … … 117 128 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 118 129 119 float newOffs = 0.5f + offsetTransformed * 0.5f;130 float2 newOffs = 0.5f + offsetTransformed * 0.5f; 120 131 121 132 float3 rotView = normalize(Interpol(newOffs, bl, br, tl, tr)); 122 float3 sample_position = (eyePos - rotView * eyeSpaceDepth) / maxDepth;133 float3 sample_position = eyePos - rotView * eyeSpaceDepth; 123 134 //float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 124 135 … … 180 191 // the current world position 181 192 const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 182 // the current color 193 194 const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 195 float3 view2 = normalize(Interpol(IN.texCoord.xy, bl, br, tl, tr)); 196 197 float4 centerPosition2; 198 centerPosition2.xyz = eyePos - view2 * eyeDepth; 199 // the current depth 183 200 const float currentDepth = centerPosition.w; 184 201 … … 186 203 float3 viewDir = normalize(IN.view); 187 204 188 /* const float eyeSpaceDepth = tex2D(colors, IN.texCoord.xy).w;189 190 float3 sample_position = eyePos - viewDir * eyeSpaceDepth;191 192 OUT.illum_col.xyz = centerPosition.xyz * maxDepth - sample_position;193 OUT.illum_col.w = currentDepth;194 return OUT;195 */196 205 //const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 197 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition , w, viewDir, eyePos, positions,198 bl, br, tl, tr , maxDepth);206 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition2, w, viewDir, eyePos, positions, 207 bl, br, tl, tr); 199 208 200 209
Note: See TracChangeset
for help on using the changeset viewer.