Jump to content
  • Advertisement
Sign in to follow this  

Render depth using Ogre

Recommended Posts

I'm trying to render the depth buffer using a RTT then pass it to compositor then render a full screen quad. 

but I don't get any depth texture at all

here is my code


 // Create the depth render texture
        Ogre::TexturePtr depthTexture = Ogre::TextureManager::getSingleton().createManual(
                                                                              "DepthMap", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                                                                              Ogre::TEX_TYPE_2D, mOgreCamera->getViewport()->getActualWidth(), mOgreCamera->getViewport()->getActualHeight(),
                                                                              0, Ogre::PF_FLOAT16_R, Ogre::TU_RENDERTARGET);
        Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName("Ogre/Compositor/SSAO");
    //    material->getTechnique(0)->getPass(0)->setVertexProgram( "SSAO_vs" );
      //  material->getTechnique(0)->getPass(0)->setFragmentProgram( "SSAO_fs" );
        Ogre::RenderTexture* renderTexture = depthTexture->getBuffer()->getRenderTarget();

        renderTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue( 0.8f, 0.8f, 0.8f ));

and that's the compositor


compositor DepthMap
        // Temporary textures
        texture rt0 target_width target_height PF_A8R8G8B8

        target rt0
            // Render output from previous compositor (or original scene)
            input previous

            // Start with clear output
            input none

            // Draw a fullscreen quad with the black and white image
            pass render_quad
                // Renders a fullscreen quad with a material
                material Ogre/Compositor/SSAO
                input 0 rt0

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!