Changeset 3151 for GTP


Ignore:
Timestamp:
11/20/08 18:40:28 (16 years ago)
Author:
mattausch
Message:

worked on ssao for interpolated normals

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

Legend:

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

    r3150 r3151  
    291291        //-- the flip-flop fbos 
    292292 
    293         const int dsw = w / 2; const int dsh = h / 2; 
    294         //const int dsw = w; const int dsh = h; 
     293        //const int dsw = w / 2; const int dsh = h / 2; 
     294        const int dsw = w; const int dsh = h; 
    295295 
    296296        mIllumFbo = new FrameBufferObject(dsw, dsh, FrameBufferObject::DEPTH_NONE); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3146 r3151  
    477477        //LoadModel("hbuddha.dem", dynamicObjects); 
    478478        //LoadModel("venusm.dem", dynamicObjects); 
    479         //LoadModel("objects.dem", dynamicObjects); 
     479        LoadModel("camel.dem", dynamicObjects); 
    480480        //LoadModel("toyplane2.dem", dynamicObjects); 
    481         LoadModel("elephal.dem", dynamicObjects); 
     481        //LoadModel("elephal.dem", dynamicObjects); 
    482482 
    483483        resourceManager->mUseNormalMapping = false; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3143 r3151  
    1111// for quadratic falloff 
    1212//#define SAMPLE_INTENSITY 0.2f 
    13 #define SAMPLE_INTENSITY 0.07f 
    14 //#define SAMPLE_INTENSITY 0.015f 
     13//#define SAMPLE_INTENSITY 0.07f 
     14 
     15#define SAMPLE_INTENSITY 0.075f 
    1516 
    1617#define SAMPLE_RADIUS 8e-1f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3150 r3151  
    245245 
    246246/** The ssao shader returning the an intensity value between 0 and 1 
     247        This version of the ssao shader uses the dotproduct between pixel and  
     248        sample normal as weight. 
    247249*/ 
    248250float2 ssao2(fragment IN, 
     
    287289                //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f)) ++ numSamples; 
    288290                const float3 samplePos = ReconstructSamplePos(colors, texcoord, bl, br, tl, tr); 
    289                 const float3 sampleNormal = normalize(tex2Dlod(normalTex, float4(IN.texCoord * 4.0f, 0, 0)).xyz); 
     291                const float3 sampleNormal = normalize(tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz); 
    290292 
    291293 
     
    299301 
    300302                // angle between current normal and direction to sample controls AO intensity. 
    301                 float cosAngle = max(dot(sampleNormal, normal), .0f); 
     303                //const float cosAngle = max(-dot(sampleNormal, normal), .0f); 
     304                //const float cosAngle = .5f - dot(sampleNormal, normal) * 0.5f; 
     305                float cosAngle = .5f + dot(sampleNormal, -normal) * 0.5f; 
     306 
     307                float dirAngle = dot(dirSample, normal); 
     308 
     309                cosAngle *= step(0.0f, dirAngle); 
     310 
     311                //cosAngle *= step(0.5f, cosAngle); 
     312                //const float cosAngle = .5f * dot(sampleNormal, normal) + 1.0f; 
    302313         
    303314                // the distance_scale offset is used to avoid singularity that occurs at global illumination when  
     
    321332 
    322333 
    323 /** The ssao shader returning the an intensity value between 0 and 1 
     334/** The ssao shader returning the an intensity value between 0 and 1. 
     335        This version of the ssao shader uses the dotproduct between  
     336        pixel-to-sample direction and sample normal as weight. 
    324337*/ 
    325338float2 ssao(fragment IN, 
     
    374387 
    375388                // angle between current normal and direction to sample controls AO intensity. 
    376                 float cosAngle = max(dot(dirSample, normal), .0f); 
     389                const float cosAngle = max(dot(dirSample, normal), .0f); 
    377390         
    378391                // the distance_scale offset is used to avoid singularity that occurs at global illumination when  
     
    465478        if (eyeSpaceDepth < 1e10f) 
    466479        { 
    467                 ao = ssao(IN, colors, noiseTex, samples, normal,  
    468                           eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir)); 
     480                //ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir)); 
     481                ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 
    469482        } 
    470483        else 
Note: See TracChangeset for help on using the changeset viewer.