[SOLVED]Post processing shader help

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
LovehinaX
Posts: 7
Joined: Wed Nov 08, 2006 12:38 pm

[SOLVED]Post processing shader help

Post by LovehinaX »

I’ve just started experimenting with post processing shaders in IRRLicht, and although there is no tutorial on this, I’ve somehow managed to figure it out...
Now I know how to RTT and then display the texture as a quad (in my case I’m just using driver->draw2DImage), but this is not the issue.
I have two problems.
First, there is no way to set the size of the quad in the texture that RTT is drawing to. Ex. lets say that I have a 512x512 texture, but I only want RTT to draw to a portion of that texture, let’s say 512x384.
My second issue is that IRRLicht won’t let me set a RTT texture bigger than the current resolution. So if my resolution is 800x600, I can’t use a bigger texture than 512x512.

I hope that someone can help me with this. Thanks in advance!
Last edited by LovehinaX on Tue Dec 19, 2006 10:55 am, edited 1 time in total.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

First, there is no way to set the size of the quad in the texture that RTT is drawing to. Ex. lets say that I have a 512x512 texture, but I only want RTT to draw to a portion of that texture, let’s say 512x384.
You should be able to use a viewport for that. Something like this...

Code: Select all

videoDriver->setRenderTarget(rttTexture);

const core::rect<s32> vp = videoDriver->getViewPort();
videoDriver->setViewPort(core::rect<s32>(0, 0, 512, 384));

// render stuff

videoDriver->setViewPort(vp);
videoDriver->setRenderTarget(0);
My second issue is that IRRLicht won’t let me set a RTT texture bigger than the current resolution. So if my resolution is 800x600, I can’t use a bigger texture than 512x512.
I don't know why this restriction is in place. I've seen the code in the CDirect3D9Driver::setRenderTarget() method, but I'm not sure why it is there.

Travis
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The limitation is due to restrictions in D3D and OpenGL. You can use frame buffer objects (new in Irrlicht 1.2) for OpenGL. They support arbitrary render target dimensions.
LovehinaX
Posts: 7
Joined: Wed Nov 08, 2006 12:38 pm

Post by LovehinaX »

Thanks, that solves the problem for me... :) It looks like Il have to look into OpenGL a bit more...

Thanks again to both of you... ;)
Post Reply