Changeset 3226


Ignore:
Timestamp:
12/20/08 09:00:10 (15 years ago)
Author:
mattausch
Message:

worked on submission

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3225 r3226  
    4141#camDirection=1 0 0 
    4242 
    43 camPosition=468.025 267.591 182.478 
    44 camDirection=0.937282 0.348573 -0 
     43#camPosition=468.025 267.591 182.478 
     44#camDirection=0.937282 0.348573 -0 
     45 
     46#camPosition=470.548 265.479 181.578 
     47#camDirection=-0.0383892 0.999263 -0 
     48 
     49camPosition=470.541 267.286 181.978 
     50camDirection=-0.100954 0.993856 -0.045363 
    4551 
    4652#lightDirection=-0.8f 1.0f -0.7f 
     
    5157## window options 
    5258 
    53 #winWidth=800 
    54 #winHeight=600 
     59winWidth=800 
     60winHeight=600 
    5561 
    56 winWidth=1024 
    57 winHeight=768 
     62#winWidth=1024 
     63#winHeight=768 
     64#winWidth=512 
     65#winHeight=384 
    5866 
    5967useFullScreen=0 
     
    92100ssaoKernelRadius=8e-1f 
    93101# ssao sample intensity 
    94 ssaoSampleIntensity=0.2f 
     102ssaoSampleIntensity=0.1f 
    95103# ssao temporal coherence factor 
    96104tempCohFactor=1000.0f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r3215 r3226  
    4040{  
    4141        mUseNormalMapping = false; 
     42        mUseSpecialColors = false; 
    4243} 
    4344 
     
    278279        } 
    279280 
     281        if (mUseSpecialColors) 
     282        { 
     283                tech->mAmbientColor.r = tech->mAmbientColor.g = tech->mAmbientColor.b = 0.2f; 
     284                tech->mDiffuseColor.r = 0.7f; tech->mDiffuseColor.g = 0.5f; tech->mDiffuseColor.b = 0.2f; 
     285        } 
     286 
    280287 
    281288        /////////////// 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h

    r3216 r3226  
    6262        /// giant hack: set this to true if the geometry to load has tangent data for normal mapping 
    6363        bool mUseNormalMapping; 
     64        bool mUseSpecialColors; 
    6465 
    6566 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3225 r3226  
    536536        //resourceManager->mUseNormalMapping = false; 
    537537 
     538        resourceManager->mUseSpecialColors = true; 
     539 
    538540        //LoadModel("fisch.dem", dynamicObjects); 
    539541        LoadModel("hbuddha.dem", dynamicObjects); 
     
    544546 
    545547        resourceManager->mUseNormalMapping = false; 
     548        resourceManager->mUseSpecialColors = false; 
    546549 
    547550        buddha = dynamicObjects.back(); 
     
    12851288                        deferredShader->SetSaveFrame("", -1);            
    12861289 
    1287                 if (makeSnapShot) makeSnapShot = false; 
     1290                //if (makeSnapShot) makeSnapShot = false; 
    12881291 
    12891292                ShadowMap *sm = showShadowMap ? shadowMap : NULL; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3225 r3226  
    77 
    88//#define NUM_SAMPLES 8 
    9 //#define NUM_SAMPLES 16 
    10 #define NUM_SAMPLES 24 
     9#define NUM_SAMPLES 16 
     10//#define NUM_SAMPLES 24 
    1111//#define NUM_SAMPLES 48 
    1212 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3225 r3226  
    124124 
    125125        // get position exactly between old texel centers 
    126         float2 center; 
     126        /*float2 center; 
    127127        center.x = (floor(IN.texCoord.x * w - .5f) + 1.0f) / w; 
    128128        center.y = (floor(IN.texCoord.y * h - .5f) + 1.0f) / h; 
     
    137137 
    138138        const float minConvergence = min(m1, m2); 
    139  
    140         //const float convergence = minConvergence; 
     139        const float convergence = minConvergence;*/ 
    141140        //const float convergence = 0; 
    142141        const float convergence = ao.y; 
     
    161160        // just apply ssao if we are not in the sky 
    162161        if (col.w < 1e10f) 
    163                 OUT.illum_col.xyz = col.xyz * max(1e-1f, 1.0f - ao.x); 
     162                OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 
     163                //OUT.illum_col.xyz = col.xyz * ao.x; 
    164164        else 
    165165                OUT.illum_col.xyz = col.xyz; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3212 r3226  
    315315 
    316316        const float4 difVec = tex2Dlod(diffVals, float4(IN.texCoord, 0, 0)); 
     317        // normalize normal once more because of bilinear interpolation 
    317318        const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0, 0)).xyz); 
    318319 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3225 r3226  
    225225        total_ao /= numSamples; 
    226226 
    227 #if 1 
     227#if 0 
    228228        // if surface normal perpenticular to view dir, approx. half of the samples will not count 
    229229        // => compensate for this (on the other hand, projected sampling area could be larger!) 
    230230        const float viewCorrection = 1.0f + VIEW_CORRECTION_SCALE * max(dot(viewDir, normal), 0.0f); 
    231         total_ao += cosAngle * aoContrib * viewCorrection; 
     231        total_ao *= viewCorrection; 
    232232 
    233233#endif 
    234234 
    235         return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 
     235        //return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 
     236        return float3(total_ao, validSamples, numSamples); 
    236237} 
    237238 
     
    260261                        float newWeight, 
    261262                        float sampleIntensity, 
    262                         bool isMovingObject 
     263                        bool isMovingObject, 
     264                        sampler2D normalTex 
    263265                        ) 
    264266{ 
     
    288290                 
    289291 
     292                // the normal of the current sample 
     293                //const float3 sampleNormal = tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz; 
     294                // angle between current normal and direction to sample controls AO intensity. 
     295                //float cosAngle2 = .5f + dot(sampleNormal, -normal) * 0.5f; 
     296 
    290297                //////////////// 
    291298                //-- compute contribution of sample using the direction and angle 
     
    303310                //const float aoContrib = (1.0f > lengthToSample) ? occlusionPower(9e-2f, DISTANCE_SCALE + lengthToSample): .0f; 
    304311 
     312                //total_ao += cosAngle2 * cosAngle * aoContrib; 
    305313                total_ao += cosAngle * aoContrib; 
    306314 
     
    318326                validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid); 
    319327 
    320 #ifdef USE_GTX 
     328#if 1//#ifdef U//USE_GTX 
    321329                // we can bail out early and use a minimal #samples) 
    322330                // if some conditions are met as long as the hardware supports it 
     
    343351 
    344352        return float3(total_ao, validSamples, numSamples); 
     353        //return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 
    345354} 
    346355 
     
    417426        if (eyeSpaceDepth < 1e10f) 
    418427        { 
    419                 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject); 
     428                ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject, normals); 
    420429                //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals, sampleIntensity); 
    421430        } 
     
    446455                else if (ao.y > partlyResetThres) 
    447456                { 
    448                         //oldWeight = min(oldWeight, 4.0f * newWeight); 
    449                         oldWeight = .0f;  
     457                        oldWeight = min(oldWeight, 4.0f * newWeight); 
     458                        //oldWeight = .0f;  
    450459                } 
    451460        } 
     
    458467        //-- blend ao between old and new samples (and avoid division by zero) 
    459468 
    460         OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / max(1e-6f, newWeight + oldWeight); 
     469        //OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / max(1e-6f, newWeight + oldWeight); 
     470        OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight) / (newWeight + oldWeight); 
    461471 
    462472        OUT.illum_col.y = combinedWeight; 
Note: See TracChangeset for help on using the changeset viewer.