Open seas

yes

17-05-2009 20:53:39

Hi.
I'm writing a small demo very similar to the Hydrax demo with an endless sea, a sky box and a few objects.
I've noticed that when I get high enough I see a gap between the sea and the horizon (the middle of the skybox).
Any idea for a quick fix for that? I don't need to see any waves there, a simple reflective area which will match the sea will be good enough.
Thanks.

Xavyiy

25-05-2009 11:00:49

This problem is due to the fact that the skybox geometry is cutted by the custom clip plane in reflection RTT, so.. you need to avoid the clip planning for the skybox.

I've solved it in Hydrax using a RenderQueueListener,
have a look to:

RttManager.h
/** RttManager::CReflectionListener::CReflectionQueueListener class
Used for avoid near clip plane clipping during the reflection Rtt
*/
class CReflectionQueueListener : public Ogre::RenderQueueListener
{
public:
/** Called at the start of the queue
*/
void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation);

/** Called on the end of the queue
*/
void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation) ;

/// Rtt manager pointer
RttManager* mRttManager;
/// Is the reflection Rtt active?
bool mActive;
};

RttManager.cpp
void RttManager::CReflectionListener::CReflectionQueueListener::renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation)
{
if (mRttManager->_isRenderQueueInList(mRttManager->mDisableReflectionCustomNearCliplPlaneRenderQueues, static_cast<Ogre::RenderQueueGroupID>(queueGroupId)) && mActive)
{
mRttManager->mHydrax->getCamera()->disableCustomNearClipPlane();
Ogre::Root::getSingleton().getRenderSystem()->_setProjectionMatrix(mRttManager->mHydrax->getCamera()->getProjectionMatrixRS());
}
}

void RttManager::CReflectionListener::CReflectionQueueListener::renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation)
{
if (mRttManager->_isRenderQueueInList(mRttManager->mDisableReflectionCustomNearCliplPlaneRenderQueues, static_cast<Ogre::RenderQueueGroupID>(queueGroupId)) && mActive)
{
mRttManager->mHydrax->getCamera()->enableCustomNearClipPlane(mRttManager->mPlanes[RTT_REFLECTION]);
Ogre::Root::getSingleton().getRenderSystem()->_setProjectionMatrix(mRttManager->mHydrax->getCamera()->getProjectionMatrixRS());
}
}


Hope it will be useful for you,
Xavi