Changeset 2986 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 10/01/08 16:44:23 (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
r2985 r2986 83 83 OUT.color = col; 84 84 85 OUT.color.w = color.w; 86 85 OUT.color.xyz = color.w / 1e3f; 86 87 #if 1 88 89 OUT.color.w = color.w; 90 91 #else 87 92 88 93 //////////// 89 94 //-- write out logaritmic luminance for tone mapping 90 /* 95 91 96 float4 oldColor = tex2Dlod(colors, float4(IN.texCoord.xy, 0, MAX_LOD_LEVEL)); 92 97 … … 103 108 else 104 109 OUT.color.w = logLumScaled; 105 */ 110 111 #endif 112 106 113 return OUT; 107 114 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2985 r2986 32 32 33 33 34 float3 RotateY(float3 v, float a) 35 { 36 float3 r; 37 38 r.z = v.z * cos(a) - v.x * sin(a); 39 r.x = v.z * sin(a) + v.x * cos(a); 40 r.y = v.y; 41 42 return r; 43 } 44 45 46 float3 RotateX(float3 v, float a) 47 { 48 float3 r; 49 50 r.y = v.y * cos(a) - v.z * sin(a); 51 r.z = v.y * sin(a) + v.z * cos(a); 52 r.x = v.x; 53 54 return r; 55 } 34 56 35 57 /** The ssao shader returning the an intensity value between 0 and 1 … … 43 65 uniform float scaleFactor, 44 66 uniform float3 viewDir, 45 uniform float3 eyePos 67 uniform float3 eyePos, 68 uniform sampler2D positions, 69 uniform float3 bl, 70 uniform float3 br, 71 uniform float3 tl, 72 uniform float3 tr 46 73 ) 47 74 { … … 52 79 float total_ao = 0.0; 53 80 float numSamples = 0; 81 82 const float y_angle = 0.43633231299858239423092269212215; 83 const float x_angle = 0.58177641733144319230789692282954; 54 84 55 85 for (int i = 0; i < NUM_SAMPLES; ++ i) … … 75 105 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 76 106 77 float3 sample_position = eyePos - viewDir * eyeSpaceDepth; 78 107 float rotx = offsetTransformed.x * -x_angle; 108 float roty = offsetTransformed.y * -y_angle; 109 110 float3 rotView_x = RotateY(viewDir, x_angle); 111 float3 rotView = RotateX(rotView_x, y_angle); 112 113 float3 sample_position = eyePos - rotView * eyeSpaceDepth; 114 //float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 79 115 80 116 float3 vector_to_sample = sample_position - centerPosition.xyz; … … 117 153 uniform float maxDepth, 118 154 uniform float temporalCoherence, 119 uniform float3 eyePos 155 uniform float3 eyePos, 156 uniform float3 bl, 157 uniform float3 br, 158 uniform float3 tl, 159 uniform float3 tr 120 160 ) 121 161 { … … 137 177 float3 viewDir = normalize(IN.view); 138 178 139 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 179 /*const float eyeSpaceDepth = tex2D(colors, IN.texCoord.xy).w; 180 181 float3 sample_position = eyePos - viewDir * eyeSpaceDepth; 182 183 OUT.illum_col.xyz = centerPosition.xyz - sample_position; 184 OUT.illum_col.w = currentDepth; 185 return OUT;*/ 186 187 //const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 188 const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos, positions, 189 uniform float3 bl, 190 uniform float3 br, 191 uniform float3 tl, 192 uniform float3 tr); 140 193 141 194 … … 206 259 float4 ao = tex2D(ssaoTex, IN.texCoord.xy); 207 260 208 OUT.illum_col = col * ao.x;209 //OUT.illum_col.w = ao.w;261 //OUT.illum_col = col * ao.x; 262 OUT.illum_col = float4(ao.x,ao.x,ao.x, ao.w); 210 263 OUT.illum_col.w = col.w; 211 264
Note: See TracChangeset
for help on using the changeset viewer.