Page 1 of 2

Render to Texture performance

Posted: Sat Jan 09, 2016 1:13 am
by The_Glitch
I've tracked down a huge frame rate drop I've been having in my project to using render to texture effects. I also did a further test and did regular rendering in my project no rtt effects at all and frame rate stays solid. I've read a old thread from 2014 about someone having similar issues and there were a lot of proposed changes for irrlicht were they ever made?



http://irrlicht.sourceforge.net/forum/v ... =4&t=49634

Re: Render to Texture performance

Posted: Sat Jan 09, 2016 9:02 am
by Nadro
In trunk or shader-pipeline? In trunk you should use new setRenderTargetEx.

Re: Render to Texture performance

Posted: Sat Jan 09, 2016 5:35 pm
by The_Glitch
[url]svn://svn.code.sf.net/p/irrlicht/code/branches/shader-pipeline[/url]

Is this the latest shader-pipeline? If so I have this one, if not then link please.

Re: Render to Texture performance

Posted: Sat Jan 09, 2016 5:42 pm
by The_Glitch
Nadro I don't think I have the one that has latest changes did you make changes to shader-pipeline? In svn tortoise is says your latest changes are from at least mid to early 2015?????


Also an trunk example I checked render to texture example and I saw these changes

Code: Select all

driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0));
 

Mine does not have these.

Re: Render to Texture performance

Posted: Sat Jan 09, 2016 7:06 pm
by hendu
I'm not saying there isn't an issue with irr, but that old thread had none. It was about wrong expectations, hw and sw performed as they should.

Re: Render to Texture performance

Posted: Sat Jan 09, 2016 7:45 pm
by The_Glitch
I think my version of irrlicht doesn't reflect the newest changes. Also hendu I did a test and did not use any of my shaders and did a simple rtt and aplid it to a screenquad and assigned an EMT_SOLID material to it for testing purposes and my app starts at 60 fps with vsync and a few seconds into the application it drops to 40 and never recovers.

If I disable rtt and just use default rendering it never happens stays at 60fps.

Re: Render to Texture performance

Posted: Sat Jan 09, 2016 11:23 pm
by Nadro
Hi,

setRenderTargetEx is available only in trunk, I'll update shader-pipeline when v1.9 will be finished (it's really close).

Cheers,

Re: Render to Texture performance

Posted: Sun Jan 10, 2016 9:56 am
by hendu
Vsynced numbers are not useful. They don't tell you if the real perf is 60 or something more - if it was 60, then a RTT switch can easily drop it to 59, which in a vsynced display means 40.

Re: Render to Texture performance

Posted: Sun Jan 10, 2016 11:30 pm
by The_Glitch
I reduced my rtt buffers to just 4 and frame rate is solid. I just need to figure a way for decent blur without adding more rtt buffers.

Re: Render to Texture performance

Posted: Wed Jan 13, 2016 4:54 pm
by Mel
You can chain effects most of the times using just 2 rendertargets. One holds the results of the last operation, while the other is used to render the next operation, then, swap. Also, downsampling helps. Using a rendertarget half of the dimensions of the original rendertarget is almost unnoticeable, and produces good results when blurring.

Re: Render to Texture performance

Posted: Wed Jan 13, 2016 9:55 pm
by The_Glitch
How can I make the rendertargets swap when I tried one just overwrites the other.

Code: Select all

 
 
driver->setRenderTarget(blur3, true, true, video::SColor(0, 0, 0, 0));
 
            quad->getMaterial(0).MaterialType = ((video::E_MATERIAL_TYPE)blur_shaderH);
            quad->getMaterial(0).setTexture(0, extracted_scene);
            quad->setMaterialFlag(EMF_TRILINEAR_FILTER, true);
            quad->render();
 
            driver->setRenderTarget(0, true, true, 0);
 
            driver->setRenderTarget(blur4, true, true, video::SColor(0, 0, 0, 0));
 
            quad->getMaterial(0).MaterialType = ((video::E_MATERIAL_TYPE)blur_shaderV);
            quad->getMaterial(0).setTexture(0, blur3);
            quad->setMaterialFlag(EMF_TRILINEAR_FILTER, true);
            quad->render();
 
            driver->setRenderTarget(0, true, true, 0);
 
 

Re: Render to Texture performance

Posted: Thu Jan 14, 2016 10:28 am
by hendu
You are doing pointless clears there, and the switch back to framebuffer before switching to a RTT is costing you performance too.

Is that my quad? In that case, render() draws to the framebuffer, not the RTT - you should use render(rtt), no need to switch to it yourself.

Re: Render to Texture performance

Posted: Thu Jan 14, 2016 5:26 pm
by The_Glitch
Thanks hendu reduced the clears to just one. Also what do you mean with the render()?? Do you mean quad->render()??

Re: Render to Texture performance

Posted: Thu Jan 14, 2016 7:49 pm
by hendu
Yes.

Re: Render to Texture performance

Posted: Thu Jan 21, 2016 9:03 pm
by devsh
One of the problems with irrlicht is that there is no MRT object, so an FBO is made for each render target texture instead, and that is mutated to attach other textures as outputs 1 and onwards. This is really slow in some drivers according to Valve and Intel