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 10

Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi »

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
nickG
Greenskin
Posts: 122
Joined: Fri Jan 20, 2012 6:44 pm
Location: Russia,Moscow
x 1

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by nickG »

i7 4790k,GTX970,16GB works is normal(Win7)
except crash on exit and some shader compiling errors(not DS shaders)
white_waluigi
Goblin
Posts: 253
Joined: Sat Sep 28, 2013 3:46 pm
x 10

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi »

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.
frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 65

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by frostbyte »

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
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 10

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi »

Good Idea, I'll look into it
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Zonder »

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

And nice work! :)
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 10

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi »

Is there a tutorial or a doc of HLMS? I didn't find one
thx
frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 65

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by frostbyte »

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...
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 10

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi »

thx, it seams interesting.
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax »

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

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax »

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.).

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax »

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?

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

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

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by tod »

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.
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax »

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?

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

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

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi »

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
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by Lax »

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.

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

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

Re: Modified Deferred Rendering Engine (Proof of concept)

Post by white_waluigi »

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.
Post Reply