Ignore:
Timestamp:
07/14/08 18:17:50 (16 years ago)
Author:
mattausch
Message:
 
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

    r2835 r2836  
    77//#define SAMPLE_INTENSITY 0.125f 
    88// rule of thumb: approx 1 / NUM_SAMPLES 
    9 #define SAMPLE_INTENSITY 0.16 //0.0625f 
     9#define SAMPLE_INTENSITY 0.22 //0.0625f 
    1010 
    1111#define AREA_SIZE 5e-1f 
     
    1414struct fragment 
    1515{ 
    16   float4 pos: WPOS; // normalized screen position 
    17   float4 texCoord: TEXCOORD0;  
    18   float3 view: COLOR0; 
     16         // normalized screen position 
     17        float4 pos: WPOS; 
     18        float4 texCoord: TEXCOORD0;  
     19        float3 view: COLOR0; 
    1920}; 
    2021 
     
    6869 
    6970        const float areaSize = 5e-1f; 
    70         //const float areaSize = 3e-1f; 
    71         //const float sampleIntensity = 0.2f; 
    7271 
    7372        for (int i = 0; i < NUM_SAMPLES; i ++)  
     
    164163                        (SAMPLE_INTENSITY * distanceScale) / (distanceScale + length_to_sample * length_to_sample); 
    165164 
     165                const float view_correction_scale = 0.5f; 
    166166                // if normal perpenticular to view dir, only half of the samples count 
    167                 float view_correction = 1.0f + 0.5f * (1.0f - dot(currentViewDir, currentNormal)); 
     167                float view_correction = 1.0f + view_correction_scale * (1.0f - dot(currentViewDir, currentNormal)); 
    168168 
    169169                total_ao += cos_angle * distance_intensity * view_correction; 
    170                 total_color += cos_angle * distance_intensity * view_correction * sample_color; 
     170                total_color += cos_angle * distance_intensity * view_correction * sample_color * 0.3f; 
    171171        } 
    172172 
     
    234234        float ao = new_col.w; 
    235235 
    236         //float4 attenuated_color = ao * col + new_col; 
    237         float4 attenuated_color = ao * col; 
     236        float4 attenuated_color = ao * col + new_col; 
     237        //float4 attenuated_color = ao * col; 
    238238 
    239239        //OUT.color = ao; 
    240         //OUT.color = ao * col;  
     240        //OUT.color = ao * col; 
     241        //float4 col1 = attenuated_color; 
     242 
     243        const float x = 0.1f; 
     244 
    241245        float4 dummy = centerPosition * maxDepth; 
    242246        dummy.w = 1.0f; 
     247 
    243248        float4 oldPos = mul(oldModelViewProj, dummy); 
    244249 
    245250        float newDepth = oldPos.z / oldPos.w; 
    246251  
    247         const float x = 0.1f; 
    248  
    249252        float2 tex = (oldPos.xy / oldPos.w) * 0.5f + 0.5f; 
    250253        float4 col1 = tex2D(oldTex, tex); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r2834 r2836  
    7878  pix.pos = IN.worldPos * maxDepth; 
    7979  pix.norm.xyz = IN.normal * 0.5f + 0.5f; 
     80 
    8081  // hack: squeeze some information about ambient into the texture 
    8182  pix.norm.w = ambient.x; 
    8283  // hack: store projection coordinate for scaling ssao 
    8384  pix.pos.w = IN.projPos.w; 
     85 
     86  if (pix.col.w < 0.9f) 
     87          discard; 
     88 
    8489  pix.col.w = IN.mypos.z / IN.mypos.w; 
    8590 
Note: See TracChangeset for help on using the changeset viewer.