[Solved] Hydrax disappears

shanefarris

02-01-2011 00:20:46

I have my camera lookat set to 0, 0, 0, and I can load my scene with hydrax and it is rending, but if I move my camera up or down hydrax will disappear. If I change my lookat to 0, 1, 0 it doesn't show up, so something is wrong with how I am setting up my camera and viewport maybe? I don't have anything in my log telling me there's an issue with hydrax.

Here is how I am setting up my camera and viewport:

void CCameraManager::_CreateCamera(const char* Name, SceneNode* Parent)
{
// Create a default camera
if(!m_OgreCamera)
{
SceneManager* sm = CGameManager::Instance()->GetSceneManager();
m_OgreCamera = sm->createCamera("camera_main");

// Create the camera's node structure
if(Parent)
m_CameraNode = Parent;
else
m_CameraNode = sm->getRootSceneNode()->createChildSceneNode(Name);

String targetName = String(Name);
m_TargetNode = sm->getRootSceneNode()->createChildSceneNode(String(targetName + "_target").c_str());

// Attach the Ogre camera to the camera node
m_CameraNode->attachObject(m_OgreCamera);

m_OgreCamera->setNearClipDistance(1.0f);
m_OgreCamera->setAutoAspectRatio(true);

if (CGameManager::Instance()->GetEngineDevice()->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
m_OgreCamera->setFarClipDistance(0);
else
m_OgreCamera->setFarClipDistance(1000);
}
}



void CCameraManager::SetupViewport()
{
if(!isViewportSetup)
{
if(m_OgreCamera)
{
// Setup viewport
u32 test = CGameManager::Instance()->GetRenderWindow()->getNumViewports();
if(CGameManager::Instance()->GetRenderWindow()->getNumViewports() == 0)
{
// Create one viewport, entire window
m_Viewport = CGameManager::Instance()->GetRenderWindow()->addViewport(m_OgreCamera);
m_Viewport->setBackgroundColour(ColourValue(0, 0, 0));

// Alter the camera aspect ratio to match the viewport
m_OgreCamera->setAspectRatio(f32(m_Viewport->getActualWidth()) / f32(m_Viewport->getActualHeight()));
}
else
{
m_Viewport->setCamera(m_OgreCamera);
}

// Alter the camera aspect ratio to match the viewport
m_OgreCamera->setAspectRatio(f32(m_Viewport->getActualWidth()) / f32(m_Viewport->getActualHeight()));
isViewportSetup = true;
}
}

}


Then later I am setting the lookat

m_Camera->lookAt(reVector3Df(0.0f, 1.0f, 10.0f));
// Default should be 0,0,0 otherwise its an offset to the player
m_Camera->setPosition(0.0f, 0.0f, 0.0f);


Has anyone ran into this issue before, or have any idea what the issue could be? Its not my graphics card, I can render the scene just find in Ogitor.

Thanks.

CodeKrash

09-01-2011 00:36:18

don't know if it's related or not, but with SkyX for Mogre, moving the camera causes the moon to disappear, then when the camera is still, the moon reappears. no clues there yet either

shanefarris

13-02-2011 08:08:17

If I set my cameras setFarClipDistance to 0, I have the problem, if I set it to 99999*6 (like in the demo) it works fine.

shokelafch

14-04-2011 16:02:56

Dear shanefarris!
Although your post is marked solved, I have a point to add for future visitors:
When I add shadow (I have tested SHADOWTYPE_STENCIL_ADDITIVE) to the scene, my hydrax mesh disappears with any camera movement. At the time being, I have just disabled the shadow feature for testing purpose, but if someone has a solution, kindly share it as I am planning to use hydrax in a serious application (just think of a 3D Scene without any shadows :roll: :lol: ).

Hydrax: 1.5.1 (patched for ogre 1.7.1)
RenderSystem: (directX 9 plugin)

Thanks.