Changeset 2833 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 07/11/08 01:12:05 (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
r2832 r2833 6 6 //#define SAMPLE_INTENSITY 0.5f 7 7 //#define SAMPLE_INTENSITY 1.1f 8 #define SAMPLE_INTENSITY 0. 7f8 #define SAMPLE_INTENSITY 0.25f 9 9 #define AREA_SIZE 5e-1f 10 10 … … 14 14 float4 pos: WPOS; // normalized screen position 15 15 float4 texCoord: TEXCOORD0; 16 float3 view: COLOR0; 16 17 }; 17 18 … … 51 52 uniform float2 samples[NUM_SAMPLES], 52 53 uniform float3 currentNormal, 53 uniform float noiseMultiplier)54 uniform float3 currentViewDir) 54 55 { 55 56 // the current world position … … 72 73 73 74 //sample noisetex; r stores costheta, g stores sintheta 74 float2 noise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy * 2.0f - 1.0f;75 float2 noise = tex2D(noiseTexture, IN.texCoord.xy * 7.1f).xy * 2.0f - 1.0f; 75 76 76 77 // rotation … … 98 99 //const float maxdist = 5e-1f; 99 100 const float distanceScale = 1e-6f; 100 //float distance_intensity = maxdist - length_to_sample; 101 float distance_intensity = (SAMPLE_INTENSITY * distanceScale) / (distanceScale + length_to_sample * length_to_sample); 102 //distance_intensity = max(distance_intensity, 0.0f); 103 // quadratic influence 104 //distance_intensity *= distance_intensity; 105 106 total_ao += cos_angle * distance_intensity; 101 102 float distance_intensity = 103 (SAMPLE_INTENSITY * distanceScale) / (distanceScale + length_to_sample * length_to_sample); 104 105 // if normal perpenticular to view dir, only half of the samples count 106 float view_correction = (2.0f - dot(currentViewDir, currentNormal)); 107 108 total_ao += cos_angle * distance_intensity * view_correction; 107 109 } 108 110 … … 133 135 float diffuseLight2 = max(dot(normal, light2), 0.0f); 134 136 135 float diffuse = diffuseLight + diffuseLight2; 137 //float diffuse = diffuseLight + diffuseLight2; 138 float diffuse = diffuseLight; 136 139 137 140 return (ambient + diffuse) * color * (1.0f - amb) + amb * color; … … 140 143 141 144 pixel main_ssao(fragment IN, 142 uniform sampler2D colors, 143 uniform sampler2D positions, 144 uniform sampler2D normals, 145 uniform sampler2D noiseTexture, 146 uniform float2 samples[NUM_SAMPLES], 147 uniform float noiseMultiplier) 145 uniform sampler2D colors, 146 uniform sampler2D positions, 147 uniform sampler2D normals, 148 uniform sampler2D noiseTexture, 149 uniform float2 samples[NUM_SAMPLES]) 148 150 { 149 151 pixel OUT; … … 154 156 // expand normal 155 157 normal = normalize(normal * 2.0f - 1.0f); 158 float3 viewDir = normalize(IN.view * 2.0f - float(1.0f)); 156 159 157 160 float4 col = shade(IN, colors, positions, normal, amb); 158 float ao = ssao(IN, positions, noiseTexture, samples, normal, noiseMultiplier);161 float ao = ssao(IN, positions, noiseTexture, samples, normal, viewDir); 159 162 160 163 //OUT.color = ao; … … 175 178 float amb = normal.w; 176 179 180 //OUT.color.xyz = IN.view; 177 181 // expand normal 178 normal = normalize(normal * 2.0f - 1.0f);182 normal = normalize(normal * 2.0f - float4(1.0f)); 179 183 180 184 float4 col = shade(IN, colors, positions, normal.xyz, amb); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r2822 r2833 91 91 pix.col = diffuse; 92 92 pix.pos = IN.worldPos * maxDepth; 93 pix.norm.xyz = IN.normal * 0.5f + 0.5f;93 pix.norm.xyz = IN.normal * 0.5f + float4(0.5f); 94 94 // hack: squeeze some information about ambient into the texture 95 95 pix.norm.w = ambient.x;
Note: See TracChangeset
for help on using the changeset viewer.