- Timestamp:
- 09/04/08 15:00:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r2897 r2903 46 46 uniform float3 currentNormal, 47 47 uniform float3 currentViewDir, 48 uniform float noiseMultiplier,49 48 uniform float4 centerPosition 50 49 ) … … 67 66 { 68 67 float2 offset = samples[i]; 69 //float3 offset = float3(samples[i], 0); 70 71 //sample noisetex; r stores costheta, g stores sintheta 72 float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy; 73 //float3 mynoise = float3(tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy, 0); 74 75 // reflect sampling using the noise texture 68 69 #if 1 70 //////////////////// 71 // add random noise: reflect around random normal vector (warning: slow!) 72 float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy).xy; 76 73 float2 offsetTransformed = myreflect(offset, mynoise); 77 74 #else 75 float2 offsetTransformed = offset; 76 #endif 78 77 // weight with projected coordinate to reach similar kernel size for near and far 79 78 float2 texcoord = IN.texCoord.xy + offsetTransformed * AREA_SIZE * w; … … 96 95 97 96 // if normal perpenticular to view dir, only half of the samples count 98 //const float view_correction = 1.0f + VIEW_CORRECTION_SCALE * (1.0f - dot(currentViewDir, currentNormal)); 99 //total_color.w -= cos_angle * distance_intensity * view_correction; 100 //total_color.xyz += cos_angle * distance_intensity * view_correction * sample_color * ILLUM_INTENSITY; 101 97 /* 98 const float view_correction = 1.0f + VIEW_CORRECTION_SCALE * (1.0f - dot(currentViewDir, currentNormal)); 99 total_color.w -= cos_angle * distance_intensity * view_correction; 100 total_color.xyz += cos_angle * distance_intensity * view_correction * sample_color * ILLUM_INTENSITY; 101 */ 102 102 total_color.w -= cos_angle * distance_intensity; 103 103 total_color.xyz += cos_angle * distance_intensity * sample_color * ILLUM_INTENSITY; … … 116 116 uniform sampler2D noiseTexture, 117 117 uniform float2 samples[NUM_SAMPLES], 118 uniform float noiseMultiplier,119 118 uniform sampler2D oldSsaoTex, 120 119 uniform sampler2D oldIllumTex, … … 146 145 147 146 float4 new_color = globIllum(IN, colors, positions, noiseTexture, 148 samples, normal, viewDir, noiseMultiplier,centerPosition);147 samples, normal, viewDir, centerPosition); 149 148 150 149
Note: See TracChangeset
for help on using the changeset viewer.