- Timestamp:
- 08/27/08 20:05:41 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r2875 r2876 87 87 88 88 float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, 1)).xyz; 89 float3 sample_color = tex2Dlod(colors, float4(texcoord, 0, 1)).xyz;89 float3 sample_color = tex2Dlod(colors, float4(texcoord, 0, 2)).xyz; 90 90 91 91 float3 vector_to_sample = sample_position - centerPosition.xyz; 92 float length_to_sample = length(vector_to_sample); 92 const float length_to_sample = length(vector_to_sample); 93 93 94 float3 direction_to_sample = vector_to_sample / length_to_sample; 94 95 95 96 // Angle between current normal and direction to sample controls AO intensity. 96 float cos_angle = dot(direction_to_sample, currentNormal); 97 cos_angle = max(cos_angle, 0.0f); 97 float cos_angle = max(dot(direction_to_sample, currentNormal), 0); 98 98 99 99 // distance between current position and sample position controls AO intensity. 100 float distance_intensity =100 const float distance_intensity = 101 101 (SAMPLE_INTENSITY * DISTANCE_SCALE) / (DISTANCE_SCALE + length_to_sample * length_to_sample); 102 102 103 103 // if normal perpenticular to view dir, only half of the samples count 104 float view_correction = 1.0f + VIEW_CORRECTION_SCALE * (1.0f - dot(currentViewDir, currentNormal));104 const float view_correction = 1.0f + VIEW_CORRECTION_SCALE * (1.0f - dot(currentViewDir, currentNormal)); 105 105 106 106 total_color.w -= cos_angle * distance_intensity * view_correction;
Note: See TracChangeset
for help on using the changeset viewer.