Page 7 of 8
Re: Deferred Rendering
Posted: Fri Jul 26, 2013 8:05 am
by ent1ty
thanhle wrote:entity, how many light does your irrenderer supports?
Infinite
I saw you on irc yesterday but I was asleep when you were there... I tried porting my irrRenderer to 1.8 but i hit some bug i couldn't figure out so I just gave up. Not sure what changed between the versions that would create rendering glitches. Other than that, porting is just linking with the correct libraries i think, everything should compile out-of-the-box, or the compile errors you'll be getting are very easy to fix.
Re: Deferred Rendering
Posted: Fri Jul 26, 2013 11:30 am
by sudi
thanhle wrote:These looks awesome.
ent1ty and Sudi why don't you guy working together and incorporate this into Irrlicht next release?
Entity?
Re: Deferred Rendering
Posted: Fri Jul 26, 2013 11:38 am
by ent1ty
Talk it over on the irc?
Re: Deferred Rendering
Posted: Fri Jul 26, 2013 11:51 am
by sudi
sure
Re: Deferred Rendering
Posted: Fri Jul 26, 2013 5:58 pm
by ison
That would be great! Irrlicht lacks nice and fast deferred lighting.
I've also tried to port irrRenderer to 1.8 but no success. Lights are rendered but in a weird way.
Also, would it be possible to use deferred lighting as a post process effect, so there would be no need to set special material for each mesh? One could write his own shader for a mesh and then use lighting as a post process effect.
Re: Deferred Rendering
Posted: Sun Jul 28, 2013 8:33 am
by sudi
ison wrote:Also, would it be possible to use deferred lighting as a post process effect, so there would be no need to set special material for each mesh? One could write his own shader for a mesh and then use lighting as a post process effect.
You don't know how deferred lightning works right...
You render the scene in multiple textures. One for the color, one the position of the pixel in 3d space and one for the surface normal. Now you give this to the lights when you render them so they do all the havey work actually.
Re: Deferred Rendering
Posted: Sun Jul 28, 2013 10:48 am
by ison
I know that you need pixel position FBO for deferred lights but currently in irrRenderer you can't specify your own shader for meshes afaik, you have to use the one provided or modify irrRenderer source. Maybe it would be better to pass user defined MRT's to deferred lighting lib, so one could write his own shader and just pass all FBOs to the library.
Re: Deferred Rendering
Posted: Sun Jul 28, 2013 11:00 am
by ent1ty
Yes you can, only you have to make sure you output the data irrRenderer needs to calculate the lighting, in the correct format and order
Re: Deferred Rendering
Posted: Sun Jul 28, 2013 10:45 pm
by ison
Oh, ok, I get it now ;D
good luck with this project, I hope it will be available in next Irrlicht version
Re: Deferred Rendering
Posted: Wed Jul 31, 2013 10:38 pm
by ent1ty
Just a heads-up, irrRenderer is now working for Irrlicht 1.8, you can grab it
here 
(as always, comes with a pre-compiled win32-gcc demo)
Mercurial repo here:
https://bitbucket.org/entity/irrrenderer
Yes, the post processing effects still suck, go google your own
Note: sometimes I get a crash when starting RenderTest, but it seems pretty random. If you do too, please let me know

Re: Deferred Rendering
Posted: Thu Aug 01, 2013 3:59 pm
by mikkis
Hi. Thanks!
Had some problems (but worked these out).
Downloaded irrRenderer.7z, bin/RenderTest.exe crashes every time.
Opened project in VS Express 2012 (irrlicht (trunk) 1.9), made some modifications to code because it didnt compile:
CShaderLibrary.cpp
Code: Select all
line 24:
irr::c8 buff[fileVertex->getSize()];
to
int size = fileVertex->getSize();
irr::c8 *buff = new irr::c8 [size];
line 34:
irr::c8 buff2[filePixel->getSize()];
to
size = filePixel->getSize();
irr::c8 *buff2 = new irr::c8 [size];
and added return 0; to couple of methods, VS compiler required them.
Then debugged some more, it still didnt work.
In CRenderer.cpp, line 149:
Code: Select all
if(enable && !LightMgr->getPostProcessingActive())
{
irr::core::dimension2du dimension= Device->getVideoDriver()->getCurrentRenderTargetSize();
LightMgr->setPostProcessingTextures(Device->getVideoDriver()->addRenderTargetTexture(dimension, "Post-Processing-Tex1"),
Device->getVideoDriver()->addRenderTargetTexture(dimension, "Post-Processing-Tex2"));
LightMgr->setPostProcessingActive(true);
}
this was always false, so it doesnt create RTTs (so crashed).
I changed that line
Code: Select all
if(enable && !LightMgr->getPostProcessingActive())
to
if(enable)
and now it works with irr trunk (1.9).
Re: Deferred Rendering
Posted: Thu Aug 01, 2013 4:25 pm
by ent1ty
Thanks for reporting & providing code(the crash was only due to an uninitialized bool, sometimes it would be false and it would work, other times it would be true and cause a crash), I have updated the link in the original post ^ , it should work in a bit.
As for the missing return statements, I'll have to get a VS express copy and fix it later

Re: Deferred Rendering
Posted: Thu Aug 01, 2013 4:54 pm
by mikkis
Yeah, now it works.
4 methods that need to return value:
Code: Select all
in CTestFramework.cpp:
bool CTestFramework::OnEvent(const SEvent& event)
in CPostProcessingEffectChain.cpp:
irr::u32 irr::video::CPostProcessingEffectChain::attachEffect(irr::video::CPostProcessingEffect* effect)
irr::video::CPostProcessingEffect* irr::video::CPostProcessingEffectChain::createEffect(irr::video::SShaderSource &effectShader, irr::video::IShaderConstantSetCallBack* callback)
irr::video::CPostProcessingEffect* irr::video::CPostProcessingEffectChain::createEffect(irr::video::E_POSTPROCESSING_EFFECT type)
Re: Deferred Rendering
Posted: Thu Aug 07, 2014 7:12 am
by scorpeti
Hi!
I would like to try your work, but the links in the first post are dead. Could you (or someone who has the latest version) update them again please?
Re: Deferred Rendering
Posted: Sat Aug 30, 2014 7:14 pm
by sudi
Hi scorpeti,
I lost my source and shaders as well. But i have a collection of releases someone else collected. I updated the first post.
Kindly packaged by someone else (collection of releases, no idea whats in there actually)