- Timestamp:
- 07/02/07 04:04:08 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPEnvMap/GTPEnvMap.hlsl
r2409 r2471 13 13 } 14 14 15 #define SECANT_ITERATIONCOUNT 2 15 #define SECANT_ITERATIONCOUNT 20 16 16 17 17 float3 Hit( float3 x, float3 R, samplerCUBE mp ) … … 91 91 uniform float sRefraction ) :COLOR0 92 92 { 93 float4 Color = 0; 93 94 float3 N = normalize(IN.wNormal.xyz); 94 95 float3 RR, TT; … … 97 98 float3 R = reflect( V, N); 98 99 float3 T = refract(V, N, sRefraction); 99 100 101 100 102 RR = R; TT = T; 101 103 RR = Hit(cubePos, R, DistanceMap); 102 TT = Hit(cubePos, T, DistanceMap);104 float4 reflectcolor = readCubeMap(CubeMap, RR ); 103 105 104 float4 reflectcolor = readCubeMap(CubeMap, RR ); 105 float4 refractcolor = readCubeMap(CubeMap, TT ); 106 if(dot(T,T)!=0) 107 { 108 TT = Hit(cubePos, T, DistanceMap); 109 float4 refractcolor = readCubeMap(CubeMap, TT ); 106 110 107 float cos_theta = -dot(V, N); 108 float F = (sFresnel + pow(1 - cos_theta, 5.0f) * (1 - sFresnel)); 109 110 return (F * reflectcolor + (1 - F) * refractcolor); 111 float cos_theta = -dot(V, N); 112 float F = (sFresnel + pow(1 - cos_theta, 5.0f) * (1 - sFresnel)); 113 F = saturate(F); 114 Color = (F * reflectcolor + (1 - F) * refractcolor); 115 } 116 else 117 { 118 Color = reflectcolor; 119 } 120 return Color; 111 121 } 112 122
Note: See TracChangeset
for help on using the changeset viewer.