Changeset 1730 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs
- Timestamp:
- 11/09/06 08:57:54 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl
r1724 r1730 15 15 16 16 17 #define LIN_ITERATIONCOUNT 517 #define LIN_ITERATIONCOUNT 2 18 18 #define SECANT_ITERATIONCOUNT 2 19 19 … … 63 63 } 64 64 65 if(t >= 1 && undershoot) 66 { 67 t = 0.9999999999999; 68 dp = a * t / (1 - t); 69 p = x + R * dp; 70 float dist = readDistanceCubeMap(mp, p); 71 ppp = length(p) / dist; 72 overshoot = true; 73 } 74 65 75 if(overshoot) 66 76 { … … 171 181 float3 R = normalize(reflect( V, IN.mNormal)); 172 182 173 newTexCoord = R + 0.00000001 * lastCenter.x;174 //newTexCoord = R;175 //Hit(mPos, R, DistanceMap, newTexCoord);183 //newTexCoord = R + 0.00000001 * lastCenter.x; 184 newTexCoord = R; 185 Hit(mPos, R, DistanceMap, newTexCoord); 176 186 Color = readCubeMap(CubeMap, newTexCoord ); 177 187 … … 221 231 float d1 = Hit(mPos, R, NormDistMap1, newDir1); 222 232 float3 normal1 = readCubeMap(NormDistMap1, newDir1); 233 bool valid1 = dot(normal1, R) < 0 && dot(newDir1,newDir1) != 0; 234 if(valid1) 235 newDir1 = 0; 223 236 float3 newDir2; 224 237 float d2 = Hit(mPos, R, NormDistMap2, newDir2); 225 238 float3 normal2 = readCubeMap(NormDistMap2, newDir2); 226 227 if( dot(newDir2,newDir2) == 0.0 && dot(newDir1,newDir1) == 0.0 ) 239 bool valid2 = dot(normal2, R) < 0 && dot(newDir2,newDir2) != 0; 240 if(valid2) 241 newDir2 = 0; 242 243 if( !valid1 && !valid2) 228 244 { 229 245 Hit(mPos, R, DistanceMap, newTexCoord); 230 Color = readCubeMap(CubeMap, newTexCoord ); 246 Color = readCubeMap(CubeMap, newTexCoord ); 247 //Color = 1; 231 248 } 232 249 else 233 { 234 float 3 newV;235 float3 new R;236 float3 newN = normal1;237 float3 dir = newDir1;238 float d = d1;239 float3 newX;240 //closer hit241 if( d1 > d2)242 { 243 d ir = newDir2;244 d = d2;245 newN = normal2;250 { 251 float d; 252 float3 newN; 253 254 d = d2; 255 newN = normal2; 256 257 Color = float4(0,0,1,1); 258 if( !valid2 || (valid1 && d1 < d2) ) 259 { 260 d = d1; 261 newN = normal1; 262 Color = float4(0,1,0,1); 246 263 } 247 newV = R; 248 newX = mPos + R * d; 249 newR = normalize(reflect( newV, newN)); 264 265 float3 newV = R; 266 float3 newX = mPos + R * d; 267 float3 newR = normalize(reflect( newV, newN)); 250 268 251 269 Hit(newX, newR, DistanceMap, newTexCoord); 252 Color = readCubeMap(CubeMap, newTexCoord ); 270 Color = readCubeMap(CubeMap, newTexCoord ); 271 //Color = float4(newR,1); 272 //Color = float4(1,0,0,1); 253 273 } 254 274 255 //Color = float4(newDir2,1);275 return; 256 276 257 277 float ctheta_in = dot(IN.mNormal,R);
Note: See TracChangeset
for help on using the changeset viewer.