Arilon
07-07-2011 20:53:16
Hi,
I tried to set up Hydrax like it is in the demo. Everything works fine, except the caustic.
Here is my code:
In the Framelistener I have a m_hydrax->update(...). That works, because I can see foams. The terrain "Island" is shown too and the material too.
Has anybody a suggestion why there are no caustics? Thx for answers.
I tried to set up Hydrax like it is in the demo. Everything works fine, except the caustic.
Here is my code:
//set ambilight and skybox
ogreSceneManager->setAmbientLight(Ogre::ColourValue(1, 1, 1));
ogreSceneManager->setSkyBox(true, "Sky/ClubTropicana", 99999*3, true);
//create camera
ogreCamera = ogreSceneManager->createCamera("MainCam");
//add viewport for camera
ogreViewport = ogreRenderWindow->addViewport(ogreCamera);
//set init values for Camera
ogreCamera->setPosition(TDAppSettings::getInstance()->getSettings().cameraPos);
ogreCamera->setOrientation(TDAppSettings::getInstance()->getSettings().cameraOrientation);
ogreCamera->setFarClipDistance(99999*6);
//create sun light and set location, color
Ogre::Light *mLight = ogreSceneManager->createLight("Light0");
mLight->setPosition(Ogre::Vector3(0,10000,0));
mLight->setDiffuseColour(1, 1, 1);
mLight->setSpecularColour(Ogre::Vector3(1, 0.9f, 0.6f).x, Ogre::Vector3(1, 0.9f, 0.6f).y, Ogre::Vector3(1, 0.9f, 0.6f).z);
//-------------- BEGINN WATER ------------------
//create hydrax pointer object
m_water = new Hydrax::Hydrax(ogreSceneManager, ogreCamera, ogreRenderWindow->getViewport(0));
//create pointer module (hydrax pointer, noise module, base plane, normal mode, projected grid option)
Hydrax::Module::ProjectedGrid *module = new Hydrax::Module::ProjectedGrid(m_water, new Hydrax::Noise::Real(), Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)), Hydrax::MaterialManager::NM_VERTEX, Hydrax::Module::ProjectedGrid::Options());
// Add some waves
static_cast<Hydrax::Noise::Real*>(module->getNoise())->addWave(
Ogre::Vector2(1.f,0.f),
0.3f,
10.f);
static_cast<Hydrax::Noise::Real*>(module->getNoise())->addWave(
Ogre::Vector2(0.85f,0.15f),
0.15f,
8.f);
static_cast<Hydrax::Noise::Real*>(module->getNoise())->addWave(
Ogre::Vector2(0.95f,0.1f),
0.1f,
7.f);
m_water->setModule(static_cast<Hydrax::Module::Module*>(module));
//load params of water
m_water->loadCfg("HydraxDemo.hdx");
//create water
m_water->create();
//-------------- END WATER ------------------
ogreSceneManager->setWorldGeometry("Island.cfg");
m_water->getMaterialManager()->addDepthTechnique(static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName("Island"))->createTechnique());
In the Framelistener I have a m_hydrax->update(...). That works, because I can see foams. The terrain "Island" is shown too and the material too.
Has anybody a suggestion why there are no caustics? Thx for answers.