Changeset 2984 for GTP/trunk


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

added eye space depth

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

Legend:

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

    r2978 r2984  
    582582 
    583583        float imageKey, whiteLum, middleGrey; 
    584  
     584/* 
    585585        glPixelStorei(GL_PACK_ALIGNMENT, 1); 
    586586        // generate mip map levels for average loglum and tone mapping  
     
    590590        ComputeToneParameters(fbo, light, imageKey, whiteLum, middleGrey); 
    591591        ToneMap(fbo, light, imageKey, whiteLum, middleGrey); 
    592  
     592*/ 
    593593        AntiAliasing(fbo, light); 
    594594 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2983 r2984  
    272272static CGparameter sMaxDepthParam; 
    273273static CGparameter sMaxDepthParamTex; 
     274static CGparameter sCurrentPosParamTex; 
     275static CGparameter sCurrentPosParam; 
    274276 
    275277static Matrix4x4 oldViewProjMatrix; 
     
    591593 
    592594                sMaxDepthParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "maxDepth"); 
     595                sCurrentPosParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "currentPos"); 
    593596                RenderState::sTexParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tex"); 
    594597         
     
    611614 
    612615                sMaxDepthParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "maxDepth"); 
     616                sCurrentPosParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "currentPos"); 
    613617                 
    614618                cgGLSetParameter1f(sMaxDepthParam, MAX_DEPTH_CONST / farDist); 
     
    943947        cgGLBindProgram(RenderState::sCgMrtFragmentProgram); 
    944948 
     949        Vector3 pos = camera->GetPosition(); 
     950        cgGLSetParameter3f(sCurrentPosParam, pos.x, pos.y, pos.z); 
     951        cgGLSetParameter3f(sCurrentPosParamTex, pos.x, pos.y, pos.z); 
     952 
    945953        // draw to 3 color buffers 
    946954        // a color, normal, and positions buffer 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r2982 r2984  
    4848        float4 outColor; 
    4949 
    50         //if (color.w > 1e19f) outColor = color; 
    51         if (emmisive > 1.5f) outColor = color; 
     50        if (position.w > 1e19f) outColor = color; 
     51        //if (emmisive > 1.5f) outColor = color; 
    5252        else outColor = (ambient + diffuse) * color; 
    5353 
     
    181181 
    182182        // calc diffuse illumination + shadow term 
    183         if ((emmisive < 1.5f) // hack: prevent shadowing the sky         
     183        //if ((emmisive < 1.5f) // hack: prevent shadowing the sky       
     184        if ( 
     185                (position.w > 1e19f) 
    184186                && (angle > 1e-3f) // shadow only if diffuse color has some minimum intensity 
    185187                ) 
     
    200202         
    201203        // base lighting 
    202         OUT.color = (emmisive > 1.5f) ? color: (ambient + diffuse) * color; 
     204        //OUT.color = (emmisive > 1.5f) ? color: (ambient + diffuse) * color; 
     205        OUT.color = (position.w > 1e19f) ? color: (ambient + diffuse) * color; 
    203206 
    204207 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r2982 r2984  
    6868                          uniform sampler2D dirtTex, 
    6969                          uniform float maxDepth, 
    70                           uniform sampler2D tex) 
     70                          uniform sampler2D tex, 
     71                          uniform float3 currentPos) 
    7172{ 
    7273        pixel pix; 
     
    9394 
    9495        // hack: squeeze some information about ambient into the texture 
    95         pix.col.w = glstate.material.emission.x; 
    96         //pix.col.w = length(currentPos - IN.worldPos) 
     96        //pix.col.w = glstate.material.emission.x; 
     97        pix.col.w = length(currentPos - IN.worldPos); 
    9798 
    9899        return pix; 
     
    100101 
    101102 
    102 pixel frag(fragin IN,  
    103                    uniform float maxDepth) 
     103pixel frag(fragin IN, uniform float maxDepth, uniform float3 currentPos) 
    104104{ 
    105105        pixel pix; 
     
    117117         
    118118        // hack: squeeze some information about the ambient term into the target 
    119         pix.col.w = glstate.material.emission.x; 
     119        //pix.col.w = glstate.material.emission.x; 
     120        pix.col.w = length(currentPos - IN.worldPos); 
    120121 
    121122        return pix; 
Note: See TracChangeset for help on using the changeset viewer.