Changeset 1860 for GTP/trunk/App/Demos/Illum/Ogre/Media
- Timestamp:
- 12/06/06 16:05:53 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl
r1859 r1860 312 312 } 313 313 314 float4 NormalDistancePS( VertOut IN ):COLOR314 float4 NormalDistancePS( VertOut IN, uniform float refIndex):COLOR 315 315 { 316 316 317 317 float4 Color = float4(0, 0, 0, 0); 318 318 //return Color; 319 Color = float4(normalize(IN.mNormal) , length(IN.cPos));319 Color = float4(normalize(IN.mNormal) * refIndex, length(IN.cPos)); 320 320 return Color; 321 321 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapotNew.hlsl
r1859 r1860 16 16 #define MIN_LIN_ITERATIONCOUNT 6 17 17 #define SECANT_ITERATIONCOUNT 1 18 #define MAX_RAY_DEPTH 218 #define MAX_RAY_DEPTH 5 19 19 20 20 void linearSearch( float3 x, float3 R, float3 N, samplerCUBE mp, … … 30 30 float a = xm / Rm; 31 31 32 bool undershoot = true, overshoot = false;32 bool undershoot = false, overshoot = false; 33 33 34 34 float dt = length(x / xm - R / Rm) * MAX_LIN_ITERATIONCOUNT; … … 36 36 dt = 1.0 / dt; 37 37 38 float t = dt;38 float t = 0.01;//dt; 39 39 float pa; 40 40 bool first = true; … … 64 64 if(!overshoot) 65 65 p = float3(0,0,0); 66 else if(t == 2 * dt)66 /* else if(t == 2 * dt) 67 67 { 68 68 float3 hitp = pa * normalize(p); 69 69 if(dot(normalize(hitp - x), N) < 0.1f) 70 70 p = float3(0,0,0); 71 } 71 }*/ 72 72 } 73 73 … … 178 178 uniform samplerCUBE NormDistMap1 : register(s2), 179 179 uniform samplerCUBE NormDistMap2 : register(s3), 180 uniform float3 lastCenter) 180 uniform float3 lastCenter, 181 uniform float refIndex) 181 182 { 182 183 float4 Color = float4(1,1,1,1); … … 188 189 189 190 V = normalize(V); 190 float3 R = normalize(reflect( V, N)); 191 //float3 R = normalize(refract( V, N, 0.8)); 191 192 float3 R; 193 if(refIndex > 100.0) 194 R = normalize(reflect( V, N)); 195 else 196 { 197 refIndex = 1.0 / refIndex; 198 R = normalize(refract( V, N, refIndex)); 199 } 192 200 193 201 float3 Nl; … … 207 215 uniform samplerCUBE NormDistMap1 : register(s2), 208 216 uniform samplerCUBE NormDistMap2 : register(s3), 209 uniform float3 lastCenter) 217 uniform float3 lastCenter, 218 uniform float refIndex) 210 219 { 211 220 float4 I = float4(0,0,0,0); 212 221 213 float3 N = normalize(IN.mNormal) ;222 float3 N = normalize(IN.mNormal) * refIndex; 214 223 float3 newTexCoord; 215 224 float3 x = IN.wPos - lastCenter; … … 222 231 while(depth < MAX_RAY_DEPTH) 223 232 { 224 float3 R = normalize(reflect( V, N)); 225 // float3 R = normalize(refract( V, N, 0.8)); 233 float3 R; 234 float refIndex = length(N); 235 refIndex = 1.0 / refIndex; 236 N = normalize(N); 237 238 if(refIndex > 100.0) 239 R = normalize(reflect( V, N)); 240 else 241 R = normalize(refract( V, N, refIndex)); 226 242 227 243 float3 Nl; … … 241 257 N = normalize(Nl); 242 258 V = R; 243 // if(dot(N, V) > 0) N = -N; 259 260 if(refIndex <= 100.0) 261 if(dot(N, V) > 0) N = -N; 244 262 } 245 263 246 /*if(I.a == 0)247 I = readCubeMap(CubeMap, l);*/264 // if(I.a == 0) 265 // I = readCubeMap(CubeMap, l); 248 266 249 267 return I; … … 257 275 uniform samplerCUBE NormDistMap2 : register(s3), 258 276 uniform float3 lastCenter, 259 uniform float SingleBounce):COLOR 277 uniform float SingleBounce, 278 uniform float refIndex):COLOR 260 279 { 261 280 float4 Color = 1.0; 262 281 if(SingleBounce == 1) 263 Color = SingleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter );282 Color = SingleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter,refIndex); 264 283 else 265 Color = MultipleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter );284 Color = MultipleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter,refIndex); 266 285 267 286 return Color; -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/MetalTeapot.material
r1859 r1860 89 89 fragment_program_ref NormalDistancePS 90 90 { 91 91 param_named refIndex float 1.6 92 92 } 93 93 } … … 111 111 fragment_program_ref NormalDistancePS 112 112 { 113 113 param_named refIndex float 1.6 114 114 } 115 115 } … … 134 134 pass 135 135 { 136 //cull_hardware none 136 137 IllumTechniques 137 138 { … … 194 195 //param_named k float3 4.16 2.57 2.32 195 196 param_named F0 float3 0.95 0.95 0.95 196 param_named SingleBounce float 0.0 197 param_named SingleBounce float 0.0 198 param_named refIndex float 1.6 197 199 } 198 200
Note: See TracChangeset
for help on using the changeset viewer.