Direct rendering to BackBuffer from compositor

What it says on the tin: a place to discuss proposed new features.
Post Reply
iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Direct rendering to BackBuffer from compositor

Post by iigor » Fri Oct 10, 2008 10:37 am

When i have different shemes on different objects, i need to use in final compositor pass copying of my rendering rezults from texture to backbuffer, and always copying takes about 80% of computiong power losses. So i't would be great if i can directly use backbuffer in compositor.
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Fri Oct 10, 2008 6:01 pm

Explain.

You don't need to just copy the last texture to the compositor, the 'output' of the final compositor IS the backbuffer of the final output.
0 x

iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Post by iigor » Mon Oct 13, 2008 9:42 am

So i have compositor:

Code: Select all

//It's used to have 3 layers of objects
// 1-t layer is solids, 
// 2-d is additive transparent objects, 
// 3-d alpha transparent objects rendered by depth peel(only 1-t layer)
compositor Transparency_Slice_1
{
   technique
    {
		texture colour_texture_slice_1 target_width target_height PF_A8R8G8B8		
		target colour_texture_slice_1
        {
			input none
			pass clear
			{
			}
			pass render_scene
			{
				last_render_queue 51
			}
        }
		
		target colour_texture_slice_1
        {
			input none
			pass render_scene
			{
				first_render_queue 70
				last_render_queue 79
			}
        }
		
		target colour_texture_slice_1
        {
			input none
			material_scheme write_colour_slice
			pass render_scene
			{
				first_render_queue 59
				last_render_queue 61
			}
        }
		
		target colour_texture_slice_1
        {
			input none
			pass render_scene
			{
				first_render_queue 80
			}
        }
		
		target_output
		{
			input none
			pass render_quad
            {
                material texture_copy
                input 0 colour_texture_slice_1
            }
		}
    }
}
And here is results: with standart compositor i have 400 fps, with that i have 360, but if i comment out target_output(only render scene without copying results to the screen) i get 390 fps, so most expencive place in this compositor is copying results from texture to backbuffer using rendering screen aligned quad but it's about 20 times faster to use blitting, not rendering, and it's the easiest way is to use backbuffer without copying 8) , i want to have such compositor (or something like this):

Code: Select all

compositor Transparency_Slice_1
{
   technique
    {
		texture colour_texture_slice_1 back_buffer	
		target colour_texture_slice_1
        {
			input none
			pass clear
			{
			}
			pass render_scene
			{
				last_render_queue 51
			}
        }
		
		target colour_texture_slice_1
        {
			input none
			pass render_scene
			{
				first_render_queue 70
				last_render_queue 79
			}
        }
		
		target colour_texture_slice_1
        {
			input none
			material_scheme write_colour_slice
			pass render_scene
			{
				first_render_queue 59
				last_render_queue 61
			}
        }
		
		target colour_texture_slice_1
        {
			input none
			pass render_scene
			{
				first_render_queue 80
			}
        }
    }
}
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Wed Oct 15, 2008 3:43 pm

I'll repeat my 'why'?

Your texture_copy pass is pointless, you can have the same effect by making the last 'target colour_texture_slice_1' the 'target_output' instead.
0 x

iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Post by iigor » Wed Oct 15, 2008 4:13 pm

O sorry i missed input directive:

Code: Select all

compositor Transparency_Slice_1
{
   technique
    {
		texture colour_texture_slice_1 target_width target_height PF_A8R8G8B8		
		
		target colour_texture_slice_1
        {
			input none
			pass clear
			{
			}
			pass render_scene
			{
				last_render_queue 51
			}
        }
		
		target colour_texture_slice_1
        {
			input previous
			pass render_scene
			{
				first_render_queue 70
				last_render_queue 79
			}
        }
		
		target colour_texture_slice_1
        {
			input previous
			material_scheme write_colour_slice
			pass render_scene
			{
				first_render_queue 59
				last_render_queue 61
			}
        }
		
		target_output
        {
			input previous
			pass render_scene
			{
				first_render_queue 80
			}
        }
    }
}
This code works pretty fine, thanks 8) , but i think that texture is unneded or Ogre after compiling such type of compositor will not create any textures?[/code]
0 x

iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Post by iigor » Tue Nov 18, 2008 2:42 pm

Code: Select all

compositor Transparency_Slice_1 
{ 
   technique 
    { 
      texture colour_texture_slice_1 target_width target_height PF_A8R8G8B8       
      target colour_texture_slice_1 
        { 
         input none 
         pass clear 
         { 
         } 
         pass render_scene 
         { 
            last_render_queue 51 
         } 
        } 
       
      target colour_texture_slice_1 
        { 
         input none 
         pass render_scene 
         { 
            first_render_queue 70 
            last_render_queue 79 
         } 
        } 
       
      target colour_texture_slice_1 
        { 
         input none 
         material_scheme write_colour_slice 
         pass render_scene 
         { 
            first_render_queue 59 
            last_render_queue 61 
         } 
        } 
       
      target_output 
      { 
         input none 
        pass render_scene 
         { 
            first_render_queue 80 
         } 
      } 
    } 
}
Before i resently updated Ogre, here is added new bug:
when i use described above compositor i have screen with uncleared contents of video memory.
0 x

User avatar
iloseall
Gremlin
Posts: 156
Joined: Sun Sep 14, 2003 3:54 am
Location: Beijing China
Contact:

Post by iloseall » Wed Nov 19, 2008 3:52 pm

sinbad wrote:I'll repeat my 'why'?

Your texture_copy pass is pointless, you can have the same effect by making the last 'target colour_texture_slice_1' the 'target_output' instead.
About "Why":
sometimes:
We can not making the last 'target colour_texture_slice_1' to 'target_output' when we want render the scene with same depth buffer .
In Ogre, rendertargets create in compositor can use same depth buffer if they has same size and etc.
But, the depth buffer used by main background buffer is not samed with this though with same size and etc.


see also:
//Question 2: IN
http://www.ogre3d.org/phpBB2/viewtopic. ... highlight=
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Wed Nov 19, 2008 7:56 pm

Depth / stencil buffers are always shared between surfaces that are the same size & format (including AA modes). You can exploit this if you want to re-use depth results.
0 x

Post Reply