Time for action — combining two compositor effects

To combine two compositors, we need to create a new one:

  1. To create a new compositor, we need two textures one for storing the scene and one for storing some temporary results:
    compositor Compositor4
    {
    technique
    {
    texture scene target_width target_height PF_R8G8B8
    texture temp target_width target_height PF_R8G8B8
    
  2. Fill the scene texture, as done previously, and then fill the temp texture using the scene texture and our black and white material:
    target scene
    {
    input previous
    }
    target temp
    {
    pass render_quad
    {
    material Ogre3DBeginnersGuide/Comp2
    input 0 scene
    }
    }
    
  3. Then use the temporary material and our invert material to create the output texture:
    target_output
    {
    input none
    pass render_quad
    {
    material Ogre3DBeginnersGuide/Comp3
    input 0 temp
    }
    }
    }
    }
    
  4. Compile and run the application; you should see a scene that first got converted to black and white and was then inverted.
    Time for action — combining two compositor effects

What just happened?

We created a second auxiliary texture; this texture was used as the render target for the black and white material, and then this texture with the black and white image of our scene was used as an input for the invert material, which then got rendered to the display.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.51.103