Changeset 3001


Ignore:
Timestamp:
10/03/08 16:49:22 (16 years ago)
Author:
mattausch
Message:

reverted back from trying to use less components in fbo for faster sampling

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

Legend:

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

    r3000 r3001  
    272272        mFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 
    273273 
    274         mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
    275         mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
    276         mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
    277         mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
     274        mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
     275        mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
     276        mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
     277        mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
    278278} 
    279279 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h

    r2999 r3001  
    1515public: 
    1616 
    17         enum FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32, BUFFER_LUMINANCE_ALPHA }; 
     17        enum FORMAT { RGBA_UBYTE, RGBA_FLOAT_16, RGB_FLOAT_32, RGBA_FLOAT_32}; 
    1818        enum WRAP_TYPE { WRAP_REPEAT, WRAP_CLAMP_TO_EDGE }; 
    1919        enum FILTER_TYPE { FILTER_NEAREST, FILTER_LINEAR }; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp

    r2965 r3001  
    139139 
    140140        FrameBufferObject *fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32, true); 
    141         fbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE,  
     141        fbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE,  
    142142                                ColorBufferObject::WRAP_CLAMP_TO_EDGE,  
    143143                                                ColorBufferObject::FILTER_NEAREST, 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp

    r2965 r3001  
    143143 
    144144        // need a color buffer to keep opengl happy 
    145         mFbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE, 
     145        mFbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE, 
    146146                                 ColorBufferObject::WRAP_CLAMP_TO_EDGE,  
    147147                                                 ColorBufferObject::FILTER_NEAREST); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2999 r3001  
    666666 
    667667        // the diffuse color buffer 
    668         fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
     668        fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
    669669        // the positions buffer 
    670         //fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
    671         fbo->AddColorBuffer(ColorBufferObject::BUFFER_LUMINANCE_ALPHA, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
     670        fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
     671        //fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
    672672        // the normals buffer 
    673         fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
     673        fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
    674674        // another color buffer 
    675         fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
     675        fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST); 
    676676 
    677677        PrintGLerror("fbo"); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg

    r3000 r3001  
    108108                //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 
    109109                float3 rotView = Interpol(texcoord, bl, br, tl, tr); 
    110                 //float3 rotView = Interpol(texcoord, bl, br, tl, tr); 
     110                 
    111111                 
    112112                const float3 sample_position = eyePos - rotView * eyeSpaceDepth; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r3000 r3001  
    105105        const float4 projPos = IN.mypos / IN.mypos.w; 
    106106         
    107         const float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
    108         const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
    109  
    110107        // hack: squeeze some information about ambient into the texture 
    111108        //pix.col.w = glstate.material.emission.x; 
    112109 
    113         // eye linear depth 
     110        // compute eye linear depth 
     111        const float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
     112        const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
    114113        pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 
    115114 
    116115        // save world position in second render target 
    117116        pix.pos = IN.worldPos * maxDepth; 
    118         //pix.pos.x = pix.col.w; 
    119117        // store the projected depth 
    120118        pix.pos.w = projPos.z; 
     
    143141 
    144142        const float4 projPos = IN.mypos / IN.mypos.w; 
    145          
    146         float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
    147         const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
    148143 
    149144        // hack: squeeze some information about the ambient term into the target 
    150145        //pix.col.w = glstate.material.emission.x; 
     146         
     147        // compute eye linear depth 
     148        float2 screenCoord = projPos.xy * 0.5f + 0.5f; 
     149        const float magView = length(Interpol(screenCoord, bl, br, tl, tr)); 
    151150        pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView; 
    152151 
    153152        pix.pos = IN.worldPos * maxDepth; 
    154         //pix.pos.x = pix.col.w; 
    155153        // store the projected depth 
    156154        pix.pos.w = projPos.z; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3000 r3001  
    44// Screen Spaced Ambient Occlusion shader 
    55// based on shader of Alexander Kusternig 
     6 
     7 
     8#define USE_EYE_SPACE_DEPTH 0 
    69 
    710 
     
    4851                                                                                float3 bl, float3 br, float3 tl, float3 tr) 
    4952{ 
    50 #if 1 
     53#if USE_EYE_SPACE_DEPTH 
    5154        float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 
    5255        //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 
     
    104107                //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f))++ numSamples; 
    105108 
    106                 // get sample world space position 
    107                 float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 
    108                 //float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 
    109                 float3 rotView = Interpol(texcoord, bl, br, tl, tr); 
    110          
    111109                float3 samplePos = ReconstructSamplePosition(eyePos, colors, texcoord, bl, br, tl, tr); 
    112110 
     
    170168        float w = norm.w; 
    171169 
     170 
    172171        // the current world position 
    173172        const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 
    174173 
    175 #if 0 
     174#if USE_EYE_SPACE_DEPTH 
    176175        /// reconstruct position from the eye space depth 
    177 /*      float3 viewDir = normalize(IN.view); 
     176        float3 viewDir = IN.view; 
    178177        const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 
    179         float4 centerPosition; 
    180  
    181         centerPosition.xyz = eyePos - viewDir * eyeDepth; 
    182 */ 
    183         const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr); 
     178        float4 centerPosition2; 
     179 
     180        centerPosition2.xyz = eyePos - viewDir * eyeDepth; 
     181        centerPosition2.w = centerPosition.w; 
     182 
     183        const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition2, w, eyePos, bl, br, tl, tr); 
    184184#else 
    185185 
Note: See TracChangeset for help on using the changeset viewer.