Changeset 2960


Ignore:
Timestamp:
09/20/08 23:35:20 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj

    r2957 r2960  
    291291                                > 
    292292                        </File> 
    293                         <File 
    294                                 RelativePath=".\src\SunColor.cpp" 
    295                                 > 
    296                         </File> 
    297                         <File 
    298                                 RelativePath=".\src\SunColor.h" 
    299                                 > 
    300                         </File> 
    301293                        <Filter 
    302294                                Name="timer" 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.cpp

    r2959 r2960  
    88namespace CHCDemoEngine 
    99{ 
    10  
    11 CGparameter Material::sDiffuseParam; 
    12 CGparameter Material::sDiffuseTexParam; 
    13 CGparameter Material::sAmbientParam; 
    14 CGparameter Material::sAmbientTexParam; 
    15  
    1610 
    1711RgbaColor RandomColor(float a, float b) 
     
    6761 
    6862        if (mTexture) 
    69         { 
    7063                mTexture->Bind(); 
    71         } 
    7264        else 
    73         { 
    7465                glBindTexture(GL_TEXTURE_2D, 0); 
    75         } 
    7666 
    77         if (state->GetRenderPassType() == RenderState::DEFERRED) 
    78         { 
    79                 if (mTexture) 
    80                 { 
    81                         cgGLSetParameter4f(sAmbientTexParam, mEmmisiveColor.r, mEmmisiveColor.g, mEmmisiveColor.b, mEmmisiveColor.a); 
    82                         cgGLSetParameter4f(sDiffuseTexParam, mDiffuseColor.r, mDiffuseColor.g, mDiffuseColor.b, mDiffuseColor.a); 
    83                 } 
    84                 else 
    85                 { 
    86                         cgGLSetParameter4f(sAmbientParam, mEmmisiveColor.r, mEmmisiveColor.g, mEmmisiveColor.b, mEmmisiveColor.a); 
    87                         cgGLSetParameter4f(sDiffuseParam, mDiffuseColor.r, mDiffuseColor.g, mDiffuseColor.b, mDiffuseColor.a); 
    88                 } 
    89         } 
    90         else if (state->GetRenderPassType() == RenderState::FIXED) 
    91         { 
    92                 glMaterialfv(GL_FRONT, GL_AMBIENT, (float *)&mAmbientColor.r); 
    93                 glMaterialfv(GL_FRONT, GL_DIFFUSE, (float *)&mDiffuseColor.r); 
    94                 glMaterialfv(GL_FRONT, GL_EMISSION, (float *)&mEmmisiveColor.r); 
    95                 glMaterialfv(GL_FRONT, GL_SPECULAR, (float *)&mSpecularColor.r); 
    96         } 
     67        glMaterialfv(GL_FRONT, GL_AMBIENT, (float *)&mAmbientColor.r); 
     68        glMaterialfv(GL_FRONT, GL_DIFFUSE, (float *)&mDiffuseColor.r); 
     69        glMaterialfv(GL_FRONT, GL_EMISSION, (float *)&mEmmisiveColor.r); 
     70        glMaterialfv(GL_FRONT, GL_SPECULAR, (float *)&mSpecularColor.r); 
    9771} 
    9872 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.h

    r2957 r2960  
    33 
    44#include "glInterface.h" 
    5 #include <Cg/cg.h> 
    6 #include <Cg/cgGL.h> 
    75#include "common.h" 
    86 
     
    8078        void InitMaterial(); 
    8179 
    82         static CGparameter sDiffuseParam; 
    83         static CGparameter sDiffuseTexParam; 
    84  
    85         static CGparameter sAmbientParam; 
    86         static CGparameter sAmbientTexParam; 
    87  
    8880protected: 
    8981 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp

    r2959 r2960  
    103103 
    104104 
    105 void SkyPreetham::Compute(const Vector3 &sunDir, Camera *camera, RenderState *state) 
    106 { 
    107         float sun_theta[2]; 
    108  
    109         sun_theta[0] = acos(sunDir.z); 
    110  
    111         const float cos_theta = cos(sun_theta[0]); 
    112         sun_theta[1] = cos_theta * cos_theta; 
    113  
     105void SkyPreetham::RenderSkyDome(const Vector3 &sunDir, Camera *camera, RenderState *state) 
     106{ 
     107        pair<float, float> sun_theta; 
    114108        Vector3 zenithColor; 
    115  
    116         zenithColor.x = ( 0.00165f * CBQ(sun_theta[0]) - 0.00374f * SQR(sun_theta[0]) + 0.00208f * sun_theta[0] + 0.0f)     * SQR(mTurbidity) +  
    117                                     (-0.02902f * CBQ(sun_theta[0]) + 0.06377f * SQR(sun_theta[0]) - 0.03202f * sun_theta[0] + 0.00394f) * mTurbidity + 
    118                                         ( 0.11693f * CBQ(sun_theta[0]) - 0.21196f * SQR(sun_theta[0]) + 0.06052f * sun_theta[0] + 0.25885f); 
    119  
    120         zenithColor.y = (0.00275f  * CBQ(sun_theta[0]) - 0.00610f * SQR(sun_theta[0]) + 0.00316f * sun_theta[0] + 0.0f)     * SQR(mTurbidity) + 
    121                         (-0.04214f * CBQ(sun_theta[0]) + 0.08970f * SQR(sun_theta[0]) - 0.04153f * sun_theta[0] + 0.00515f) * mTurbidity + 
    122                             ( 0.15346f * CBQ(sun_theta[0]) - 0.26756f * SQR(sun_theta[0]) + 0.06669f * sun_theta[0] + 0.26688f); 
    123          
    124         zenithColor.z  = (float)((4.0453f * mTurbidity - 4.9710f) *     tan((4.0f / 9.0f - mTurbidity / 120.0f) *  
    125                                                          (M_PI - 2.0f * sun_theta[0])) - 0.2155f * mTurbidity + 2.4192f); 
    126  
    127         // convert kcd/m² to cd/m² 
    128         zenithColor.z *= 1000.0f; 
    129  
    130         double ABCDE_x[5], ABCDE_y[5], ABCDE_Y[5]; 
    131  
    132         ABCDE_x[0] = -0.01925 * mTurbidity - 0.25922; 
    133         ABCDE_x[1] = -0.06651 * mTurbidity + 0.00081; 
    134         ABCDE_x[2] = -0.00041 * mTurbidity + 0.21247; 
    135         ABCDE_x[3] = -0.06409 * mTurbidity - 0.89887; 
    136         ABCDE_x[4] = -0.00325 * mTurbidity + 0.04517; 
    137  
    138         ABCDE_y[0] = -0.01669 * mTurbidity - 0.26078; 
    139         ABCDE_y[1] = -0.09495 * mTurbidity + 0.00921; 
    140         ABCDE_y[2] = -0.00792 * mTurbidity + 0.21023; 
    141         ABCDE_y[3] = -0.04405 * mTurbidity - 1.65369; 
    142         ABCDE_y[4] = -0.01092 * mTurbidity + 0.05291; 
    143  
    144         ABCDE_Y[0] =  0.17872 * mTurbidity - 1.46303; 
    145         ABCDE_Y[1] = -0.35540 * mTurbidity + 0.42749; 
    146         ABCDE_Y[2] = -0.02266 * mTurbidity + 5.32505; 
    147         ABCDE_Y[3] =  0.12064 * mTurbidity - 2.57705; 
    148         ABCDE_Y[4] = -0.06696 * mTurbidity + 0.37027; 
    149  
     109        vector<Vector3> ABCDE; 
     110        ComputeFactors(sunDir, zenithColor, ABCDE, sun_theta); 
    150111 
    151112        // Move skybox with camera. 
     
    161122         
    162123        cgGLSetParameter3f(sLightDirParam, sunDir.x, sunDir.y, sunDir.z); 
    163         cgGLSetParameter2f(sThetaSunParam, sun_theta[0], sun_theta[1]); 
     124        cgGLSetParameter2f(sThetaSunParam, sun_theta.first, sun_theta.second); 
    164125        cgGLSetParameter3f(sZenithColorParam, zenithColor.x, zenithColor.y, zenithColor.z); 
    165126 
    166         cgGLSetParameter3f(sAColorParam, ABCDE_x[0], ABCDE_y[0], ABCDE_Y[0]); 
    167         cgGLSetParameter3f(sBColorParam, ABCDE_x[1], ABCDE_y[1], ABCDE_Y[1]); 
    168         cgGLSetParameter3f(sCColorParam, ABCDE_x[2], ABCDE_y[2], ABCDE_Y[2]); 
    169         cgGLSetParameter3f(sDColorParam, ABCDE_x[3], ABCDE_y[3], ABCDE_Y[3]); 
    170         cgGLSetParameter3f(sEColorParam, ABCDE_x[4], ABCDE_y[4], ABCDE_Y[4]); 
     127        cgGLSetParameter3f(sAColorParam, ABCDE[0].x, ABCDE[0].y, ABCDE[0].z); 
     128        cgGLSetParameter3f(sBColorParam, ABCDE[1].x, ABCDE[1].y, ABCDE[1].z); 
     129        cgGLSetParameter3f(sCColorParam, ABCDE[2].x, ABCDE[2].y, ABCDE[2].z); 
     130        cgGLSetParameter3f(sDColorParam, ABCDE[3].x, ABCDE[3].y, ABCDE[3].z); 
     131        cgGLSetParameter3f(sEColorParam, ABCDE[4].x, ABCDE[4].y, ABCDE[4].z); 
    171132 
    172133        cgGLEnableProfile(RenderState::sCgVertexProfile); 
     
    265226        */ 
    266227} 
     228 
     229 
     230void SkyPreetham::ComputeFactors(const Vector3 &sunDir,  
     231                                                                 Vector3 &zenithColor,  
     232                                                                 vector<Vector3> &ABCDE,   
     233                                                                 std::pair<float, float> &sunThetha) const 
     234{ 
     235        sunThetha.first = acos(sunDir.z); 
     236 
     237        const float cos_theta = cos(sunThetha.first); 
     238        sunThetha.second = cos_theta * cos_theta; 
     239 
     240        zenithColor.x = ( 0.00165f * CBQ(sunThetha.first) - 0.00374f * SQR(sunThetha.first) + 0.00208f * sunThetha.first + 0.0f)     * SQR(mTurbidity) +         
     241                                    (-0.02902f * CBQ(sunThetha.first) + 0.06377f * SQR(sunThetha.first) - 0.03202f * sunThetha.first + 0.00394f) * mTurbidity + 
     242                                        ( 0.11693f * CBQ(sunThetha.first) - 0.21196f * SQR(sunThetha.first) + 0.06052f * sunThetha.first + 0.25885f); 
     243 
     244        zenithColor.y = ( 0.00275f * CBQ(sunThetha.first) - 0.00610f * SQR(sunThetha.first) + 0.00316f * sunThetha.first + 0.0f)     * SQR(mTurbidity) + 
     245                        (-0.04214f * CBQ(sunThetha.first) + 0.08970f * SQR(sunThetha.first) - 0.04153f * sunThetha.first + 0.00515f) * mTurbidity + 
     246                            ( 0.15346f * CBQ(sunThetha.first) - 0.26756f * SQR(sunThetha.first) + 0.06669f * sunThetha.first + 0.26688f); 
     247         
     248        zenithColor.z  = (float)((4.0453f * mTurbidity - 4.9710f) *     tan((4.0f / 9.0f - mTurbidity / 120.0f) *  
     249                                                         (M_PI - 2.0f * sunThetha.first)) - 0.2155f * mTurbidity + 2.4192f); 
     250 
     251        // convert kcd/m² to cd/m² 
     252        zenithColor.z *= 1000.0f; 
     253 
     254        ABCDE.push_back(Vector3(-0.01925 * mTurbidity - 0.25922, -0.01669 * mTurbidity - 0.26078,  0.17872 * mTurbidity - 1.46303)); 
     255        ABCDE.push_back(Vector3(-0.06651 * mTurbidity + 0.00081, -0.09495 * mTurbidity + 0.00921, -0.35540 * mTurbidity + 0.42749)); 
     256        ABCDE.push_back(Vector3(-0.00041 * mTurbidity + 0.21247, -0.00792 * mTurbidity + 0.21023, -0.02266 * mTurbidity + 5.32505)); 
     257        ABCDE.push_back(Vector3(-0.06409 * mTurbidity - 0.89887, -0.04405 * mTurbidity - 1.65369,  0.12064 * mTurbidity - 2.57705)); 
     258        ABCDE.push_back(Vector3(-0.00325 * mTurbidity + 0.04517, -0.01092 * mTurbidity + 0.05291, -0.06696 * mTurbidity + 0.37027)); 
     259} 
     260 
     261 
     262void SkyPreetham::ComputeSunColor(const Vector3 &sunDir, Vector3 &ambient, Vector3 &diffuse) const 
     263{ 
     264        // sunDir is sun direction 
     265        // ambient color: shadow color 
     266        // diffuse color: sun color 
     267        pair<float, float> sun_theta; 
     268        Vector3 zenithColor; 
     269        vector<Vector3> ABCDE; 
     270 
     271        ComputeFactors(sunDir, zenithColor, ABCDE, sun_theta); 
     272 
     273        ambient = zenithColor; 
     274 
     275        Vector3 zenith_XYZ;                                                                                              
     276 
     277        zenith_XYZ.x = (ambient.x / ambient.y) * ambient.z;                                                                         
     278        zenith_XYZ.y = ambient.z;                                                                                           
     279        zenith_XYZ.z = ((1.0f - ambient.x - ambient.y) / ambient.y) * ambient.z;                                                                 
     280 
     281        ambient.x =  3.240479f * zenith_XYZ.x - 1.537150f * zenith_XYZ.y - 0.498535f * zenith_XYZ.z; 
     282        ambient.y = -0.969256f * zenith_XYZ.x + 1.875992f * zenith_XYZ.y + 0.041556f * zenith_XYZ.z;     
     283        ambient.z =  0.055648f * zenith_XYZ.x - 0.204043f * zenith_XYZ.y + 1.057311f * zenith_XYZ.z; 
     284 
     285        // downscale ambient color 
     286        ambient *= 5e-5f; 
     287 
     288        // simulate the sun intensity by modulating the ambient term. 
     289        ambient *= (1.0f - 0.9f * DotProd(sunDir, Vector3::UNIT_Z())); 
     290        ambient += Vector3(0.2f); 
     291 
     292        Vector3 num; 
     293           
     294        num.x = (1.0f + ABCDE[0].x * exp(ABCDE[1].x / sunDir.z)) * (1.0f + ABCDE[2].x)+ ABCDE[4].x;     
     295        num.y = (1.0f + ABCDE[0].y * exp(ABCDE[1].y / sunDir.z)) * (1.0f + ABCDE[2].y)+ ABCDE[4].y;    
     296        num.z = (1.0f + ABCDE[0].z * exp(ABCDE[1].z / sunDir.z)) * (1.0f + ABCDE[2].z)+ ABCDE[4].z;    
     297 
     298        Vector3 den; 
     299 
     300        den.x = (1.0f + ABCDE[0].x * exp(ABCDE[1].x)) * (1.0f + ABCDE[2].x * exp(ABCDE[3].x * sun_theta.first) + ABCDE[4].x * sun_theta.second);   
     301        den.y = (1.0f + ABCDE[0].y * exp(ABCDE[1].y)) * (1.0f + ABCDE[2].y * exp(ABCDE[3].y * sun_theta.first) + ABCDE[4].y * sun_theta.second);    
     302        den.z = (1.0f + ABCDE[0].z * exp(ABCDE[1].z)) * (1.0f + ABCDE[2].z * exp(ABCDE[3].z * sun_theta.first) + ABCDE[4].z * sun_theta.second);    
     303 
     304 
     305        Vector3 xyY = (num / den) * zenithColor;     
     306 
     307        Vector3 XYZ;                                                                                              
     308 
     309        XYZ.x = (xyY.x / xyY.y) * xyY.z;                                                                         
     310        XYZ.y = xyY.z;                                                                                           
     311        XYZ.z = ((1.0f - xyY.x - xyY.y) / xyY.y) * xyY.z;                                                                 
     312 
     313 
     314        Vector3 color;   
     315        color.x =  3.240479f * XYZ.x - 1.537150f * XYZ.y - 0.498535f * XYZ.z; 
     316        color.y = -0.969256f * XYZ.x + 1.875992f * XYZ.y + 0.041556f *XYZ.z;     
     317        color.z =  0.055648f * XYZ.x - 0.204043f * XYZ.y + 1.057311f * XYZ.z; 
     318 
     319        // Calculate final sun diffuse color. 
     320        diffuse = color * 0.00017f; 
     321} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.h

    r2958 r2960  
    33 
    44#include "glInterface.h" 
    5  
     5#include "common.h" 
    66#include <Cg/cg.h> 
    77#include <Cg/cgGL.h> 
     
    2222        virtual ~SkyPreetham(); 
    2323 
    24         void Compute(const CHCDemoEngine::Vector3 &sunDir, CHCDemoEngine::Camera *camera, CHCDemoEngine::RenderState *state); 
     24        void RenderSkyDome(const CHCDemoEngine::Vector3 &sunDir, CHCDemoEngine::Camera *camera, CHCDemoEngine::RenderState *state); 
    2525 
    2626        static void Init(CGcontext context); 
     27 
     28        void ComputeFactors(const CHCDemoEngine::Vector3 &sunDir,  
     29                                CHCDemoEngine::Vector3 &zenithColor,  
     30                                                std::vector<CHCDemoEngine::Vector3> &ABCDE,  
     31                                                std::pair<float, float> &sunThetha) const; 
     32 
     33        void ComputeSunColor(const CHCDemoEngine::Vector3 &sunDir, CHCDemoEngine::Vector3 &ambient, CHCDemoEngine::Vector3 &diffuse) const; 
     34 
    2735 
    2836protected: 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp

    r2957 r2960  
    2525        if (mIsIdentity) return; 
    2626         
     27        // note: would not need to pass the model matrix,  
     28        // as all required information is avaiabl in the glstate 
     29        // however, we require it compute the word positions, 
     30        // as computing the world position by use the inverse of the viewprojection 
     31        // matrix turned out to be too inaccurate for temporal reprojection 
     32 
    2733        if (state->GetRenderPassType() == RenderState::DEFERRED) 
    2834        { 
     
    3945        if (mIsIdentity) return; 
    4046 
     47        // reset model matrix 
    4148        if (state->GetRenderPassType() == RenderState::DEFERRED) 
    4249        { 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2959 r2960  
    3737#include "Light.h" 
    3838#include "SceneEntityConverter.h" 
    39 #include "SunColor.h" 
    4039#include "ObjConverter.h" 
    4140#include "SkyPreetham.h" 
     
    415414        InitGLstate(); 
    416415 
     416 
     417        Vector3 cubeCenter(470.398f, 240.364f, 182.5f); 
     418        AxisAlignedBox3 box(cubeCenter - Vector3(2.0f), cubeCenter + Vector3(2.0f)); 
     419 
     420        Material *mat = new Material(RgbaColor(1, 0.4, 0.4, 0)); 
     421        Transform3 *tf = new Transform3(); 
     422        cube = SceneEntityConverter().ConvertBox(box, mat, tf); 
     423 
     424        //aeroplane = ObjConverter().Load(model_path + "toyplane.obj"); 
     425        //if (!aeroplane)       cerr << "loadig plane failed" << endl; 
     426 
     427        skyDome = ObjConverter().Load(model_path + "sky.obj"); 
     428        if (!skyDome) cerr << "loadig plane failed" << endl; 
     429 
     430        const float turbitiy = 3.0f; 
     431        preetham = new SkyPreetham(turbitiy, skyDome); 
     432 
    417433        glEnable(GL_MULTISAMPLE_ARB); 
    418434        glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST); 
     
    538554 
    539555                sMaxDepthParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "maxDepth"); 
    540                 Material::sDiffuseTexParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "diffuse"); 
    541                 Material::sAmbientTexParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "ambient"); 
    542556 
    543557                cgGLSetParameter1f(sMaxDepthParamTex, MAX_DEPTH_CONST / farDist); 
     
    559573 
    560574                sMaxDepthParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "maxDepth"); 
    561                 Material::sDiffuseParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "diffuse"); 
    562                 Material::sAmbientParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "ambient"); 
    563  
    564575                cgGLSetParameter1f(sMaxDepthParam, MAX_DEPTH_CONST / farDist); 
    565576        } 
     
    625636        glEnable(GL_DEPTH_TEST); 
    626637 
    627         SetupLighting(); 
    628  
    629638        glColor3f(1.0f, 1.0f, 1.0f); 
    630639        glShadeModel(GL_SMOOTH); 
     
    656665        else 
    657666                cout << "successfully created font" << endl; 
    658  
    659         Vector3 cubeCenter(470.398f, 240.364f, 182.5f); 
    660         AxisAlignedBox3 box(cubeCenter - Vector3(2.0f), cubeCenter + Vector3(2.0f)); 
    661  
    662         Material *mat = new Material(RgbaColor(1, 0.4, 0.4, 0)); 
    663         Transform3 *tf = new Transform3(); 
    664         cube = SceneEntityConverter().ConvertBox(box, mat, tf); 
    665  
    666         //aeroplane = ObjConverter().Load(model_path + "toyplane.obj"); 
    667         //if (!aeroplane)       cerr << "loadig plane failed" << endl; 
    668  
    669         skyDome = ObjConverter().Load(model_path + "sky.obj"); 
    670         if (!skyDome) cerr << "loadig plane failed" << endl; 
    671  
    672         const float turbitiy = 3.0f; 
    673         preetham = new SkyPreetham(turbitiy, skyDome); 
    674667 
    675668 
     
    820813 
    821814 
    822         SunColor().Compute(lightDir, sunAmbient, sunDiffuse); 
     815        preetham->ComputeSunColor(lightDir, sunAmbient, sunDiffuse); 
    823816 
    824817        const float maxComponent = sunDiffuse.MaxComponent(); 
     
    19761969        //glEnable(GL_LIGHTING); 
    19771970 
    1978         preetham->Compute(-light->GetDirection(), camera, &state); 
     1971        preetham->RenderSkyDome(-light->GetDirection(), camera, &state); 
    19791972         
    19801973        cgGLDisableProfile(RenderState::sCgVertexProfile); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r2958 r2960  
    6767pixel fragtex(fragin IN,  
    6868                          uniform sampler2D tex,  
    69                           uniform float maxDepth,  
    70                           uniform float4 ambient,  
    71                           uniform float4 diffuse) 
     69                          uniform float maxDepth) 
    7270{ 
    7371        pixel pix; 
    7472 
    7573        // save color in first render target 
    76         pix.col = (ambient + diffuse) * tex2D(tex, IN.texCoord.xy); 
     74        // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 
     75        pix.col = (glstate.material.emission + glstate.material.diffuse) * tex2D(tex, IN.texCoord.xy); 
    7776         
    7877        // save world position in second render target 
     
    8281 
    8382        // hack: squeeze some information about ambient into the texture 
    84         pix.norm.w = ambient.x; 
     83        pix.norm.w = glstate.material.emission.x; 
    8584        // store projection coordinates with positions (used for ssao) 
    8685        pix.pos.w = IN.projPos.w; 
     
    9897 
    9998pixel frag(fragin IN,  
    100                    uniform float maxDepth,  
    101                    uniform float4 ambient,  
    102                    uniform float4 diffuse 
    103                    ) 
     99                   uniform float maxDepth) 
    104100{ 
    105101        pixel pix; 
    106102 
    107         pix.col = diffuse; 
     103        // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 
     104        pix.col = glstate.material.diffuse + glstate.material.emission; 
    108105        pix.pos = IN.worldPos * maxDepth; 
    109106 
     
    111108         
    112109        // hack: squeeze some information about the ambient term into the target 
    113         pix.norm.w = ambient.x; 
     110        pix.norm.w = glstate.material.emission.x; 
    114111        pix.pos.w = IN.mypos.w; 
    115112         
Note: See TracChangeset for help on using the changeset viewer.