Modified Deferred Rendering Engine (Proof of concept)

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 1

Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi » Sat Jun 13, 2015 11:26 pm

About a year ago I tried out Ogre3ds deferred rendering pipleline to get better lighting in a hobby project I was working on.
But I noticed multiple things missing it the pipeline, ie pointlight-shadows, shadow filtering, glowmaps, specular maps, antialiasing, light-power, cube mapping, transperancy, shadow-transperancy, optimised dierctionl shadows, etc.
Which it is understandable, considering one had to reimplement to entire Ogre3d Material System with deferred shading materials.
But since I needed some of the functions I put them in and created a custom version of the Deferred Shading Pipeline and implemented the following functions: pointlight-shadows, shadow filtering, glowmaps, specular maps, spotlight texture projection, light-power, cube mapping, a settings file in CaveEngine/Media/DeferredShadingMedia/deferred.cfg,transperancy (1,0, no alpha) and shadow-transperancy and tested it with a little sceneloader and Scenes I made in ogitor.
But it still has a lot of problems, namely bad linux pwerfomance, being based on dead Nvidia technology (cg), IMO bad code thats bad on bitshifting codes for Material names, no directx support, confusing code and not many settings.
So I will probably start from scrach again and use better source and glsls and hsls shader code, where I'll also put much more features.
This post is mainly hear to show of my prebuilt demo for the current code for deferred shading.
Also I didn’t take me a year to make it. I had a lot of school stuff I had to work on and there were entire months were I did nothing.
All in all It took me a few weeks to put this together at max. Sorry that it took so long, there was a lot of other stuff I had to do.
So heres a few screenshots:
Image
Image
Image
Image
Image
Image
And heres the binarys:
Windows:
https://mega.co.nz/#!XUEmwaDD!gkCG_oAO6 ... xc3NkauU70
Linux:
https://mega.co.nz/#!fAMmSb5J!TbyO3huLa ... GpisU-atjs
Source:
https://mega.co.nz/#!SJ8GDLzR!PsycxOQOH ... s9Le2-4yK4
Please give me feedback on what to put in the from-scratch version. When I'll post that one, there will be proper documenation and a better demo.

Btw, you can play around with the cfg file in Media/deferredshading/deferred.cfg to change shadow resolution and sampling rate, but sam plinjg ruins the framerate
0 x

nickG
Greenskin
Posts: 122
Joined: Fri Jan 20, 2012 6:44 pm
Location: Russia,Moscow

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by nickG » Tue Jun 16, 2015 4:11 pm

i7 4790k,GTX970,16GB works is normal(Win7)
except crash on exit and some shader compiling errors(not DS shaders)
0 x

white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 1

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi » Wed Jun 17, 2015 9:02 am

yeah, its just to show off whats possible, I would not recommend using it until I made the actual release, the current code has plent of problems, but I'm happy to see that it works.
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by frostbyte » Thu Jun 18, 2015 4:22 am

hi, thats looking great...(-:
if you consider a from-scratch version then you might consider coding it with HLMS system that was ported back to 1.10
HLMS 1.10 backport is already merged, just need to wait for samples( PBS ) and backport docs to merge-in
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 1

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi » Thu Jun 18, 2015 7:46 am

Good Idea, I'll look into it
0 x

User avatar
Zonder
Ogre Magi
Posts: 1129
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 21

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Zonder » Thu Jun 18, 2015 7:58 am

Yeah coding it for HLMS would be a good idea as it should just more or less work in 2.0.

And nice work! :)
0 x
There are 10 types of people in the world: Those who understand binary, and those who don't...

white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 1

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi » Thu Jun 18, 2015 8:12 am

Is there a tutorial or a doc of HLMS? I didn't find one
thx
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by frostbyte » Thu Jun 18, 2015 8:53 am

