MRTs, which depth is used?

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!

MRTs, which depth is used?

Postby hendu » Wed Jun 27, 2012 1:05 pm

When drawing to multiple render targets, which depth buffer is used? Both for drawing, and for checking?

From cursory reading of the irr GL driver code, it would appear that no depth is used at all with MRT's. Is this so?
hendu
 
Posts: 1552
Joined: Sat Dec 18, 2010 12:53 pm

Re: MRTs, which depth is used?

Postby CuteAlien » Wed Jun 27, 2012 2:23 pm

In COpenGLDriver::addRenderTargetTexture you find the line:
cpp Code: Select all
 
 success = static_cast<video::COpenGLFBODepthTexture*>(tex)->attach(rtt);
 


That attaches a depth-buffer it seems. And creation is in COpenGLTexture COpenGLFBODepthTexture::COpenGLFBODepthTexture.
Not sure which parameters are used in there in your case, maybe step through once.
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5349
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: MRTs, which depth is used?

Postby Mel » Wed Jun 27, 2012 3:57 pm

I think he means which depth is used to perform the ZBuffering when MRTs are used.

Say for instance you have 4 projection matrices, and you use each to perform a render to each rendertarget, which Z value is used? or can be used all of them, or... ? i had the same doubt myself
http://santiagong.daportfolio.com/
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 1783
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: MRTs, which depth is used?

Postby hendu » Wed Jun 27, 2012 4:00 pm

@CuteAlien

Yep, that attaches a depth texture to that RTT. But when setting multiple RTTs, it seems only the color textures are attached:

GL_COLOR_ATTACHMENT0_EXT+i

There is no mention at all of GL_DEPTH_ATTACHMENT. I get a huge fps drop now when drawing to MRTs vs the screen, so it does look like there's no depth used at all.


@Mel

Indeed. Quick reading of the GL docs suggests that only one depth buffer can be attached at any time. It also seems that irrlicht attaches none when using MRTs.
hendu
 
Posts: 1552
Joined: Sat Dec 18, 2010 12:53 pm

Re: MRTs, which depth is used?

Postby hendu » Wed Jun 27, 2012 5:03 pm

Diving deeper, it seems the first FBO RTT's depth is the one that is used.
hendu
 
Posts: 1552
Joined: Sat Dec 18, 2010 12:53 pm

Re: MRTs, which depth is used?

Postby hybrid » Wed Jun 27, 2012 5:12 pm

I would have thought so too, as all the settings are used from the first FBO, unless they can be specified per target. And all RTTs have a depth buffer in Irrlicht (so far).
hybrid
Admin
 
Posts: 13943
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany


Return to Advanced Help

Who is online

Users browsing this forum: No registered users and 1 guest