Changeset 2989 for GTP/trunk


Ignore:
Timestamp:
10/02/08 12:22:32 (16 years ago)
Author:
mattausch
Message:

was able to make eye space depth working ...

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

Legend:

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

    r2985 r2989  
    947947        cgGLBindProgram(RenderState::sCgMrtFragmentProgram); 
    948948 
    949         Vector3 pos = camera->GetPosition(); 
     949        const Vector3 pos = camera->GetPosition(); 
    950950        cgGLSetParameter3f(sCurrentPosParam, pos.x, pos.y, pos.z); 
    951951        cgGLSetParameter3f(sCurrentPosParamTex, pos.x, pos.y, pos.z); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r2988 r2989  
    9595        // hack: squeeze some information about ambient into the texture 
    9696        //pix.col.w = glstate.material.emission.x; 
    97         pix.col.w = length((currentPos - IN.worldPos) * maxDepth); 
     97        pix.col.w = length(currentPos - IN.worldPos) * maxDepth; 
    9898 
    9999        return pix; 
     
    118118        // hack: squeeze some information about the ambient term into the target 
    119119        //pix.col.w = glstate.material.emission.x; 
    120         pix.col.w = length((currentPos - IN.worldPos) * maxDepth); 
     120        pix.col.w = length(currentPos - IN.worldPos) * maxDepth; 
    121121 
    122122        return pix; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r2988 r2989  
    9191                   uniform float3 viewDir, 
    9292                   uniform float3 eyePos, 
    93                    uniform sampler2D positions, 
    9493                   uniform float3 bl, 
    9594                   uniform float3 br, 
     
    127126                // sample downsampled texture in order to speed up texture accesses 
    128127                float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 
    129  
    130                 float2 newOffs = 0.5f + offsetTransformed * 0.5f; 
    131  
    132                 float3 rotView = normalize(Interpol(newOffs, bl, br, tl, tr)); 
     128                 
     129                // reconstruct world space position 
     130                float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr)); 
    133131                float3 sample_position = eyePos - rotView * eyeSpaceDepth; 
     132 
    134133                //float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 
    135134 
     
    191190        // the current world position 
    192191        const float4 centerPosition = tex2D(positions, IN.texCoord.xy); 
    193  
    194         const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 
    195         float3 view2 = normalize(Interpol(IN.texCoord.xy, bl, br, tl, tr)); 
    196          
     192        /// the current view direction 
     193        float3 viewDir = normalize(IN.view); 
     194 
     195        /*const float eyeDepth = tex2D(colors, IN.texCoord.xy).w; 
    197196        float4 centerPosition2; 
    198197        centerPosition2.xyz = eyePos - view2 * eyeDepth; 
     198*/ 
     199 
    199200        // the current depth 
    200201        const float currentDepth = centerPosition.w; 
    201202 
    202         /// the current view direction 
    203         float3 viewDir = normalize(IN.view); 
    204  
    205203        //const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 
    206         const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition2, w, viewDir, eyePos, positions, 
    207                 bl, br, tl, tr); 
     204        const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos, bl, br, tl, tr); 
    208205                 
    209206 
Note: See TracChangeset for help on using the changeset viewer.