Ignore:
Timestamp:
08/29/08 15:46:36 (16 years ago)
Author:
mattausch
Message:

found bug with lod levels
made env file for shaders

File:
1 edited

Legend:

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

    r2882 r2884  
     1#include "../shaderenv.h" 
     2 
    13//////////////////// 
    24// Screen Spaced Ambient Occlusion shader 
    35// based on shader of Alexander Kusternig 
    46 
    5 #define NUM_SAMPLES 10 
    6 //#define NUM_SAMPLES 16 
    7  
    8 // rule of thumb: approx 1 / NUM_SAMPLES 
    9 //#define SAMPLE_INTENSITY 0.15f 
    10 #define SAMPLE_INTENSITY 0.22f 
    11  
    12 #define AREA_SIZE 7e-1f 
    13 //#define AREA_SIZE 3e-1f 
    14 #define VIEW_CORRECTION_SCALE 0.3f 
    15 //#define VIEW_CORRECTION_SCALE 0.5f 
    16 #define DISTANCE_SCALE 1e-6f 
    177 
    188 
     
    6656        for (int i = 0; i < NUM_SAMPLES; ++ i)  
    6757        { 
    68                 float2 offset = samples[i]; 
     58                const float2 offset = samples[i]; 
    6959 
    7060                //////////////////// 
    7161                // add random noise: r stores costheta, g stores sintheta 
    7262 
    73                 //float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy * 2.0f - 1.0f; 
     63                //const float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy * 2.0f - 1.0f; 
    7464                float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy; 
    7565 
    76                 float2 offsetTransformed = reflect(offset, mynoise); 
     66                const float2 offsetTransformed = reflect(offset, mynoise); 
    7767 
    7868                // weight with projected coordinate to reach similar kernel size for near and far 
     
    165155                (abs(depthDif) < 1e-3f)) 
    166156        { 
    167                 OUT.illum_col.x = ao * expFactor + oldCol.x * (1.0f - expFactor); 
     157                OUT.illum_col = (float4)ao * expFactor + oldCol.x * (1.0f - expFactor); 
    168158        } 
    169159        else 
    170160        { 
    171                 OUT.illum_col.x = ao; 
     161                OUT.illum_col = (float4)ao; 
    172162        } 
    173163 
     
    178168 
    179169 
    180  
    181170pixel combine(fragment IN,  
    182171                          uniform sampler2D colors, 
     
    185174        pixel OUT; 
    186175 
    187         float4 col = tex2D(colors, IN.texCoord.xy); 
     176        float4 col = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); 
    188177        float4 ao = tex2D(ssaoTex, IN.texCoord.xy); 
    189178 
    190179        OUT.illum_col = col * ao.x; 
     180        OUT.illum_col.w = ao.w; 
    191181 
    192182        return OUT; 
Note: See TracChangeset for help on using the changeset viewer.