Changeset 1638


Ignore:
Timestamp:
10/18/06 15:21:29 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl

    r1629 r1638  
    5555                                        ):COLOR 
    5656{        
    57         float bias = 0.0001; 
     57        float bias = 0.001; 
    5858        float4 light = float4(1,1,1,1); 
    59         float4 shadow = float4(0.6,0.6,0.6,1); 
     59        float4 shadow = float4(0.85,0.85,0.85,1); 
     60        //float4 shadow = float4(0,0,0,1); 
    6061         
    61         float4 pos = (IN.lPosition / IN.lPosition.w); 
    62         pos.xy = (pos.xy +1.0 ) / 2.0; 
    63         pos.y = 1.0 - pos.y; 
    64         float4 storedDepth = tex2D(depthShadowMap, pos.xy); 
     62        if(IN.lPosition.z > 0.0) 
     63        { 
     64                float4 pos = (IN.lPosition / IN.lPosition.w); 
     65                 
     66                if(length(pos.xy)>1)             
     67                        light = shadow; 
     68                else 
     69                { 
     70                        pos.xy = (pos.xy + 1.0) / 2.0; 
     71                        pos.y = 1.0 - pos.y; 
     72                        float4 storedDepth = tex2D(depthShadowMap, pos.xy); 
    6573         
    66         if(storedDepth.r + bias < pos.z) 
    67         { 
    68                 float M1 = storedDepth.r; 
    69                 float M2 = storedDepth.g; 
    70                 float v2 = M2 - M1 * M1; 
    71                 float pmax = v2 / (v2 + pow(M1 - pos.z, 2)); 
    72                 light = shadow + (1 - shadow) * pmax; 
     74                        if(storedDepth.r + bias < pos.z) 
     75                        { 
     76                                float M1 = storedDepth.r; 
     77                                float M2 = storedDepth.g; 
     78                                float v2 = M2 - M1 * M1; 
     79                                float pmax = v2 / (v2 + pow(M1 - pos.z, 2)); 
     80                                light = saturate(shadow + (1 - shadow) * pmax); 
     81                        } 
     82                } 
    7383                 
    74                 //light = shadow; 
    7584        } 
    76         //return abs( pos.z - storedDepth.z );   
     85        else 
     86                light = shadow;  
     87         
    7788        return light;    
    7889} 
     
    8798        float bias = 0.0001; 
    8899        float4 light = float4(1,1,1,1); 
    89         float4 shadow = float4(0.65,0.65,0.65,1); 
     100        float4 shadow = float4(0.95,0.95,0.95,1); 
    90101        //float4 shadow = float4(0,0,0,1); 
    91102         
     
    93104        { 
    94105                float4 pos = (IN.lPosition / IN.lPosition.w); 
    95                 pos.xy = (pos.xy + 1.0) / 2.0; 
     106                 
     107                if(length(pos.xy)>1)             
     108                        light = shadow; 
     109                else 
     110                { 
     111                        pos.xy = (pos.xy + 1.0) / 2.0; 
     112                        pos.y = 1.0 - pos.y; 
     113                        float4 storedDepth = tex2D(depthShadowMap, pos.xy); 
    96114         
    97          
    98                 pos.y = 1.0 - pos.y; 
    99                 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 
    100          
    101                 if(storedDepth.r + bias < pos.z) 
    102                 {                
    103                         light = shadow; 
     115                        if(storedDepth.r + bias < pos.z) 
     116                        { 
     117                                light = shadow; 
     118                        } 
    104119                } 
    105                 //if(length(pos.xy)>1) 
    106                 //              light = shadow; 
     120                 
    107121        } 
     122        else 
     123                light = shadow; 
    108124         
    109125         
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Diffuse.hlsl

    r1590 r1638  
    111111                float2 texCoord : TEXCOORD0,                     
    112112                uniform float4x4 worldViewProj, 
     113                uniform float4x4 worldI, 
    113114                uniform float4x4 world) 
    114115{ 
     
    116117  OUT.hPos = mul(worldViewProj, position); 
    117118  OUT.wPos = mul(world, position).xyz;   
    118   OUT.mNormal = mul(world, normal); 
     119  OUT.mNormal = mul(normal, worldI); 
    119120  //OUT.mNormal = normal; 
    120121  OUT.texCoord = texCoord; 
     
    136137    float3 pos = IN.wPos - lastCenter; 
    137138     
     139    //return  float4(N,1)+ lastCenter.x*0.000001;  
    138140   // return float4(N,1)+ lastCenter.x*0.000001;  
    139141  //  return  readCubeMap(SmallEnvMapSampler, pos) + lastCenter.x*0.000001; 
     
    146148        float d;  
    147149         
    148         for (float x = 0.5; x < M; x++)                  
    149          for (float y = 0.5; y < M; y++)                                                                                         
     150        for (float x = 1; x < M; x++)                    
     151         for (float y = 1; y < M; y++)                                                                           
    150152         {                                                                                                                               
    151153                float2 p, tpos;  
     
    167169        }                                                                                                                                                        
    168170         
    169         for (float x = 0.5; x < M; x++)                  
    170          for (float y = 0.5; y < M; y++)                                                                                         
     171        for (float x = 1; x < M; x++)                    
     172         for (float y = 1; y < M; y++)                                                                                   
    171173         {                                                                                                                               
    172174                float2 p, tpos;  
     
    187189         }       
    188190          
    189         for (float x = 0.5; x < M; x++)                  
    190          for (float y = 0.5; y < M; y++)                                                                                         
     191        for (float x = 1; x < M; x++)                    
     192         for (float y = 1; y < M; y++)                                                                                   
    191193         {                                                                                                                               
    192194                float2 p, tpos;  
     
    207209         }               
    208210          
    209         for (float x = 0.5; x < M; x++)                  
    210          for (float y = 0.5; y < M; y++)                                                                                         
     211        for (float x = 1; x < M; x++)                    
     212         for (float y = 1; y < M; y++)                                                                                   
    211213         {                                                                                                                               
    212214                float2 p, tpos;  
     
    227229         } 
    228230          
    229          for (float x = 0.5; x < M; x++)                         
    230                 for (float y = 0.5; y < M; y++)                                                                                  
     231         for (float x = 1; x < M; x++)                   
     232         for (float y = 1; y < M; y++)                                                                           
    231233                {                                                                                                                                
    232234                float2 p, tpos;  
     
    247249        } 
    248250          
    249         for (float x = 0.5; x < M; x++)                  
    250          for (float y = 0.5; y < M; y++)                                                                                         
     251        for (float x = 1; x < M; x++)                    
     252         for (float y = 1; y < M; y++)                                                                                   
    251253         {                                                                                                                               
    252254                float2 p, tpos;  
     
    266268                I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);                               
    267269         }       
    268          float kd = 0.3;                                                                                                                                                 
     270         float kd = 0.5;                                                                                                                                                 
    269271        return kd * I; 
    270272} 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/Diffuse.material

    r1590 r1638  
    125125                        { 
    126126                                update_interval         1 
    127                                 distance_calc false                                              
     127                                update_all_face         true 
     128                                distance_calc           false 
     129                                face_angle_calc         false 
     130                                resolution                      128                                              
    128131                        } 
    129132                        RenderTechnique ReducedColorCubeMap 
     
    141144                vertex_program_ref Diffuse2VS 
    142145                {        
    143                  param_named_auto worldViewProj worldviewproj_matrix  
    144                 param_named_auto world world_matrix   
     146                        param_named_auto worldViewProj worldviewproj_matrix  
     147                param_named_auto worldI inverse_world_matrix   
     148                param_named_auto world world_matrix 
    145149         
    146150                }  
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GlassHead.material

    r1519 r1638  
    131131                        RenderTechnique ColorCubeMap 
    132132                        { 
    133                                 update_interval         5 
     133                                update_interval         1 
     134                                update_all_face true 
    134135                                distance_calc true 3.5                                   
    135136                        } 
    136137                        RenderTechnique DistanceCubeMap 
    137138                        { 
    138                                 update_interval         5 
     139                                update_interval         1 
     140                                update_all_face true 
    139141                                distance_calc true 3.5                                           
    140142                        } 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/difflab.material

    r1629 r1638  
    155155                pass 
    156156                { 
    157                         IllumTechniques 
    158                         { 
    159                                 RenderTechnique DepthShadowReciever 
    160                                 { 
    161                                         max_light_count 3 
    162                                 } 
    163                         } 
     157                         
    164158                lighting off 
    165159                        ambient 0 0 0 1 
  • GTP/trunk/App/Demos/Illum/Ogre/src/CausticTest/scripts/CausticTest.vcproj

    r1629 r1638  
    159159                                RelativePath="..\..\..\Media\materials\scripts\GlassHead.material"> 
    160160                        </File> 
    161                         <Filter 
    162                                 Name="Header Files" 
    163                                 Filter="h;hpp;hxx;hm;inl;inc"> 
    164                                 <File 
    165                                         RelativePath="..\include\CausticTest.h"> 
    166                                 </File> 
    167                         </Filter> 
     161                </Filter> 
     162                <Filter 
     163                        Name="Header Files" 
     164                        Filter="h;hpp;hxx;hm;inl;inc"> 
     165                        <File 
     166                                RelativePath="..\include\CausticTest.h"> 
     167                        </File> 
    168168                </Filter> 
    169169        </Files> 
  • GTP/trunk/App/Demos/Illum/Ogre/src/DiffuseTest/include/DiffuseTest.h

    r1629 r1638  
    5151                if (mInputDevice->isKeyDown(KC_UP)) 
    5252        { 
    53                         objectNode->translate(0,0,0.5); 
     53                        objectNode->translate(0,0,0.1); 
    5454        } 
    5555                if (mInputDevice->isKeyDown(KC_MULTIPLY)) 
     
    7171                if (mInputDevice->isKeyDown(KC_HOME)) 
    7272        { 
    73                         objectNode->translate(0,0.5,0); 
     73                        objectNode->translate(0,0.1,0); 
    7474        } 
    7575                if (mInputDevice->isKeyDown(KC_END)) 
    7676        { 
    77                         objectNode->translate(0,-0.5,0); 
     77                        objectNode->translate(0,-0.1,0); 
    7878        } 
    7979                if (mInputDevice->isKeyDown(KC_DOWN)) 
    8080        { 
    81                         objectNode->translate(0,0,-0.5); 
     81                        objectNode->translate(0,0,-0.1); 
    8282        } 
    8383                if (mInputDevice->isKeyDown(KC_RIGHT)) 
     
    578578   void createScene3() 
    579579   { 
     580           OgreIlluminationManager::getSingleton().setFocusingSM(false); 
     581           OgreIlluminationManager::getSingleton().setShadowMapSize(1024); 
     582          // OgreIlluminationManager::getSingleton().setBlurShadowMap(true); 
    580583            mSceneMgr->setAmbientLight(ColourValue(0.505 * 0.2, 0.897 * 0.2, 0.914 * 0.2)); 
    581584                 
    582585                SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 
    583586 
    584         Entity* object = mSceneMgr->createEntity("object", "santa.mesh"); 
     587        Entity* object = mSceneMgr->createEntity("object", "buddha.mesh"); 
    585588                object->setMaterialName("GameTools/Diffuse/use"); 
    586589                //object->setMaterialName("GameTools/Diffuse2"); 
    587590                objectNode = rootNode->createChildSceneNode(); 
    588591                objectNode->attachObject(object); 
    589                 objectNode->scale(0.1,0.1,0.1); 
     592                objectNode->scale(0.5,0.5,0.5); 
    590593                objectNode->rotate(Vector3(0,1,0),Radian(Math::PI)); 
    591                 objectNode->setPosition(0,0,2); 
     594                objectNode->setPosition(0,0,0); 
    592595                objectNode->_updateBounds(); 
    593596 
     
    622625        mainBlueLight->setDiffuseColour(ColourValue(0.395,0.766, 1.0)); 
    623626                mainBlueLight->setPowerScale(5.0); 
    624                 mainBlueLight->setSpotlightRange(Degree(20),Degree(90)); 
     627                mainBlueLight->setSpotlightRange(Degree(0),Degree(160)); 
     628                mainBlueLight->setAttenuation(5, 0, 1, 0); 
    625629                SceneNode* mainBlueLightNode = rootNode->createChildSceneNode(); 
    626630                mainBlueLightNode->setPosition(-0.546,2.095,1.035); 
Note: See TracChangeset for help on using the changeset viewer.