[Solved] Downsampling compositor...

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Zeal
Ogre Magi
Posts: 1260
Joined: Mon Aug 07, 2006 6:16 am
Location: Colorado Springs, CO USA

[Solved] Downsampling compositor...

Post by Zeal » Tue Jul 29, 2008 12:07 pm

There are many cases where you need to downsample your scene in order to apply some post process effect (bloom) ect... My question is, with the compositor framework, is there anyway to specify a downsample texture resolution based on the current fullscreen resolution?

For example, if my game is running at 1024x768, and I want to do a 50% downsample to 512x384, there is no way for me to specify any variable resolutions inside the compositor. It seems like I have to set a static 256x256 ect, which may look fine for some resolutions, but not others.

How can I do a dynamic resolution downsample with the compositor framework?
Last edited by Zeal on Tue Jul 29, 2008 4:26 pm, edited 1 time in total.
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 » Tue Jul 29, 2008 4:10 pm

Implemented already in Shoggoth. As well as 'target_width' and 'target_height' you can use 'target_width_scaled <factor>' etc.

In Eihort, build your compositors in code instead of script to do it.
0 x

User avatar
Zeal
Ogre Magi
Posts: 1260
Joined: Mon Aug 07, 2006 6:16 am
Location: Colorado Springs, CO USA

Post by Zeal » Tue Jul 29, 2008 4:26 pm

Damn I am just full of good ideas people have already thought of
0 x

lXciD
Greenskin
Posts: 102
Joined: Mon Jul 31, 2006 7:56 pm
Location: Singapore
Contact:

Post by lXciD » Mon Sep 22, 2008 8:00 am

Code: Select all

void BloomCompositorListener::notifyCompositor( Ogre::CompositorInstance * instance )
        {
            CompositorListener::notifyCompositor( instance );

            // Get some RTT dimensions for later calculations
            Ogre::CompositionTechnique::TextureDefinitionIterator defIter = instance->getTechnique()->getTextureDefinitionIterator();

            while ( defIter.hasMoreElements() )
            {
                Ogre::CompositionTechnique::TextureDefinition * def = defIter.getNext();

                if ( def->name == TTEXT("renderTarget1") || def->name == TTEXT("renderTarget2") )
                {
                    def->width = mVpWidth / 2;
                    def->height = mVpHeight / 2;
                }
            }
        }
This is how I downsample my render target by code.

do note that notifyCompositor is a custom function of my own.
0 x

Post Reply