I made a post process like the TutorialSky_Postprocess that renders a cubemap (that later will be a grid cage) and just masking it with a vignette.
the thing is that I am using the new instanced stereo rendering so the post process I am applying it in two pass quads with different viewports, like this:
Code: Select all
//TUNNELING
{
Ogre::CompositorTargetDef *targetDef = renderNodeDef->addTargetPass( "renderAuxTunneling" );
targetDef->setNumPasses( 2 );
{
//QUAD
Ogre::CompositorPassQuadDef *passQuadDef = static_cast<Ogre::CompositorPassQuadDef*>( targetDef->addPass( Ogre::PASS_QUAD ) );
passQuadDef->setAllLoadActions( Ogre::LoadAction::DontCare );
passQuadDef->setAllStoreActions( Ogre::StoreAction::Store );
passQuadDef->mMaterialName = "TunnelingMat";
passQuadDef->mFrustumCorners = Ogre::CompositorPassQuadDef::CAMERA_DIRECTION;
passQuadDef->addQuadTextureSource( 0, "renderAuxPost" );
passQuadDef->mProfilingId = "STEREO_FINAL_PROCESSING_QUAD_PASS";
passQuadDef->mVpRect[0].mVpLeft = 0.0f;
passQuadDef->mVpRect[0].mVpTop = 0.0f;
passQuadDef->mVpRect[0].mVpWidth = 0.5f;
passQuadDef->mVpRect[0].mVpHeight = 1.0f;
passQuadDef->mVpRect[0].mVpScissorLeft = 0.0f;
passQuadDef->mVpRect[0].mVpScissorTop = 0.0f;
passQuadDef->mVpRect[0].mVpScissorWidth = 0.5f;
passQuadDef->mVpRect[0].mVpScissorHeight = 1.0f;
}
{
//QUAD
Ogre::CompositorPassQuadDef *passQuadDef = static_cast<Ogre::CompositorPassQuadDef*>( targetDef->addPass( Ogre::PASS_QUAD ) );
passQuadDef->setAllLoadActions( Ogre::LoadAction::Load );
passQuadDef->mMaterialName = "TunnelingMat2";
passQuadDef->mFrustumCorners = Ogre::CompositorPassQuadDef::CAMERA_DIRECTION;
passQuadDef->addQuadTextureSource( 0, "renderAuxPost" );
passQuadDef->mProfilingId = "STEREO_FINAL_PROCESSING_QUAD_PASS";
passQuadDef->mVpRect[0].mVpLeft = 0.5f;
passQuadDef->mVpRect[0].mVpTop = 0.0f;
passQuadDef->mVpRect[0].mVpWidth = 0.5f;
passQuadDef->mVpRect[0].mVpHeight = 1.0f;
passQuadDef->mVpRect[0].mVpScissorLeft = 0.5f;
passQuadDef->mVpRect[0].mVpScissorTop = 0.0f;
passQuadDef->mVpRect[0].mVpScissorWidth = 0.5f;
passQuadDef->mVpRect[0].mVpScissorHeight = 1.0f;
}
}
And it works! buuuuut! since each quad is rendering in just half the texture (due to the viewport rect) the cubemap looks stretched, and I guess, that for the same reason... it looks like its at 10cm from my face. I was guessing that some math in the sampling coordinates in the shader would do the trick but I can't find any, I feel there should be a CAMERA_DIRECTION_HALF or something.
is this even possible? as long as the cubemap looks like its at the infinity its good to me
thanks!!