Creating multiple render passes?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
darksmaster923
Posts: 51
Joined: Tue Jan 02, 2007 11:04 pm
Location: huntington beach

Creating multiple render passes?

Post by darksmaster923 »

Hey guys, I'm trying to implement a bloom shader, but in order to do that I need to do multiple passes. I have the screenquad set up properly and can do basic postprocessing, its just the multiple passes thing I'm confused with. Can anyone help walk me through setting up multiple passes in irrlicht?
Programmers are merely tools to convert caffeine into code.
vivekSivamRP
Posts: 66
Joined: Sat Sep 29, 2012 11:58 am

Re: Creating multiple render passes?

Post by vivekSivamRP »

smgr->beginscene();

// Pass 1
setRenderTarget(textureName); // renders the output of first pass to the texture rather than in Frame Buffrer . optional
set the 1st pass shader material to the node
smgr->drawAll();

// Pass 2
set the 2nd pass shader material to nodes
smgr->drawAll();

// you can continue this to multiple passes
...
smgr->endScene();
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Creating multiple render passes?

Post by mongoose7 »

Create texture
Set texture as render target
Render all
Set render target to frame buffer (null) - releases render target texture
Texture a quad with the texture you rendered to while applying effects
darksmaster923
Posts: 51
Joined: Tue Jan 02, 2007 11:04 pm
Location: huntington beach

Re: Creating multiple render passes?

Post by darksmaster923 »

vivekSivamRP wrote:smgr->beginscene();

// Pass 1
setRenderTarget(textureName); // renders the output of first pass to the texture rather than in Frame Buffrer . optional
set the 1st pass shader material to the node
smgr->drawAll();

// Pass 2
set the 2nd pass shader material to nodes
smgr->drawAll();

// you can continue this to multiple passes
...
smgr->endScene();
Thanks for this, this looks very useful. However, how would I have the second pass only apply its effects to the first render pass so I could merge them with the original scene?
Programmers are merely tools to convert caffeine into code.
vivekSivamRP
Posts: 66
Joined: Sat Sep 29, 2012 11:58 am

Re: Creating multiple render passes?

Post by vivekSivamRP »

Effect/Output of the first pass would be rendered in the texture1(u set as a renderTarget).
Pass the texture1 to the second pass shaders and merge it as u needed.

irrlicht's xEffects has multiple pass examples.
darksmaster923
Posts: 51
Joined: Tue Jan 02, 2007 11:04 pm
Location: huntington beach

Re: Creating multiple render passes?

Post by darksmaster923 »

Hmm, I think I'm having a separate issue with my screenquad which is preventing me from getting the effect that I want. If I overload the OnRegisterSceneNode function, some scene nodes are no longer visible on the screen.
Programmers are merely tools to convert caffeine into code.
Post Reply