Changeset 3193


Ignore:
Timestamp:
11/28/08 03:26:36 (15 years ago)
Author:
mattausch
Message:

prepared meeting

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

Legend:

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

    r3161 r3193  
    174174 
    175175                ambient.x = ambient.y = ambient.z = 0.2f; 
    176                 diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 
     176                //diffuse.x = 0.7f; diffuse.y = 0.4f; diffuse.z = 0.2f; 
     177                diffuse.x = 0.8f; diffuse.y = 0.8f; diffuse.z = 0.4f; 
    177178                //diffuse.x = diffuse.y = diffuse.z = 1.0f; 
    178179                spec.x = spec.y = spec.z = .0f; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3192 r3193  
    3838 
    3939# bad view point (culling bug!) 
    40 camPosition=469.381 267.293 184.778 
    41 camDirection=0.142006 0.645885 -0.750111 
     40#camPosition=469.381 267.293 184.778 
     41#camDirection=0.142006 0.645885 -0.750111 
     42 
     43#camPosition=458.412 255.767 182.632 
     44#camDirection=0.891691 0.42723 0.149535 
     45 
     46#camPosition=740.137 487.855 188.506 
     47#camDirection=0.669256 0.727829 0.149535 
     48 
     49camPosition=492.678 249.827 187.232 
     50camDirection=-0.651041 -0.693292 -0.309017 
    4251 
    4352#lightDirection=-0.8f 1.0f -0.7f 
     
    6473# ssao temporal coherence factor 
    6574tempCohFactor=1000.0f 
     75 
    6676# tone mapping 
    6777useHDR=0 
     78 
    6879# use antialiasing 
    6980useAA=1 
     81 
    7082# use ssao / color bleeding 
    7183useAdvancedShading=1 
     84 
     85# skylight turbitity 
     86turbitity=3.0f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3192 r3193  
    517517        // multisampling is difficult / costly with deferred shading 
    518518        // at least do some edge blurring  
    519         if (useAntiAliasing) AntiAliasing(fbo, light); 
     519        //if (useAntiAliasing) AntiAliasing(fbo, light); 
    520520 
    521521        switch (mShadingMethod) 
     
    544544        // multisampling is difficult / costly with deferred shading 
    545545        // at least do some edge blurring  
    546         //if (useAntiAliasing) AntiAliasing(fbo, light); else  
     546        if (useAntiAliasing) AntiAliasing(fbo, light);// else  
    547547        Output(fbo); // just output the latest buffer 
    548548 
     
    10201020        normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 
    10211021        diffVals = fbo->GetColorBuffer(2)->GetTexture(); 
    1022         //diffVals = mDownSampleFbo->GetColorBuffer(2)->GetTexture(); 
    10231022 
    10241023        // flip flop between illumination buffers 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp

    r3117 r3193  
    217217         
    218218        glBindTexture(GL_TEXTURE_2D, mTexId); 
    219          
    220         /*GLint width, height; 
    221         glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); 
    222         glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); 
    223         cout << "w: " << width << "h: " << height << endl; 
    224         */ 
    225219 
    226220        unsigned char *data = new unsigned char[bytes * 4 * mWidth * mHeight]; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp

    r3189 r3193  
    111111        //const float scaleFactor = 5.0f; 
    112112 
    113         position.z -= 3 * scaleFactor; 
     113        position.z -= 3.0f * scaleFactor; 
    114114        Matrix4x4 m = TranslationMatrix(position); 
    115115 
     
    143143        else 
    144144        { 
    145                 // no tone mapping => scale to range  
     145                // no tone mapping => linearily scale to displayable dynamic range  
    146146                vtxParams->SetValue1f(8, 8e-5f); 
    147147        } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3189 r3193  
    145145double accumulatedTime = 1000.0; 
    146146float fps = 1e3f; 
     147float turbitity = 5.0f; 
    147148 
    148149int shadowSize = 2048; 
     
    369370                env.GetFloatParam(string("keyRotation"), keyRotation); 
    370371                env.GetFloatParam(string("tempCohFactor"), ssaoTempCohFactor); 
    371  
    372                  
     372                env.GetFloatParam(string("turbitity"), turbitity); 
    373373                 
    374374                env.GetVectorParam(string("camPosition"), camPos); 
     
    403403                cout << "use antialiasing: " << useAntiAliasing << endl; 
    404404                cout << "use advanced shading: " << useAdvancedShading << endl; 
     405                cout << "turbitity: " << turbitity << endl; 
    405406 
    406407                //cout << "model path: " << model_path << endl; 
     
    478479        //-- load some dynamic stuff 
    479480 
    480         //resourceManager->mUseNormalMapping = true; 
    481         resourceManager->mUseNormalMapping = false; 
    482  
    483         //LoadModel("fisch.dem", dynamicObjects); 
    484         LoadModel("hbuddha.dem", dynamicObjects); 
     481        resourceManager->mUseNormalMapping = true; 
     482        //resourceManager->mUseNormalMapping = false; 
     483 
     484        LoadModel("fisch.dem", dynamicObjects); 
     485        //LoadModel("hbuddha.dem", dynamicObjects); 
    485486        //LoadModel("venusm.dem", dynamicObjects); 
    486487        //LoadModel("camel.dem", dynamicObjects); 
     
    492493        buddha = dynamicObjects.back(); 
    493494         
    494         const Vector3 sceneCenter(470.398f, 240.364f, 182.5f); 
     495        //const Vector3 sceneCenter(470.398f, 240.364f, 182.5f); 
     496        const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
    495497         
    496498        Matrix4x4 transl = TranslationMatrix(sceneCenter); 
     
    547549 
    548550        /// the turbitity of the sky (from clear to hazy, use <3 for clear sky) 
    549         const float turbitiy = 5.0f; 
    550         preetham = new SkyPreetham(turbitiy, skyDome); 
     551        preetham = new SkyPreetham(turbitity, skyDome); 
    551552 
    552553        CreateAnimation(); 
     
    809810        Vector3 sunDiffuse; 
    810811 
     812#if 1 
    811813        preetham->ComputeSunColor(lightDir, sunAmbient, sunDiffuse, !useHDRValues); 
    812814 
     
    819821        diffuse[2] = sunDiffuse.z; 
    820822 
    821         //cout << sunDiffuse << " " << sunAmbient << endl; 
     823#else 
     824         
     825        ambient[0] = .2f; 
     826        ambient[1] = .2f; 
     827        ambient[2] = .2f; 
     828 
     829        diffuse[0] = 1.0f; 
     830        diffuse[1] = 1.0f; 
     831        diffuse[2] = 1.0f; 
     832 
     833#endif 
    822834 
    823835        glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3192 r3193  
    66//-- ssao + gi parameters 
    77 
    8 //#define NUM_SAMPLES 8 
     8#define NUM_SAMPLES 8 
    99//#define NUM_SAMPLES 16 
    10 #define NUM_SAMPLES 48 
     10//#define NUM_SAMPLES 24 
    1111 
    1212// for quadratic falloff 
    13 #define SAMPLE_INTENSITY 0.2f 
     13#define SAMPLE_INTENSITY 0.5f 
    1414//#define SAMPLE_INTENSITY 0.1f 
    1515 
     
    1717//#define SAMPLE_INTENSITY 0.2f 
    1818 
    19 #define SAMPLE_RADIUS 8e-1f 
    20 //#define SAMPLE_RADIUS 4e-1f 
     19//#define SAMPLE_RADIUS 8e-1f 
     20#define SAMPLE_RADIUS 4e-1f 
    2121 
    2222//#define DISTANCE_SCALE 1e-1f 
     
    3030//#define NUM_SSAO_FILTERSAMPLES 80 
    3131#define NUM_SSAO_FILTER_SAMPLES 16 
    32 #define NUM_SSAO_FILTER_WIDTH 15.0f 
     32#define NUM_SSAO_FILTER_WIDTH 12.0f 
    3333#define SSAO_CONVERGENCE_WEIGHT 200.0f 
    3434 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3192 r3193  
    104104        float total_w = .0f; 
    105105 
    106         const float3 centerPos = ReconstructSamplePos(ssaoTex, texCoord, bl, br, tl, tr); 
     106        //const float3 centerPos = ReconstructSamplePos(ssaoTex, texCoord, bl, br, tl, tr); 
     107        const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr); 
    107108        const float3 centerNormal = tex2Dlod(normalsTex, float4(texCoord, 0, 0)).xyz; 
    108109 
     
    127128 
    128129                // check spatial discontinuity 
    129                 samplePos = ReconstructSamplePos(ssaoTex, sampleTexCoord.xy, bl, br, tl, tr); 
     130                // using the depth from the color texture is not 100% correct as depth was 
     131                // not scaled with the interpolated view vector depth yet ... 
     132                samplePos = ReconstructSamplePos(colorsTex, sampleTexCoord.xy, bl, br, tl, tr); 
     133                //samplePos = ReconstructSamplePos(ssaoTex, sampleTexCoord.xy, bl, br, tl, tr); 
     134 
    130135                len = min(SqrLen(centerPos - samplePos), 1e3f); 
    131136 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3192 r3193  
    11#include "../shaderenv.h" 
    2  
     2#include "common.h" 
    33 
    44struct fragment 
     
    1717        float3 diffVal: COLOR2; 
    1818}; 
    19  
    20  
    21 float2 myreflect(float2 pt, float2 n) 
    22 { 
    23         // distance to plane 
    24         float d = dot(n, pt); 
    25         // reflect around plane 
    26         float2 rpt = pt - d * 2.0f * n; 
    27  
    28         return rpt; 
    29 } 
    3019 
    3120 
     
    123112 
    124113        return total_d; 
    125 } 
    126  
    127  
    128 inline float3 Interpol(float2 w, float3 bl, float3 br, float3 tl, float3 tr) 
    129 { 
    130         float3 x1 = lerp(bl, tl, w.y); 
    131         float3 x2 = lerp(br, tr, w.y);  
    132         float3 v  = lerp(x1, x2, w.x);  
    133  
    134         return v; 
    135114} 
    136115 
     
    157136 
    158137        const float3 normal = tex2D(normals, IN.texCoord.xy); 
    159  
    160138        float4 color = tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 
    161139 
     
    166144 
    167145        const float eyeDepth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w; 
    168  
    169146        const float4 worldPos = float4(eyePos - viewDir * eyeDepth, 1); 
    170147         
     
    197174        // store scaled view vector from now on so wie don't have to normalize later (e.g., for ssao) 
    198175        //OUT.color.w = color.w / lenView; 
     176        OUT.color.w = color.w; 
    199177 
    200178        return OUT; 
     
    217195        return color; 
    218196} 
    219  
    220  
    221  
    222 inline float SqrLen(float3 v) 
    223 { 
    224         return v.x * v.x + v.y * v.y + v.z * v.z; 
    225 } 
    226  
    227197 
    228198 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg

    r3110 r3193  
    8383                              0.055648f, -0.204043f,  1.057311f); 
    8484 
    85         //float3 hcol = mul(conv_Mat, XYZ); 
    86         //OUT.color = float4(hcol, 1.0f); 
    8785        OUT.color = float4(mul(conv_Mat, XYZ), 1.0f); 
    8886 
     
    102100 
    103101        pix.col = IN.hdrColor; 
     102        //pix.col.xyz = float3(0.3f, 0.6f, 1.0f); 
     103        // set depth to large value 
    104104        pix.col.w = 1e20f; 
    105105        pix.norm = IN.normal; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3192 r3193  
    153153        sample normal as weight. 
    154154*/ 
    155 float2 ssao2(fragment IN, 
     155float3 ssao2(fragment IN, 
    156156                         sampler2D colors, 
    157157                         sampler2D noiseTex, 
     
    230230                // check if the samples have been valid in the last frame 
    231231                //numSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 
    232                 numSamples += 1.0f - sampleColor.x; 
    233         } 
    234  
    235         return float2(max(0.0f, 1.0f - total_ao), numSamples); 
     232                ++ numSamples; 
     233        } 
     234 
     235        total_ao /= numSamples; 
     236 
     237        return float3(max(0.0f, 1.0f - total_ao), .0f, numSamples); 
    236238} 
    237239 
     
    316318 
    317319                ++ numSamples; 
    318                 if ((validSamples < 1.0f) && (newWeight > 20) && (numSamples >= 8)) break; 
     320                //if ((validSamples < 1.0f) && (newWeight > 20) && (numSamples >= 8)) break; 
    319321        } 
    320322 
     
    391393        if (eyeSpaceDepth < 1e10f) 
    392394        { 
    393                 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight); 
    394                 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 
     395                //ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight); 
     396                ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 
    395397        } 
    396398        else 
Note: See TracChangeset for help on using the changeset viewer.