Ogre Version: :14.4.1:
Operating System: :Linux:
Render System: :GL3:
I'm having difficulties understanding what I need to do, do get a depth pre-pass to use the cameras near and far plane settings.
Code: Select all
auto depthText = Ogre::TextureManager::getSingleton().createManual(
"DepthRTT",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, getRenderWindow()->getWidth(), getRenderWindow()->getHeight(),
0, Ogre::PF_DEPTH, Ogre::TU_RENDERTARGET);
Code: Select all
scnMgr->setShadowTechnique(Ogre::ShadowTechnique::SHADOWTYPE_STENCIL_MODULATIVE);
scnMgr->setShadowFarDistance(200.0f);
scnMgr->setFog(Ogre::FOG_EXP, Ogre::ColourValue::Blue, 0.002f);
scnMgr->setAmbientLight(Ogre::ColourValue(0.1f, 0.1f, 0.1f));
scnMgr->setShadowColour(Ogre::ColourValue(0.7f, 0.7f, 0.7f));
scnMgr->setShadowUseInfiniteFarPlane(false);
Code: Select all
auto depthText = Ogre::TextureManager::getSingleton().getByName("DepthRTT");
auto* depthRT = depthText->getBuffer()->getRenderTarget();
auto depthCam = scnMgr->createCamera("depthCam");
depthCam->setNearClipDistance(10.0f);
depthCam->setFarClipDistance(200.0f);
depthCam->setAutoAspectRatio(true);
depthCam->setFOVy(cam->getFOVy());
camNode->attachObject(depthCam);
auto vp = depthRT->addViewport(depthCam);
vp->setClearEveryFrame(true, Ogre::FBT_DEPTH);
vp->setOverlaysEnabled(false);
vp->setShadowsEnabled(false);
vp->setSkiesEnabled(false);
vp->setBackgroundColour(Ogre::ColourValue::Black);
vp->setVisibilityMask(1u << 23);
I attached a image to the post showing the depth texture in render dock. The far plane when looking rgba output seems work as it should, it clips at 200 units. But in the depth buffer the whole scene is in 1.0 to 0.9680 range.
Any idea what could be wrong?


