Page 1 of 1

How to get render image and modify it before displaying

Posted: Sun May 16, 2010 4:41 am
by kazymjir
Hello!

I am interested in how can I get render data, modify it and display on screen in real-time.

Here is little illustration:
Image

I want to get pixels from "image plane", modify them, and send forward to "eye" (monitor).

Where can I find code responsible for that?

Posted: Sun May 16, 2010 5:16 am
by slavik262
You can render your scene to a render target texture, which acts as your "image plane". You can then put it on a quad and run a shader on that quad to modify it as it is sent to the monitor.

Posted: Sun May 16, 2010 5:47 am
by d3jake
I don't mean to sound rude, I'm actually quite intrigued, but for what reason are you interested in doing this?

Posted: Sun May 16, 2010 6:33 am
by kazymjir
Thanks again, Slavik!

D3Jake, I am thinking about to do some post-processing effects, something like in Compositor from Ogre.

Posted: Sun May 16, 2010 6:56 am
by slavik262
For some great examples take a look at the code for XEffects, a post-processing library BlindSide put together.

Posted: Sun May 16, 2010 7:16 am
by akaz
Thanks, I will take a look for XEffects.

I have one more question, how can I manipulate ITexture, pixel by pixel?
I founded this: http://www.irrlicht3d.org/wiki/index.ph ... alChapter3, but I don't know how to put updated data on void buf to ITexture t.

EDIT: aek here, i forgot that on second machine i have in cookies my old acc


EDIT2: Oh, it's pointer. Sorry, I have not sleep for 36 hours and miss that it is pointer

Posted: Sun May 16, 2010 10:44 am
by BlindSide
I would recommend doing the "manipulation" like slavik262 described if it is possible otherwise it will be very very slow. I am sort of interested also in what kind of effects you want to perform.

Posted: Sun May 16, 2010 11:42 am
by kazymjir
I'll try this method with RTT.

I have on mind some interesting effects, but for now I don't want to say anything, it will be suprise for next Bored Programmer movie, if I succeed in coding this

Posted: Sun May 16, 2010 1:57 pm
by slavik262
Like BlindSide said, use a shader to manipulate your texture. Otherwise the modification will happen on the CPU and be really slow.

Posted: Mon May 17, 2010 1:43 am
by kazymjir
Thanks, you have right.
I'll read some about shaders and try it.