Changeset 1831 for GTP/trunk/App/Demos/Illum/Ogre/Media
- Timestamp:
- 11/30/06 14:48:15 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Files:
-
- 7 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl
r1735 r1831 15 15 16 16 17 #define LIN_ITERATIONCOUNT 20 18 #define SECANT_ITERATIONCOUNT 2 17 #define MAX_LIN_ITERATIONCOUNT 20 18 #define MIN_LIN_ITERATIONCOUNT 6 19 #define SECANT_ITERATIONCOUNT 1 19 20 20 21 float Hit(float3 x, float3 R, samplerCUBE mp, out float3 newDir) … … 31 32 32 33 33 float dt = length(x / xm - R / Rm) * 256.0 / 2.0;34 dt = max(dt, 4);34 float dt = length(x / xm - R / Rm) * MAX_LIN_ITERATIONCOUNT; 35 dt = max(dt, MIN_LIN_ITERATIONCOUNT); 35 36 dt = 1.0 / dt; 36 37 … … 41 42 //float3 p = R; 42 43 float3 p = 0; 43 44 45 //float dt = 1.0 / LIN_ITERATIONCOUNT; 46 44 47 45 //linear iteration 48 49 float t = 0.9999999999999; 46 float t; 47 float dist = 0; 48 /* 49 t = 0.9999999999999; 50 50 dp = a * t / (1 - t); 51 51 p = x + R * dp; 52 floatdist = readDistanceCubeMap(mp, p);52 dist = readDistanceCubeMap(mp, p); 53 53 ppp = length(p) / dist; 54 54 */ 55 55 t = 0; 56 56 … … 241 241 //return; 242 242 243 243 244 float3 newDir1; 244 245 float d1 = Hit(mPos, R, NormDistMap1, newDir1); … … 285 286 //Color = float4(1,0,0,1); 286 287 } 287 288 289 /* 290 float3 newDir2; 291 float d2 = Hit(mPos, R, NormDistMap2, newDir2); 292 float3 normal2 = readCubeMap(NormDistMap2, newDir2); 293 bool valid2 = dot(normal2, R) < 0 && dot(newDir2,newDir2) != 0; 294 if(valid2) 295 newDir2 = 0; 296 if(valid2) 297 { 298 float d; 299 float3 newN; 300 d = d2; 301 newN = normal2; 302 float3 newV = R; 303 float3 newX = mPos + R * d; 304 float3 newR = normalize(reflect( newV, newN)); 305 306 Hit(newX, newR, DistanceMap, newTexCoord); 307 Color = readCubeMap(CubeMap, newTexCoord ); 308 } 309 else 310 { 311 Hit(mPos, R, DistanceMap, newTexCoord); 312 Color = readCubeMap(CubeMap, newTexCoord ); 313 } 314 */ 288 315 return; 289 316
Note: See TracChangeset
for help on using the changeset viewer.