Changeset 2136


Ignore:
Timestamp:
02/20/07 14:13:51 (17 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic
Files:
2 edited

Legend:

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

    r2095 r2136  
    5151                           uniform float3 lastCenter, 
    5252                                   uniform float3 cameraPos, 
    53                                    uniform float reflIndex, 
     53                                   uniform float refIndex, 
    5454                                   uniform samplerCUBE DistanceMap : register(s0)):COLOR0 
    5555{ 
     
    6161        float3 V = normalize(IN.wPos.xyz - cameraPos); 
    6262                 
    63         float3 R = refract(V, wNormal, reflIndex);               
     63        float3 R = refract(V, wNormal, refIndex);                
    6464         
    6565        dir = R;                         
     
    156156                                                float4 texCoord : TEXCOORD0, 
    157157                                                float4 color    : COLOR0, 
     158                                                uniform float WorldSize, 
     159                                                uniform float notUseIntensity, 
    158160                                                uniform float4x4 WorldView, 
    159161                                                uniform float4x4 Proj, 
     
    166168  float pixel = 1.0 / PhotonMapResolution;    
    167169  float2 uv = float2(position.x, 1.0 - position.y); 
     170  uv += float2(pixel / 2.0,pixel / 2.0); 
    168171  float4 pos = tex2Dlod(PhotonHitMap, float4(uv,0,0)).rgba; 
    169172 
     
    171174   { 
    172175                OUT.color = float4(0,0,0,0);             
    173                 OUT.hPosition = float4(0, 0, -1000000, 1); 
     176                OUT.hPosition = float4(1000000, 1000000, 1000000, 1); 
    174177   } 
    175178   else 
     
    216219                        valids++; 
    217220                } 
    218                 //if(valids == 0) sumdist = 100000;              
     221                 
     222                 
    219223                float avrdist = sumdist / valids; 
    220                 //float maxdist = 10; 
    221                 //intensity = max(maxdist - avrdist, 0.0) / maxdist; 
    222                 intensity = 5 / (avrdist * avrdist * 3.14); 
    223                 //intensity = valids / 4.0;//avrdist; 
    224                  
    225                 //OUT.color = float4(1,1,1,intensity); 
     224                if(valids == 0) avrdist = WorldSize / 1000.0;            
     225                 
     226                intensity = WorldSize / (avrdist * avrdist * 3.14); 
     227                //intensity = 0.8; 
     228                 
    226229                OUT.color = intensity; 
     230                if(notUseIntensity) 
     231                        OUT.color = float4(1,1,1,1);             
    227232        }   
    228233    
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.material

    r2054 r2136  
    1515     param_named_auto cameraPos camera_position 
    1616     param_named lastCenter float3 0 0 0 
    17      param_named reflIndex float 0.85    
     17     param_named refIndex float 0.85     
    1818   } 
    1919   //cubemap of distances 
     
    7171     param_named_auto WorldView      worldview_matrix 
    7272     param_named_auto Proj           projection_matrix 
    73      param_named PhotonMapResolution float 32 
     73     param_named PhotonMapResolution float 64 
     74     param_named WorldSize float 10 
    7475   }  
    7576   fragment_program_ref GTP/Caustic/CauCube_Triangles_PS 
    7677   { 
    7778     param_named CausticColor float4 0.7 0.7 0.5 1 
     79      
    7880   } 
    7981   texture_unit 
     
    9597                        RenderTechnique ColorCubeMap 
    9698                        { 
    97                                 update_interval         0 
     99                                update_interval         1 
    98100                                update_all_face true                                                                     
    99101                        } 
    100102                        RenderTechnique DistanceCubeMap 
    101103                        { 
    102                                 update_interval         0 
     104                                update_interval         1 
    103105                                update_all_face true                                                                             
    104106                        } 
     
    106108                        { 
    107109                                attenuation     1000 
    108                                 photonmap_resolution 32 
     110                                update_interval 1 
     111                                update_all_face true 
     112                                photonmap_resolution 64 
    109113                                caustic_cubemap_resolution 256 
    110114                                photon_map_material     GTP/Caustic/PhotonMap_HitEnv 
    111                                 caustic_map_material    GTP/Caustic/CauCube_PointSprite 
    112                                 //caustic_map_material  GTP/Caustic/CauCube_Triangles 
    113                                 //use_triangles true 
    114                                 //blur_caustic_cubemap true                              
     115                                //caustic_map_material  GTP/Caustic/CauCube_PointSprite 
     116                                caustic_map_material    GTP/Caustic/CauCube_Triangles 
     117                                use_triangles   true 
     118                                blur_caustic_cubemap true                                
    115119                        } 
    116120                         
Note: See TracChangeset for help on using the changeset viewer.