Page 1 of 1

Compositor with nonlocal render texture and partial viewport

Posted: Fri Mar 06, 2009 10:01 am
by mcspy0312
Hi
I wanted to use Compositor framework to do runtime partial texture update.
It can be supported by adding few lines of code to the framework. To allow compositor renders to non local render texture.
e.g.

Code: Select all

compositor TexUploadTest
{
    technique
    {
        target RTTTex
        {...
        }
    }
}
Since RTTTex is not defined in the compositor script, the compositor will find the Texture named RTTTex globally, and take it as Render target.


And the next thing to add, is to allow user specifying the viewport region on the render target. The current code always create the viewport covering the whole render target.
If a viewport covering only part of the render target can be constructed, then partial texture update can be done.
e.g.

Code: Select all

        target RTTTex
        {
             viewport_left       0
             viewport_up         0
             viewport_bottom    10
             viewport_right     10
        }
Is this a good idea? If it is, I can code it and submit a patch.

Re: Compositor with nonlocal render texture and partial viewport

Posted: Fri Mar 06, 2009 7:30 pm
by sinbad
It's an interesting idea, I think the complication comes from how the viewport parameters are interpreted in the context of chaining compositors together. This needs some thought.

Also note that the compositor's use of textures has had some significant changes in trunk (textures can be shared, held in reserve between technique changes etc), so if you are to prepare a patch please do it against that.

Re: Compositor with nonlocal render texture and partial viewport

Posted: Fri Mar 13, 2009 12:02 pm
by mcspy0312
It is done.
The features can be used in the following example:

Code: Select all

compositor TextureCompose
{
    technique
    {
        use_global_render_texture yes // compositor will also search in global textures if the render target is not defined locally
        target RTTTex
        {
            // Start with clear output
            input none
            pass render_quad
            {
                // Renders a fullscreen quad with a material
                material Examples/OgreLogo
                viewport_dimension 0 0 0.5 0.5 // viewport_dimension left top width height, they are the scaling ratio to the texture size
            }
            pass render_quad
            {
                // Renders a fullscreen quad with a material
                material Ogre/Skin
                viewport_dimension 0 0.5 0.5 0.5
            }
            pass render_quad
            {
                // Renders a fullscreen quad with a material
                material Examples/BumpyMetal
                viewport_dimension 0.5 0 0.5 0.5
            }
            pass render_quad
            {
                // Renders a fullscreen quad with a material
                material Examples/Athene/Basic
                viewport_dimension 0.5 0.5 0.5 0.5
            }
        }
        
        target_output
        {
            // Render output from previous compositor (or original scene)
            input previous
        }
    }
}
The above script composes 4 different textures into a single one and tiling them next to each other.

Re: Compositor with nonlocal render texture and partial viewport

Posted: Tue Mar 17, 2009 3:00 pm
by iloseall
I like the feature!Thanks mcspy0312.
Has it been in trunk?

edit:
I got it from the patch system.

Re: Compositor with nonlocal render texture and partial viewport

Posted: Wed Mar 18, 2009 11:18 am
by mcspy0312
Hi iloseall,
It is good to see my patch is useful. :D
I'm just curious why are you using it?

Re: Compositor with nonlocal render texture and partial viewport

Posted: Thu Mar 19, 2009 3:31 pm
by iloseall
My plan:
create a texture(render target) named "DownSamplerDepth"
then downsampler depth target in compositor to it.
I can use the texture in a lot of material do depth sampler for soft particle or just like..

If no the global render target found,I must get the texture name from CompositorInstance and set it to every material in runtime.

Re: Compositor with nonlocal render texture and partial viewport

Posted: Thu Mar 19, 2009 4:19 pm
by mcspy0312
Hi
I'm using it to do more or less the same thing.
I've updated the patch. With the updated patch, you don't have to create a viewport on the global render texture manually.

Re: Compositor with nonlocal render texture and partial viewport

Posted: Thu Apr 30, 2009 8:24 am
by iloseall
I try use the render to global texture feature in my project.
But I got a question: the compositor cound not work with muilt viewport for Use Global Texture.

So I try to find another way to slove "Light entity's Material use compositor_instance's texture(gbuffer)" .

Re: Compositor with nonlocal render texture and partial view

Posted: Sat May 15, 2010 4:49 pm
by Noman
Most of the features this patch added have been added to ogre in different ways. If we want the partial viewport update feature, it needs to be extracted from this patch. Also, documentation needs to be added.

Is there still a request for that feature?

Re: Compositor with nonlocal render texture and partial view

Posted: Wed Jun 02, 2010 1:04 pm
by Thieum
Yes, It could be useful for me to be able to create several viewports on a compositor target and render compositor passes on each viewport.
The partial viewport feature would also suit me