Ignore:
Timestamp:
08/27/08 20:05:41 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg

    r2875 r2876  
    8787 
    8888                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; 
    9090 
    9191                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 
    9394                float3 direction_to_sample = vector_to_sample / length_to_sample; 
    9495 
    9596                // 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); 
    9898 
    9999                // distance between current position and sample position controls AO intensity. 
    100                 float distance_intensity =  
     100                const float distance_intensity =  
    101101                        (SAMPLE_INTENSITY * DISTANCE_SCALE) / (DISTANCE_SCALE + length_to_sample * length_to_sample); 
    102102 
    103103                // 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)); 
    105105 
    106106                total_color.w -= cos_angle * distance_intensity * view_correction; 
Note: See TracChangeset for help on using the changeset viewer.