Changeset 1060


Ignore:
Timestamp:
06/27/06 10:17:56 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media/materials
Files:
4 edited

Legend:

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

    r807 r1060  
    3232        float4 hPosition        : POSITION; 
    3333        float4 Position         : TEXCOORD0; 
     34        float4 cPosition        : TEXCOORD1; 
    3435}; 
    3536 
    3637VS_OUT_SHADOW depthShadowVS(float4 position : POSITION,  
    3738                uniform float4x4 world, 
     39                uniform float4x4 worldView, 
    3840                uniform float4x4 worldViewProj) 
    3941{ 
     
    4143  OUT.hPosition = mul(worldViewProj, position); 
    4244  OUT.Position = mul(world, position); 
     45  OUT.cPosition = mul(worldView, position); 
    4346  return OUT; 
    4447} 
     
    4851                                        uniform float4x4 lightView, 
    4952                                        uniform float4x4 lightViewProj, 
    50                                         uniform sampler2D depthShadowMap ):COLOR 
    51 { 
    52         float bias = 0.0; 
    53         float4 shadowColor = float4(0.4, 0.4, 0.4, 1.0); 
     53                                        uniform float4x4 lightView2, 
     54                                        uniform float4x4 lightViewProj2, 
     55                                        uniform sampler2D depthShadowMap : register(s0), 
     56                                        uniform sampler2D depthShadowMap2 : register(s1)):COLOR 
     57{                                        
     58        float bias = 0.06; 
     59        float4 shadowColor = float4(0.6, 0.6, 0.6, 1.0); 
    5460 
    55         float4 light = 1; 
     61        float4 light1 = 1; 
     62        float4 light2 = 1; 
     63        float weight1 = 1; 
     64        float weight2 = 1; 
    5665         
    57         float4 lightCamPos = mul(lightView, IN.Position); 
    58         float d = length(lightCamPos.xyz); 
     66        float4 lightCamPos1 = mul(lightView, IN.Position); 
     67        float d1 = length(lightCamPos1.xyz);     
     68        float4 lightScreenPos1 = mul(lightViewProj, IN.Position); 
     69        lightScreenPos1 = lightScreenPos1 / lightScreenPos1.w ;  
     70        lightScreenPos1 = ( lightScreenPos1 + 1.0 ) / 2.0; 
     71        lightScreenPos1.y = 1.0 - lightScreenPos1.y; 
     72        float4 storedDepth1 = tex2D(depthShadowMap, lightScreenPos1.xy); 
     73                if(storedDepth1.r + bias < d1) 
     74                        light1=0; 
    5975         
    60         float4 lightScreenPos = mul(lightViewProj, IN.Position); 
    61         lightScreenPos = lightScreenPos / lightScreenPos.w ; 
    62         float dist = length(lightScreenPos.xy); 
    6376         
    64         if(dist < 1.0 && lightCamPos.z < 0) 
     77        float4 lightCamPos2 = mul(lightView2, IN.Position); 
     78        float d2 = length(lightCamPos2.xyz); 
     79         
     80                         
     81        float4 lightScreenPos2 = mul(lightViewProj2, IN.Position); 
     82        lightScreenPos2 = lightScreenPos2 / lightScreenPos2.w ;  
     83 
     84        if(abs(lightScreenPos2.x) < 0.99 && abs(lightScreenPos2.y) < 0.99 ) 
    6585        { 
    66                 lightScreenPos = ( lightScreenPos + 1.0 ) / 2.0; 
    67                 lightScreenPos.y = 1.0 - lightScreenPos.y; 
    68                 float4 storedDepth = tex2D(depthShadowMap, lightScreenPos.xy); 
    69                          
    70                  
    71                 if(storedDepth.r + bias < d) 
    72                         light = shadowColor; 
    73                 if(storedDepth.r == 0) 
    74                         light = 1;                       
     86                lightScreenPos2 = ( lightScreenPos2 + 1.0 ) / 2.0; 
     87                lightScreenPos2.y = 1.0 - lightScreenPos2.y; 
     88                float4 storedDepth2 = tex2D(depthShadowMap2, lightScreenPos2.xy); 
     89                        if(storedDepth2.r + bias < d2) 
     90                                light2=0;        
    7591        } 
    7692        else 
    77                 light = 1; 
     93                weight2 = 0; 
    7894                 
    79         return light;    
     95        weight1 = 1 - weight2;   
     96                 
     97        return saturate((light1*weight1 + light2*weight2) + shadowColor);        
    8098} 
    8199 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Localized_EnvMap.hlsl

    r875 r1060  
    245245} 
    246246 
    247 void PhotonMapSoftShadowPS(  float2 texCoord : TEXCOORD0,  
    248                 float3 wPos     : TEXCOORD1,     
    249                 float3 mNormal  : TEXCOORD2, 
    250                 uniform float3 cameraPos, 
    251                 uniform samplerCUBE DistanceMap : register(s0), 
    252                 uniform float3 lastCenter, 
    253                 out float4 Color :COLOR0) 
    254 { 
    255          
    256         Color = float4(1,1,1,1); 
    257          
    258         mNormal = normalize(mNormal); 
    259         float3 newTexCoord;      
    260         float3 mPos = wPos - lastCenter; 
    261         float3 V = normalize(wPos - cameraPos); 
    262         newTexCoord = V;         
    263          
    264         newTexCoord = Hit(mPos, V, DistanceMap); 
    265          
    266         Color = float4(normalize(newTexCoord),1); 
    267 } 
     247 
    268248 
    269249///////////////////// 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material

    r847 r1060  
     1 
     2 
     3material GameTools/HPS 
     4{  
     5 
     6   technique  
     7   {  
     8      pass  
     9      {  
     10                IllumTechniques 
     11                { 
     12                        RenderTechnique HPS 
     13                        { 
     14                                particle_script GameTools/Little 
     15                        }                        
     16                } 
     17                 
     18                scene_blend add 
     19                 
     20                lighting off             
     21                depth_check off 
     22                 
     23            texture_unit 
     24                { 
     25                        texture  
     26                } 
     27                          
     28                 
     29        } 
     30  } 
     31} 
     32 
     33 
     34material Flare 
     35{ 
     36        technique 
     37        { 
     38                pass 
     39                { 
     40                        //cull_hardware none                     
     41                        lighting off 
     42                        //scene_blend add 
     43                        //scene_blend_op add 
     44                        //scene_blend_op_alpha add 
     45                        //scene_blend_alpha add 
     46                        depth_write off 
     47 
     48                        ambient 1 0 0 1 
     49                        diffuse 1 0 0 1 
     50                        //texture_unit 
     51                        //{ 
     52                        //      texture flare.png 
     53                        //} 
     54                } 
     55        } 
     56} 
     57 
    158material Examples/MorningSkyBox 
    259{ 
     
    626683      pass  
    627684      {  
     685                 
     686                IllumTechniques 
     687                { 
     688                        RenderTechnique ReducedColorCubeMap 
     689                        { 
     690                                update_interval         3 
     691                                distance_calc false 
     692                                face_angle_calc false 
     693                                update_all_face         false 
     694                        } 
     695                } 
     696       
     697 
    628698                vertex_program_ref GameTools/DiffuseVS 
    629699                {        
     
    735805            param_named_auto worldViewProj worldviewproj_matrix  
    736806            param_named_auto world world_matrix      
     807            param_named_auto worldIT inverse_transpose_world_matrix 
    737808         }  
    738809                 fragment_program_ref  GameTools/PhotonMapCausticPS 
     
    892963        pass  
    893964      {  
    894        
    895         cull_hardware none 
    896         cull_software none 
    897         lighting off 
    898         scene_blend add 
    899         depth_write off 
    900  
    901          vertex_program_ref GameTools/SpriteVS 
    902          {        
    903             param_named_auto worldViewProj worldviewproj_matrix  
    904             param_named_auto worldView worldview_matrix 
    905                         param_named_auto Proj projection_matrix      
    906          }  
    907          fragment_program_ref  GameTools/SpritePS 
    908          {  
    909                  
    910          } 
    911  
    912          texture_unit 
    913          { 
    914           texture flare.png 
    915          } 
     965                 
     966                cull_hardware none 
     967                cull_software none 
     968                lighting off 
     969                scene_blend add 
     970                depth_write off 
     971 
     972                vertex_program_ref GameTools/SpriteVS 
     973                        {        
     974                                param_named_auto worldViewProj worldviewproj_matrix  
     975                                param_named_auto worldView worldview_matrix 
     976                                param_named_auto Proj projection_matrix      
     977                        }  
     978                fragment_program_ref  GameTools/SpritePS 
     979                        {  
     980                         
     981                        } 
     982 
     983                texture_unit 
     984                { 
     985                texture flare.png 
     986                } 
    916987 
    917988       } 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.program

    r835 r1060  
    179179} 
    180180 
    181 fragment_program GameTools/PhotonMapSoftShadowPS hlsl 
    182 { 
    183         source GameTools_Localized_EnvMap.hlsl 
    184         entry_point PhotonMapSoftShadowPS 
    185         target ps_3_0 
    186 } 
     181//fragment_program GameTools/PhotonMapSoftShadowPS hlsl 
     182//{ 
     183//      source GameTools_Localized_EnvMap.hlsl 
     184//      entry_point PhotonMapSoftShadowPS 
     185//      target ps_3_0 
     186//} 
    187187 
    188188 
Note: See TracChangeset for help on using the changeset viewer.