- Timestamp:
- 10/27/06 17:40:02 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Blur.hlsl
r1257 r1691 1 #define samplesU 52 #define samplesV 51 #define samplesU 3 2 #define samplesV 3 3 3 4 4 struct VS_INPUT { … … 39 39 return tex2D(Texture, uv); 40 40 } 41 42 VS_OUTPUT BlurCubeFaceVS(VS_INPUT IN) { 43 VS_OUTPUT OUT; 44 OUT.hPosition = IN.Position; 45 OUT.Position = OUT.hPosition; 46 return OUT; 47 } 48 49 float4 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.