Ignore:
Timestamp:
08/24/08 12:48:59 (16 years ago)
Author:
mattausch
Message:

repaired view vector correction for ssao

File:
1 edited

Legend:

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

    r2861 r2863  
    77 
    88// rule of thumb: approx 1 / NUM_SAMPLES 
    9 #define SAMPLE_INTENSITY 0.2 
    10 //#define SAMPLE_INTENSITY 0.125f 
     9//#define SAMPLE_INTENSITY 0.2 
     10#define SAMPLE_INTENSITY 0.125f 
    1111 
    1212#define AREA_SIZE 9e-1f 
    13 #define VIEW_CORRECTION_SCALE 0.3f 
     13//#define VIEW_CORRECTION_SCALE 0.3f 
     14#define VIEW_CORRECTION_SCALE 1.0f 
    1415#define DISTANCE_SCALE 1e-6f 
    1516 
     
    5152 
    5253 
     54/** The ssao shader returning the an intensity value between 0 and 1 
     55*/ 
    5356float ssao(fragment IN, 
    5457                   uniform sampler2D positions, 
     
    101104                        (SAMPLE_INTENSITY * DISTANCE_SCALE) / (DISTANCE_SCALE + length_to_sample * length_to_sample); 
    102105 
    103                 // if normal perpenticular to view dir, only half of the samples count 
     106                // if surface normal perpenticular to view dir, the samples count less => compensate for this 
    104107                float view_correction = 1.0f + VIEW_CORRECTION_SCALE * (1.0f - dot(currentViewDir, currentNormal)); 
    105108 
     
    108111 
    109112        return (1.0f - total_ao); 
     113        //return float4(dot(currentViewDir, currentNormal)); 
    110114} 
    111115 
     
    226230        // expand normal 
    227231        normal = normalize(normal * 2.0f - 1.0f); 
     232        /// the current view direction 
    228233        float3 viewDir = normalize(IN.view * 2.0f - float3(1.0f)); 
    229234 
     
    235240        float ao = ssao(IN, positions, noiseTexture, samples, normal.xyz, viewDir, noiseMultiplier, centerPosition); 
    236241        float4 attenuated_color = ao * col; 
     242        //float4 attenuated_color = ao; 
    237243 
    238244        //float4 new_col = globIllum(IN, colors, positions, noiseTexture, samples, normal.xyz, viewDir, noiseMultiplier, centerPosition);  
    239         //float ao = new_col.w; 
    240245        //float4 attenuated_color = ao * col + new_col; 
    241246         
     
    266271        } 
    267272 
     273        //OUT.color.xyz = viewDir; 
     274        //OUT.color = attenuated_color; 
     275         
    268276        OUT.color.w = tex2D(colors, IN.texCoord.xy).w; 
    269277 
Note: See TracChangeset for help on using the changeset viewer.