- Timestamp:
- 04/24/07 14:10:34 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPAdvancedEnvMap/diffuse
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPAdvancedEnvMap/diffuse/GTPDiffuse.hlsl
r2054 r2337 6 6 float4 readCubeMap(samplerCUBE cm, float3 coord) 7 7 { 8 float4 color = texCUBElod( cm, float4(coord.xy, -coord.z, 1) );8 float4 color = texCUBElod( cm, float4(coord.xy, -coord.z, 0) ); 9 9 color.a = 1; 10 10 return color; … … 13 13 float readDistanceCubeMap(samplerCUBE dcm, float3 coord) 14 14 { 15 float dist = texCUBElod(dcm, float4(coord.xy, - coord.z, 1)).r;15 float dist = texCUBElod(dcm, float4(coord.xy, - coord.z, 0)).r; 16 16 if(dist == 0) dist = 1000000; ///sky 17 17 return dist; … … 26 26 float4 MPos : TEXCOORD0; 27 27 }; 28 28 /* 29 29 float4 ReduceCubeMap_PS(MPos_OUT IN, 30 30 uniform int nFace, … … 54 54 return color / (RATE * RATE); 55 55 } 56 56 */ 57 58 float4 ReduceCubeMap_PS(MPos_OUT IN, 59 uniform int nFace, 60 uniform samplerCUBE EnvironmentMapSampler : register(s0) ) : COLOR 61 { 62 float4 color = 0; 63 float3 dir; 64 65 for (int i = 0; i < RATE/2; i+=1) 66 for (int j = 0; j < RATE/2; j+=1) 67 { 68 float2 pos; 69 pos.x = IN.MPos.x + (4*i + 2)/(float)CUBEMAP_SIZE; 70 pos.y = IN.MPos.y - (4*j + 2)/(float)CUBEMAP_SIZE; // y=-u 71 72 // "scrambling" 73 if (nFace == 0) dir = float3(1, pos.y, -pos.x); 74 if (nFace == 1) dir = float3(-1, pos.y, pos.x); 75 if (nFace == 2) dir = float3(pos.x, 1, -pos.y); 76 if (nFace == 3) dir = float3(pos.x, -1, pos.y); 77 if (nFace == 4) dir = float3(pos.x, pos.y, 1); 78 if (nFace == 5) dir = float3(-pos.x, pos.y,-1); 79 80 color += texCUBE( EnvironmentMapSampler, dir); 81 } 82 83 return color / (RATE * RATE / 4.0); 84 } 57 85 58 86 //////////////// -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPAdvancedEnvMap/diffuse/GTPDiffuse.program
r2054 r2337 4 4 entry_point Diffuse_Poly2Point_PS 5 5 target ps_3_0 6 flow_control prefer6 //flow_control prefer 7 7 } 8 8 … … 28 28 entry_point ReduceCubeMap_PS 29 29 target ps_3_0 30 flow_control prefer30 //flow_control avoid 31 31 }
Note: See TracChangeset
for help on using the changeset viewer.