Changeset 1862 for GTP/trunk/App/Demos/Illum
- Timestamp:
- 12/07/06 16:38:48 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre
- Files:
-
- 9 added
- 6 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 -
GTP/trunk/App/Demos/Illum/Ogre/bin/Release/ogre.cfg
r1851 r1862 3 3 [Direct3D9 Rendering Subsystem] 4 4 Allow NVPerfHUD=No 5 Anti aliasing= None5 Anti aliasing=Level 4 6 6 Floating-point mode=Fastest 7 Full Screen= No8 Rendering Device=NVIDIA GeForce 7950 GX27 Full Screen=Yes 8 Rendering Device=NVIDIA GeForce 6800 GT 9 9 VSync=No 10 10 Video Mode=800 x 600 @ 32-bit colour -
GTP/trunk/App/Demos/Illum/Ogre/src/ReflectionTest/include/ReflectionTest.h
r1860 r1862 30 30 #include "FrameCapture.h" 31 31 32 int scene = 1;32 int scene = 3; 33 33 FrameCapture* capture; 34 34 … … 43 43 44 44 public: 45 void setMoveSpeed(float speed){mMoveSpeed = speed;} 45 46 RaytraceDemoListener(RenderWindow* window, Camera* maincam, SceneNode* objectNode) 46 47 :ExampleFrameListener(window, maincam) … … 48 49 { 49 50 this->mMoveSpeed = 0.1; 51 if(scene == 2) 52 this->mMoveSpeed = 1.0; 53 if(scene == 3) 54 this->mMoveSpeed = 5.0; 55 mStatsOn = false; 56 showDebugOverlay(mStatsOn); 57 50 58 framecount = 0; 51 59 this->objectNode = objectNode; … … 280 288 Root::getSingleton()._setCurrentSceneManager(mSceneMgr); 281 289 282 mCamera->setFOVy(Radian(Degree(80 * 3.0 / 4.0)));290 mCamera->setFOVy(Radian(Degree(80 * mWindow->getHeight() / mWindow->getWidth()))); 283 291 mCamera->setFarClipDistance(200); 284 292 mCamera->setNearClipDistance(0.1); … … 295 303 if(scene == 1) createScene1(); 296 304 if(scene == 2) createScene2(); 305 if(scene == 3) createScene3(); 297 306 298 307 OgreIlluminationManager::getSingleton().initTechniques(); … … 362 371 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 363 372 364 Entity* object = mSceneMgr->createEntity("object", "athene.mesh"); 373 mCamera->setPosition(2.3,7.0,2.3); 374 mCamera->lookAt(Vector3(0,5.75,0.0)); 375 376 Entity* object = mSceneMgr->createEntity("object", "teapot.mesh"); 365 377 object->setMaterialName("MetalTeapotMultipleBounce"); 366 378 objectNode = rootNode->createChildSceneNode(); 367 379 objectNode->attachObject(object); 368 380 //objectNode->scale(0.5,0.5,0.5); 369 objectNode->scale(0.005,0.005,0.005);370 objectNode->setPosition(0, 1.2,0);381 //objectNode->scale(0.005,0.005,0.005); 382 objectNode->setPosition(0,5.75,0.0); 371 383 objectNode->_updateBounds(); 372 384 373 Entity* room = mSceneMgr->createEntity("scene", " difflab.mesh");385 Entity* room = mSceneMgr->createEntity("scene", "terito.mesh"); 374 386 //room->setMaterialName("GameTools/Phong"); 375 387 SceneNode* roomNode = rootNode->createChildSceneNode(); … … 378 390 379 391 mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 380 Light* redLight1 = mSceneMgr->createLight("RedLight1"); 381 redLight1->setType(Light::LT_POINT); 382 redLight1->setCastShadows(false); 383 redLight1->setDiffuseColour(ColourValue(1,0.055, 0.0)); 384 redLight1->setPowerScale(1.6); 385 SceneNode* redLightNode1 = rootNode->createChildSceneNode(); 386 redLightNode1->setPosition(0.05,2.361,-1.07); 387 redLightNode1->attachObject(redLight1); 388 389 Light* greenLight1 = mSceneMgr->createLight("GreenLight1"); 390 greenLight1->setType(Light::LT_POINT); 391 greenLight1->setCastShadows(false); 392 greenLight1->setDiffuseColour(ColourValue(0.362,0.783, 0.685)); 393 greenLight1->setPowerScale(2.0); 394 SceneNode* greenLightNode1 = rootNode->createChildSceneNode(); 395 greenLightNode1->setPosition(1.312,1.313,0); 396 greenLightNode1->attachObject(greenLight1); 397 398 Light* mainBlueLight = mSceneMgr->createLight("MainBlueLight"); 399 mainBlueLight->setType(Light::LT_SPOTLIGHT); 400 mainBlueLight->setCastShadows(true); 401 mainBlueLight->setDiffuseColour(ColourValue(0.395,0.766, 1.0)); 402 mainBlueLight->setPowerScale(5.0); 403 mainBlueLight->setSpotlightRange(Degree(0),Degree(160)); 404 mainBlueLight->setAttenuation(2.5, 0, 1, 0); 405 SceneNode* mainBlueLightNode = rootNode->createChildSceneNode(); 406 mainBlueLightNode->setPosition(-0.546,2.095,1.035); 407 //mainBlueLightNode->rotate(Vector3::UNIT_X, Degree(161.396)); 408 //mainBlueLightNode->rotate(Vector3::UNIT_Y, Degree(53.955)); 409 //mainBlueLightNode->rotate(Vector3::UNIT_Z, Degree(-145.065)); 410 mainBlueLight->setDirection(-1.5,-2.0,1.0); 411 mainBlueLightNode->attachObject(mainBlueLight); 392 Light* Light1 = mSceneMgr->createLight("Light1"); 393 Light1->setType(Light::LT_POINT); 394 Light1->setCastShadows(false); 395 Light1->setDiffuseColour(ColourValue(1,1, 1)); 396 Light1->setPowerScale(1.0); 397 SceneNode* LightNode1 = rootNode->createChildSceneNode(); 398 LightNode1->setPosition(1.5,10.3,0); 399 LightNode1->attachObject(Light1); 400 } 401 402 void createScene3(void) 403 { 404 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 405 406 mCamera->setPosition(6.564,4.328,0.059); 407 mCamera->lookAt(Vector3(0.4,0.16,0.25)); 408 409 Entity* object = mSceneMgr->createEntity("object", "teapot.mesh"); 410 object->setMaterialName("MetalTeapotMultipleBounce"); 411 objectNode = rootNode->createChildSceneNode(); 412 objectNode->attachObject(object); 413 //objectNode->scale(0.5,0.5,0.5); 414 objectNode->scale(2.7,2.7,2.7); 415 objectNode->setPosition(0,0.7,0.0); 416 objectNode->_updateBounds(); 417 418 Entity* room = mSceneMgr->createEntity("scene", "colorcube.mesh"); 419 //room->setMaterialName("GameTools/Phong"); 420 SceneNode* roomNode = rootNode->createChildSceneNode(); 421 roomNode->attachObject(room); 422 roomNode->_updateBounds(); 412 423 } 413 424
Note: See TracChangeset
for help on using the changeset viewer.