[SOLVED] Sky disappears on Camera Move

ronybeck

01-04-2012 20:04:11

Hi,

I am working with Ogre3D embedded in a gui. Everything with Ogre3D and Caelum seems to work fine except when I move the camera. If I move the camera bacwards, left or right the sky disappears and I see only black. Although the clouds are still rendered. If I move the camera forward, I see the sky in a large ball on the screen. In each case, the sky is rendered correctly as soon as the camera is stationary again. The problem is not observed when rotatine the camera.

Here is what the sky looks like when moving the camera forward.



Here is the code I am using to initialise Caelum.


Caelum::CaelumSystem::CaelumComponent componentMask;
componentMask = static_cast<Caelum::CaelumSystem::CaelumComponent> (
Caelum::CaelumSystem::CAELUM_COMPONENT_SUN |
Caelum::CaelumSystem::CAELUM_COMPONENT_MOON |
Caelum::CaelumSystem::CAELUM_COMPONENT_SKY_DOME |
//Caelum::CaelumSystem::CAELUM_COMPONENT_IMAGE_STARFIELD |
Caelum::CaelumSystem::CAELUM_COMPONENT_POINT_STARFIELD |
Caelum::CaelumSystem::CAELUM_COMPONENT_CLOUDS |
0);

// Initialise CaelumSystem.
m_CaelumSystem = new Caelum::CaelumSystem(Ogre::Root::getSingletonPtr(), m_SceneManager, componentMask);

// Set time acceleration.
m_CaelumSystem->getUniversalClock()->setTimeScale(256);

// Register caelum as a listener.
m_RenderWindow->addListener(m_CaelumSystem);
Ogre::Root::getSingletonPtr()->addFrameListener(m_CaelumSystem);

m_CaelumSystem->setSceneFogDensityMultiplier(0.0000f); // or some other small value.

//setup the precipitation controller
m_CaelumSystem->setPrecipitationController(new Caelum::PrecipitationController(m_SceneManager));
m_CaelumPrecipitationController = m_CaelumSystem->getPrecipitationController();
m_CaelumPrecipitationController->createViewportInstance(m_Viewport);
m_CaelumPrecipitationController->setPresetType(Caelum::PRECTYPE_DRIZZLE);
m_CaelumPrecipitationController->setIntensity(0.8);
m_CaelumPrecipitationController->setSpeed(0.005);
m_CaelumPrecipitationController->setManualCameraSpeed(Ogre::Vector3::ZERO);

//m_SceneManager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED);


Any suggestions as to what might be the cause? Many thanks for reading!

ronybeck

02-04-2012 21:28:06

Ok, I found the problem. I had this:

m_Camera->setNearClipDistance(1);
m_Camera->setFarClipDistance(0);


As soon as I change it to this, it works fine.

m_Camera->setNearClipDistance(1);
m_Camera->setFarClipDistance(15000);