Changeset 1862 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Timestamp:
- 12/07/06 16:38:48 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Files:
-
- 6 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl
r1860 r1862 53 53 ppp = length(p) / dist; 54 54 */ 55 t = dt;55 t = 0.01; 56 56 57 57 while(t <= 1.0 && !overshoot) … … 62 62 if(dist > 0) 63 63 { 64 ppp = length(p) / dist; 64 bool us = false; 65 66 ppp = length(p) / dist; 65 67 if(ppp < 1) 68 us = true; 69 70 us = !us; 71 72 if(us) 66 73 { 67 74 dl = dp; … … 225 232 out float4 Color :COLOR0) 226 233 { 227 if(SingleBounce == 1)228 Color = Metal1BouncePS(IN,cameraPos,CubeMap,DistanceMap,lastCenter);229 else230 {234 //if(SingleBounce == 1) 235 // Color = Metal1BouncePS(IN,cameraPos,CubeMap,DistanceMap,lastCenter); 236 //else 237 //{ 231 238 Color = float4(1,1,1,1); 232 239 … … 242 249 newTexCoord = R; 243 250 244 //Color = readCubeMap(NormDistMap 1, mPos );251 //Color = readCubeMap(NormDistMap2, mPos ); 245 252 //return; 246 253 … … 248 255 float3 newDir1; 249 256 float d1 = Hit(mPos, R, NormDistMap1, newDir1); 250 float3 normal1 = readCubeMap(NormDistMap1, newDir1) ;257 float3 normal1 = readCubeMap(NormDistMap1, newDir1).rgb; 251 258 bool valid1 = /*dot(normal1, R) < 0 &&*/ dot(newDir1,newDir1) != 0; 252 259 if(valid1) … … 254 261 float3 newDir2; 255 262 float d2 = Hit(mPos, R, NormDistMap2, newDir2); 256 float3 normal2 = readCubeMap(NormDistMap2, newDir2);263 float3 normal2 = readCubeMap(NormDistMap2, newDir2).rgb; 257 264 bool valid2 = /*dot(normal2, R) < 0 &&*/ dot(newDir2,newDir2) != 0; 258 265 if(valid2) … … 261 268 if( !valid1 && !valid2) 262 269 { 263 Hit(mPos, R, DistanceMap, newTexCoord);264 Color = readCubeMap(CubeMap, newTexCoord );270 // Hit(mPos, R, DistanceMap, newTexCoord); 271 // Color = readCubeMap(CubeMap, newTexCoord ); 265 272 //Color = 1; 266 273 } … … 309 316 310 317 Color = Color * float4(F,1); */ 311 }318 //} 312 319 } 313 320 … … 317 324 float4 Color = float4(0, 0, 0, 0); 318 325 //return Color; 319 Color = float4(normalize(IN.mNormal) * refIndex, length(IN.cPos));326 Color = float4(normalize(IN.mNormal)/* * refIndex*/, length(IN.cPos)); 320 327 return Color; 321 328 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapotNew.hlsl
r1861 r1862 13 13 } 14 14 15 #define MAX_LIN_ITERATIONCOUNT 2016 #define MIN_LIN_ITERATIONCOUNT 617 #define SECANT_ITERATIONCOUNT 118 #define MAX_RAY_DEPTH 315 #define MAX_LIN_ITERATIONCOUNT 80 16 #define MIN_LIN_ITERATIONCOUNT 30 17 #define SECANT_ITERATIONCOUNT 2 18 #define MAX_RAY_DEPTH 4 19 19 20 20 void linearSearch( float3 x, float3 R, float3 N, samplerCUBE mp, … … 191 191 192 192 float3 R; 193 if(refIndex > 100.0)193 //if(refIndex > 100.0) 194 194 R = normalize(reflect( V, N)); 195 else196 {197 refIndex = 1.0 / refIndex;198 R = normalize(refract( V, N, refIndex));199 }195 //else 196 //{ 197 // refIndex = 1.0 / refIndex; 198 // R = normalize(refract( V, N, refIndex)); 199 //} 200 200 201 201 float3 Nl; … … 220 220 float4 I = float4(0,0,0,0); 221 221 222 float3 N = normalize(IN.mNormal) * refIndex;222 float3 N = normalize(IN.mNormal);// * refIndex; 223 223 float3 newTexCoord; 224 224 float3 x = IN.wPos - lastCenter; … … 232 232 { 233 233 float3 R; 234 float refIndex = length(N);235 refIndex = 1.0 / refIndex;236 N = normalize(N);234 // float refIndex = length(N); 235 // refIndex = 1.0 / refIndex; 236 // N = normalize(N); 237 237 238 if(refIndex > 100.0)238 //if(refIndex > 100.0) 239 239 R = normalize(reflect( V, N)); 240 else241 R = normalize(refract( V, N, refIndex));240 // else 241 // R = normalize(refract( V, N, refIndex)); 242 242 243 243 float3 Nl; … … 258 258 V = R; 259 259 260 if(refIndex <= 100.0)260 //if(refIndex <= 100.0) 261 261 if(dot(N, V) > 0) N = -N; 262 262 } 263 263 264 //if(I.a == 0)265 //I = readCubeMap(CubeMap, l);264 //if(I.a == 0) 265 // I = readCubeMap(CubeMap, l); 266 266 267 267 return I; … … 282 282 Color = SingleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter,refIndex); 283 283 else 284 Color = MultipleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap 1,NormDistMap2,lastCenter,refIndex);284 Color = MultipleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap2,NormDistMap2,lastCenter,refIndex); 285 285 286 286 return Color; -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/MetalTeapot.material
r1860 r1862 89 89 fragment_program_ref NormalDistancePS 90 90 { 91 param_named refIndex float 1.691 param_named refIndex float 200 92 92 } 93 93 } … … 111 111 fragment_program_ref NormalDistancePS 112 112 { 113 param_named refIndex float 1.6113 param_named refIndex float 200 114 114 } 115 115 } … … 196 196 param_named F0 float3 0.95 0.95 0.95 197 197 param_named SingleBounce float 0.0 198 param_named refIndex float 1.6198 param_named refIndex float 200 199 199 } 200 200
Note: See TracChangeset
for help on using the changeset viewer.