Ignore:
Timestamp:
10/27/06 17:40:02 (18 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

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

    r1257 r1691  
    1 #define samplesU 5 
    2 #define samplesV 5 
     1#define samplesU 3 
     2#define samplesV 3 
    33 
    44struct VS_INPUT {            
     
    3939  return tex2D(Texture, uv); 
    4040} 
     41 
     42VS_OUTPUT BlurCubeFaceVS(VS_INPUT IN) { 
     43        VS_OUTPUT OUT; 
     44    OUT.hPosition = IN.Position;    
     45    OUT.Position = OUT.hPosition; 
     46    return OUT; 
     47} 
     48 
     49float4 BlurCubeFacePS(VS_OUTPUT IN, 
     50                        uniform samplerCUBE Texture : register(s0), 
     51                        uniform float width, 
     52                        uniform float height, 
     53                        uniform float face ) : COLOR 
     54 
     55 
     56  float2 pixel = float2(2.0 / width, 2.0 / height); 
     57  float2 uv = IN.Position + pixel * 0.5; 
     58 
     59  float4 sum = float4(0,0,0,0); 
     60 
     61        for(int i = 0; i < samplesU; i++) 
     62         for(int j = 0; j < samplesV; j++) 
     63         { 
     64                float3 dir; 
     65                float2 pos = uv + float2(i - samplesU * 0.5,j - samplesV * 0.5) * pixel; 
     66                if (face == 0) dir = float3(1, pos.y, -pos.x); 
     67                if (face == 1) dir = float3(-1, pos.y, pos.x); 
     68                if (face == 2) dir = float3(pos.x, 1, -pos.y); 
     69                if (face == 3) dir = float3(pos.x, -1, pos.y); 
     70                if (face == 4) dir = float3(pos.x, pos.y, 1); 
     71                if (face == 5) dir = float3(-pos.x, pos.y,-1); 
     72                 
     73                sum += texCUBE(Texture, dir); 
     74         } 
     75                 
     76 
     77  sum /= samplesU * samplesV; 
     78 
     79  return sum; 
     80  //return texCUBE(Texture, float3(uv, 1)) + face * 0.0000001; 
     81} 
Note: See TracChangeset for help on using the changeset viewer.