Changeset 3005 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 10/05/08 23:13:58 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2992 r3005 48 48 float4 outColor; 49 49 50 if (position.w > 1e19f) outColor = color; 50 // hack: prevent shading the sky 51 if (position.z > 1e19f) outColor = color; 51 52 //if (emmisive > 1.5f) outColor = color; 52 53 else outColor = (ambient + diffuse) * color; 53 54 54 55 return outColor; 55 //return saturate((((ambient + diffuse)) * (1.0f - emmisive) + emmisive) * color);56 56 } 57 57 … … 188 188 // calc diffuse illumination + shadow term 189 189 //if ((emmisive < 1.5f) // hack: prevent shadowing the sky 190 if ( 191 (position.w < 1e19f) 190 if ((position.z < 1e19f) 192 191 && (angle > 1e-3f) // shadow only if diffuse color has some minimum intensity 193 192 ) … … 209 208 // base lighting 210 209 //OUT.color = (emmisive > 1.5f) ? color: (ambient + diffuse) * color; 211 OUT.color = (position. w> 1e19f) ? color: (ambient + diffuse) * color;210 OUT.color = (position.z > 1e19f) ? color: (ambient + diffuse) * color; 212 211 213 212 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r3004 r3005 37 37 struct pixel 38 38 { 39 40 41 float4pos: COLOR1;42 39 float4 col: COLOR0; 40 //float4 pos: COLOR1; 41 float3 pos: COLOR1; 42 float4 norm: COLOR2; 43 43 }; 44 44 … … 113 113 pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 114 114 115 #if 1 115 116 // save world position in second render target 116 pix.pos = IN.worldPos * maxDepth; 117 // store the projected depth 118 pix.pos.w = projPos.z; 117 pix.pos = IN.worldPos.xyz * maxDepth; 118 #endif 119 119 120 120 return pix; … … 150 150 pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 151 151 152 pix.pos = IN.worldPos * maxDepth; 153 // store the projected depth154 pix.pos.w = projPos.z; 152 #if 1 153 pix.pos = IN.worldPos.xyz * maxDepth; 154 #endif 155 155 156 156 return pix; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg
r2982 r3005 31 31 { 32 32 float4 col: COLOR0; 33 float 4pos: COLOR1;33 float3 pos: COLOR1; 34 34 float4 norm: COLOR2; 35 35 }; … … 112 112 113 113 pix.col = IN.color2; 114 pix. pos = 1e20f;114 pix.col.w = 2.0f; 115 115 116 116 pix.norm.xyz = IN.normal; 117 pix.norm.w = IN.mypos.w; 118 119 pix.pos = 1e20f; 117 120 118 pix.norm.w = IN.mypos.w;119 pix.pos.w = 1e20f;120 121 pix.col.w = 2.0f;122 123 121 return pix; 124 122 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3004 r3005 170 170 171 171 172 // the current world position173 const float4 centerPosition = tex2D(positions, IN.texCoord.xy);174 175 172 #if USE_EYE_SPACE_DEPTH 176 173 /// reconstruct position from the eye space depth 177 174 float3 viewDir = IN.view; 178 175 const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 179 float4 centerPosition2; 180 181 centerPosition 2.xyz = eyePos - viewDir * eyeDepth;182 centerPosition 2.w = centerPosition.w;183 184 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition 2, w, eyePos, bl, br, tl, tr);176 177 float4 centerPosition; 178 centerPosition.xyz = eyePos - viewDir * eyeDepth; 179 centerPosition.w = centerPosition.w; 180 181 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 185 182 #else 186 183 184 // the current world position 185 const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 186 187 187 const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 188 188 189 189 #endif 190 190 191 // get the current depth 191 ///////////////// 192 //-- compute temporally smoothing 193 194 float4 realPos = centerPosition * maxDepth; 195 realPos.w = 1.0f; 196 197 // calulcate the current depth 192 198 //const float currentDepth = centerPosition.w; 193 199 … … 198 204 199 205 200 /////////////////201 //-- compute temporally smoothing202 203 float4 realPos = centerPosition * maxDepth;204 realPos.w = 1.0f;205 206 207 206 /////////// 208 207 //-- reprojection new frame into old one … … 210 209 // calculate projected depth 211 210 float4 projPos = mul(oldModelViewProj, realPos); 212 projPos /= oldPos.w;211 projPos /= projPos.w; 213 212 214 213 // the current depth projected into the old frame -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg
r3003 r3005 22 22 float4 DownSample(frag IN, 23 23 uniform sampler2D colors, 24 float2 downSampleOffs[4]): COLOR24 uniform float2 downSampleOffs[4]): COLOR 25 25 { 26 26 float4 average = .0f; … … 130 130 float logLumScaled = logLum * INV_LOGLUM_RANGE - logLumOffset; 131 131 132 if (oldLogLum > 1e-5f) // too hight log lum132 if (oldLogLum > 1e-5f) // too bright 133 133 OUT.col.w = lerp(oldLogLum, logLumScaled, 0.1f); 134 134 else
Note: See TracChangeset
for help on using the changeset viewer.