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 ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.