Changeset 2993


Ignore:
Timestamp:
10/02/08 17:54:38 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
2 edited

Legend:

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

    r2992 r2993  
    666666        // generate mip map levels of position in order to improve texture lookup performance 
    667667        //glBindTexture(GL_TEXTURE_2D, positionsTex); glGenerateMipmapEXT(GL_TEXTURE_2D); 
    668          
     668        //glBindTexture(GL_TEXTURE_2D, colorsTex); glGenerateMipmapEXT(GL_TEXTURE_2D); 
     669 
    669670        // read the second buffer, write to the first buffer 
    670671        mFbo->Bind(); 
     
    12001201        middleGrey = lightIntensity * maxKey + (1.0f - lightIntensity) * minKey; 
    12011202 
     1203 
    12021204#if 1 
    12031205 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r2992 r2993  
    4848                                                                                float3 bl, float3 br, float3 tl, float3 tr) 
    4949{ 
     50#if 0 
    5051        float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 
    5152        float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 
    5253         
    5354        float3 sample_position = eyePos - rotView * eyeSpaceDepth; 
    54         //float3 sample_position = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 
    55  
     55#else 
     56        float3 sample_position = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 
     57#endif 
    5658        return sample_position; 
    5759} 
     
    6769                   uniform float4 centerPosition, 
    6870                   uniform float scaleFactor, 
    69                    //uniform float3 viewDir, 
    7071                   uniform float3 eyePos, 
    7172                   uniform float3 bl, 
     
    7374                   uniform float3 tl, 
    7475                   uniform float3 tr 
     76                   //, uniform float3 viewDir 
    7577                   ) 
    7678{ 
     
    159161        // the w coordinate from the persp. projection 
    160162        float w = norm.w; 
     163 
     164#if 1    
    161165        // the current world position 
    162166        const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 
    163          
    164         /* 
    165         /// the current view direction 
     167        const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 
     168 
     169#else 
     170        /// reconstruct position from the eye space depth 
    166171        float3 viewDir = normalize(IN.view); 
    167172        const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 
    168         float4 centerPosition2; 
    169         centerPosition2.xyz = eyePos - view2 * eyeDepth; 
    170 */ 
     173        float4 centerPosition; 
     174        centerPosition.xyz = eyePos - viewDir * eyeDepth; 
     175 
     176        const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 
     177 
     178#endif 
    171179 
    172180        // the current depth 
    173181        const float currentDepth = centerPosition.w; 
    174  
    175         //const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 
    176         const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 
    177                  
     182         
    178183 
    179184        ///////////////// 
     
    185190 
    186191        /////////// 
    187         //-- reprojection from new frame into old one 
     192        //-- reprojection from new frame into old one  
     193         
     194        // note: could be done using eye space depth values  
     195        // by storing the position from last frame and the old model view matrix 
    188196 
    189197        float4 oldPos = mul(oldModelViewProj, realPos); 
     
    202210        float newWeight; 
    203211 
    204         float newNumSamples = ao.y; 
     212        // the number of valid samples in this frame 
     213        const float newNumSamples = ao.y; 
    205214 
    206215        if (//(temporalCoherence > 0) && 
Note: See TracChangeset for help on using the changeset viewer.