porting doc for 2.0 includes an HLMS section( the other sections are mostly about refactorings which will not be backported to 1.10 )
its located in ogre-bitbucket 2.1 branch under ../docs/2.0/*porting_manual_draft..
https://bitbucket.org/sinbad/ogre/src/4 ... dt?at=v2-1
also much information is spread on the ogre2.x forum thread...( basically just type 'hlms' on the google search bar... )

you can also take a look at 2.1 hlms implementations of PBS/unlit/forward+ and play with the code a bit...
i dont know much on the state of 1_10 backport, but iv'e read some folks already started using it( porting forward+ to 1_10 )
so i think it should be similiar if not the same...
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 1

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi » Thu Jun 18, 2015 10:32 am

thx, it seams interesting.
0 x

Lax
Gnome
Posts: 364
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax » Fri Feb 12, 2016 8:57 pm

Hi white_waluigi,

I tested your deferred shading demo. It looks amazing!

I'm trying to integrate your logic in my code. But I'm always getting the following exception: Named constants have not been initialised...

I debugged into the code and the exception comes from GBufferMaterialGenerator.cpp when trying to set auto named constants:

Code: Select all

const GpuProgramParametersSharedPtr& params = ptrProgram->getDefaultParameters();
params->setNamedAutoConstant("cSpecularity", GpuProgramParameters::ACT_SURFACE_SHININESS);
 if (numTextures == 0 || permutation & GBufferMaterialGenerator::GBP_HAS_DIFFUSE_COLOUR)
{
     params->setNamedAutoConstant("cDiffuseColour", GpuProgramParameters::ACT_SURFACE_DIFFUSE_COLOUR);
}
Obviously the constants "cSpecularity" and "cDiffuseColour" are not set in a shader program, because I searched in all your shaders.

Could you please help me with this?

Regards
Lax
0 x

Lax
Gnome
Posts: 364
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax » Sun Feb 14, 2016 1:58 pm

It seems that It has something todo with the version of the Plugin_CgProgramManager.dll since yours is different from mine. I'm using Ogre1.9 unstable version (the newest precompiled available).
When I use the profiles from your code e.g.:

Code: Select all

if (mIsSm4)
{
	ptrProgram->setParameter("profiles", "vs_4_0");
}
else
{
	ptrProgram->setParameter("profiles", "vs_5_0 vp40");
}
I get the errors with the named constants during generation of the vertex shader in GBufferMaterialGenerator class.

Code: Select all

 params->setNamedAutoConstant("cWorldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
 params->setNamedAutoConstant("cWorldView", GpuProgramParameters::ACT_WORLDVIEW_MATRIX);
When I switch back to the profiles of the original deferred shading Ogre example. This works but I get errors during generation of the fragment shader in the same class, when trying to set named constants:

Code: Select all

const GpuProgramParametersSharedPtr& params = ptrProgram->getDefaultParameters();
params->setNamedAutoConstant("cSpecularity", GpuProgramParameters::ACT_SURFACE_SHININESS);
if (numTextures == 0 || permutation & GBufferMaterialGenerator::GBP_HAS_DIFFUSE_COLOUR)
{
     params->setNamedAutoConstant("cDiffuseColour", GpuProgramParameters::ACT_SURFACE_DIFFUSE_COLOUR);
}

Code: Select all

OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program DeferredShading/GBuffer/FP_2353: The compile returned an error.
(0) : error C6015: Output 'COLOR2' not completely written
 in CgProgram::compileMicrocode at ..\..\..\..\..\PlugIns\CgProgramManager\src\OgreCgProgramManagerDll.cpp (line 67)
13:46:50: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1627)
Which ogre version are you using?

Maybe this topic is to complicated and maybe I should keep my hands off this issue...

But I had the hope, to have each possible shader scenario covered (shadows, normal mapping, ssao, etc.).
0 x

Lax
Gnome
Posts: 364
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax » Sun Feb 14, 2016 5:48 pm

Sorry, if I'm spamming. But I found the issue. The modified deferred shading functionality does only work with OpenGL rendering system!
So the question is, how to get it working with DirectX?
0 x

User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
Contact:

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by tod » Tue Feb 16, 2016 2:58 pm

I think you may get these errors because the shader compiler finds some variables are not used and removes them. Then it throws an error when you try to set that variable.
0 x

Lax
Gnome
Posts: 364
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax » Wed Feb 17, 2016 6:05 pm

compiler finds some variables are not used and removes them
Oh, why would the compiler do such a thing?
How to prevent, that the variables are removed?
0 x

white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 1

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi » Tue May 17, 2016 9:47 pm

Sorry for responding so late, Directx was never implemented, and since I'm working on the HLMS implementation of it.
Please do not use this code for anything but experimentation
0 x

Lax
Gnome
Posts: 364
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax » Sat May 21, 2016 8:35 pm

Oh cool, so I will wait and in future get my hands on Ogre 2.1 and then try out your deffered rendering engine again.
0 x

white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 1

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi » Sun May 22, 2016 4:44 pm

That would prbably be a good idea, since that ones actually integrate into Ogre, the old implementation was really more of a hack.
Hope I get it into beta this year.
Ill keep updateing the HLMS_DS Demo thread, so keep an eye on that, I'll update it as soon as I got some new features and fixes into it.
0 x

Post Reply