Changeset 3314 for GTP


Ignore:
Timestamp:
02/16/09 18:02:02 (15 years ago)
Author:
mattausch
Message:

reverted to old sampling scheme

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3313 r3314  
    625625        if (0) LoadPompeiiFloor(); 
    626626 
    627 #if 0 
     627#if 1 
    628628        const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 
    629629        //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
     
    11511151 
    11521152                //const float rotAngle = M_PI * 1e-3f; 
    1153                 const float rotAngle = 0.3f * M_PI / 180.0f; 
     1153                //const float rotAngle = 0.3f * M_PI / 180.0f; 
     1154                const float rotAngle = 1.0f * M_PI / 180.0f; 
    11541155 
    11551156                Matrix4x4 rotMatrix = RotationZMatrix(rotAngle); 
    11561157                dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 
    11571158 
    1158                 motionPath->Move(0.005f); 
     1159                const float moveSpeed = 5e-3f; 
     1160                motionPath->Move(moveSpeed); 
    11591161        } 
    11601162 
     
    25962598{ 
    25972599        const float radius = 5.0f; 
    2598         const Vector3 center(480.398f, 268.364f, 181.3); 
     2600        //const Vector3 center(480.398f, 268.364f, 181.3); 
     2601        const Vector3 center(480.398f, 269.364f, 181.3); 
    25992602 
    26002603        VertexArray vertices; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3313 r3314  
    6464#define USE_GTX 
    6565 
    66 #define SSAO_FILTER_RADIUS 3 
     66#define SSAO_FILTER_RADIUS 5 
    6767 
    6868#define DEPTH_THRESHOLD 1e10f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg

    r3313 r3314  
    6868        //samplePos = ReconstructSamplePos(ssaoTex, sampleTexCoord.xy, bl, br, tl, tr); 
    6969 
    70         float len = min(SqrLen(centerPos - samplePos), 1e2f); 
     70        //float len = min(SqrLen(centerPos - samplePos), 1e2f); 
     71        float len = distance(centerPos, samplePos); 
    7172        float spatialFactor = 1.0f / max(len, 1e-3f); 
    7273 
     
    7475 
    7576        // combine the weights 
    76         float w = convergenceFactor * convergenceFactor * spatialFactor;// * normalFactor; 
     77        //float w = convergenceFactor * convergenceFactor * spatialFactor; 
     78        float w = convergenceFactor * spatialFactor; 
     79        //float w = spatialFactor; 
    7780        float average = aoSample.x * w; 
    7881 
     
    114117} 
    115118 
     119 
     120/** In between step that only filters in one direction 
     121*/ 
     122pixel FilterSsaoHalfRes(fragment IN,  
     123                                                uniform sampler2D colorsTex, 
     124                                                uniform sampler2D ssaoTex, 
     125                                                uniform float3 bl, 
     126                                                uniform float3 br, 
     127                                                uniform float3 tl, 
     128                                                uniform float3 tr, 
     129                                                uniform float2 res 
     130                                                 ) 
     131{ 
     132        pixel OUT; 
     133 
     134        const float depth = tex2Dlod(colorsTex, float4(IN.texCoord, 0, 0)).w; 
     135 
     136        OUT.illum_col = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
     137        // compute minimal convergence for savetly reasons, write it out 
     138        const float convergence = ComputeConvergenceHalfRes(ssaoTex, IN.texCoord, res * 0.5f); 
     139        OUT.illum_col.y = convergence; 
     140 
     141        const float2 xyStep = float2(1.0f / res.x, 0); 
     142 
     143        // filter reaches size 1 pixel when sample size reaches threshold  
     144        // afterwards we do not use the filter anymore 
     145 
     146        // filter up to a certain convergance value and leave out background (sky) by checking depth 
     147        if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 
     148        { 
     149                // the filtered ssao value 
     150                OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence); 
     151        } 
     152 
     153        return OUT; 
     154} 
     155 
    116156/** In between step that only filters in one direction 
    117157*/ 
     
    149189} 
    150190 
    151 /** In between step that only filters in one direction 
    152 */ 
    153 pixel FilterSsaoHalfRes(fragment IN,  
    154                                                 uniform sampler2D colorsTex, 
    155                                                 uniform sampler2D ssaoTex, 
    156                                                 uniform float3 bl, 
    157                                                 uniform float3 br, 
    158                                                 uniform float3 tl, 
    159                                                 uniform float3 tr, 
    160                                                 uniform float2 res 
    161                                                  ) 
    162 { 
    163         pixel OUT; 
    164  
    165         const float depth = tex2Dlod(colorsTex, float4(IN.texCoord, 0, 0)).w; 
    166  
    167         OUT.illum_col = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
    168         // compute minimal convergence for savetly reasons, write it out 
    169         const float convergence = ComputeConvergenceHalfRes(ssaoTex, IN.texCoord, res * 0.5f); 
    170         OUT.illum_col.y = convergence; 
    171  
    172         const float2 xyStep = float2(1.0f / res.x, 0); 
    173  
    174         // filter reaches size 1 pixel when sample size reaches threshold  
    175         // afterwards we do not use the filter anymore 
    176  
    177         // filter up to a certain convergance value and leave out background (sky) by checking depth 
    178         if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 
    179         { 
    180                 // the filtered ssao value 
    181                 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence); 
    182         } 
    183  
    184         return OUT; 
    185 } 
    186191 
    187192/** Function combining image and indirect illumination buffer using a  
     
    223228        { 
    224229                //OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 
    225                 OUT.illum_col.xyz = max(2e-2f, 1.0f - ao.x); 
     230                OUT.illum_col.xyz = max(1e-3f, 1.0f - ao.x); 
    226231        } 
    227232        else 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3313 r3314  
    294294                // we check if the sample could have been near enough to the current pixel  
    295295                // to have any influence in the current or last frame 
     296#if 0 
    296297                const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 
    297                 //validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle)); 
     298                validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle)); 
     299#else 
    298300                validSamples = max(validSamples, pixelValid); 
     301#endif 
    299302 
    300303#ifdef USE_GTX 
     
    420423        const float partlyResetThres = 1.0f; 
    421424         
    422         if (1)//!isMovingObject) 
     425        if (!isMovingObject) 
    423426        { 
    424427                if (ao.y > completelyResetThres)  
Note: See TracChangeset for help on using the changeset viewer.