Deferred Rendering

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Do you think this is usefull and needs further improvements

Yes
85
91%
No
0
No votes
I really don't care
8
9%
 
Total votes : 93

Deferred Rendering

Postby Sudi » Mon Mar 22, 2010 5:45 pm

Ok this is the first beta release.

Download (mingw32 and visualstudio)

Source Download

Features:
    -OpenGL only (dunno if that is really a feature ;) )
    -Pointlights
    -Spotlights (with soft shadowmapping(VSM) also transparent objects cast shadows)
    -Directionallights


when u want to use it copy the dll and the shader to your executeable.
and ofcourse link the lib and add the include file.

then just call once
Code: Select all
irr::deferred::initDeferredRendering(SceneManager);

and when everything is done
Code: Select all
irr::deferred::deinitDeferredRendering();


example code:
Code: Select all
#include <irrlicht.h>
#include "IrrlichtDeferredRendering.h"

using namespace irr;

///this is used for the particle lights
class particleLights : public irr::scene::IParticleAffector
{
public:
    particleLights(irr::scene::ISceneManager* smgr);
    ~particleLights(void);
    irr::scene::E_PARTICLE_AFFECTOR_TYPE getType() const;
    void affect(irr::u32 now, irr::scene::SParticle* particlearray, irr::u32 count);
    irr::core::array<irr::scene::ILightSceneNode*> Lights;
    irr::scene::ISceneManager* SceneManager;
};

int main(int argc, char** argv)
{
   IrrlichtDevice* device = createDevice(irr::video::EDT_OPENGL, core::dimension2d<u32>(640, 480));

   if (device == 0)
      return 1; // could not create selected driver.

   device->setWindowCaption(L"Load .irr file example");

   video::IVideoDriver* driver = device->getVideoDriver();
   scene::ISceneManager* smgr = device->getSceneManager();

   smgr->loadScene("../../media/example.irr");

   scene::ICameraSceneNode * camera = smgr->addCameraSceneNodeFPS(0, 50.f, 0.1f);

   camera->setPosition(core::vector3df(0.f, 20.f, 0.f));


    ///Special code starts here
   ///Activate deferred rendering
   irr::deferred::initDeferredRendering(smgr);
   ///activate lightning for particles
   irr::scene::IParticleSystemSceneNode* particle = (irr::scene::IParticleSystemSceneNode*)smgr->getSceneNodeFromType(irr::scene::ESNT_PARTICLE_SYSTEM);
    if (particle)
    {
        particle->addAffector(new particleLights(smgr));
        particle->setParticlesAreGlobal(true);
    }
    ///and ends here

   int lastFPS = -1;

   while(device->run())
   if (device->isWindowActive())
   {
      driver->beginScene(true, true, video::SColor(0,200,200,200));
      smgr->drawAll();
      driver->endScene();

      int fps = driver->getFPS();

      if (lastFPS != fps)
      {
         core::stringw str = L"Load Irrlicht File example - Irrlicht Engine [";
         str += driver->getName();
         str += "] FPS:";
         str += fps;

         device->setWindowCaption(str.c_str());
         lastFPS = fps;
      }

   }

   device->drop();

       irr::deferred::deinitDeferredRendering();

   return 0;
}

///affector implementation

particleLights::particleLights(irr::scene::ISceneManager* smgr) : SceneManager(smgr)
{
    for (irr::u32 i=0; i<200; i++)
    {
        Lights.push_back(SceneManager->addLightSceneNode(NULL, irr::core::vector3df(0,0,0), irr::video::SColor(0,0,0,0)));
        Lights[Lights.size()-1]->setVisible(false);
    }
}
particleLights::~particleLights(void)
{
    for (irr::u32 i=0; i<Lights.size(); i++)
    {
        Lights[i]->remove();
    }
}
irr::scene::E_PARTICLE_AFFECTOR_TYPE particleLights::getType() const
{
    return irr::scene::EPAT_NONE;
}
void particleLights::affect(irr::u32 now, irr::scene::SParticle* particlearray, irr::u32 count)
{
    //printf("Particle count: %i\n", count);
    for (irr::u32 i=0; i<Lights.size(); i++)
    {
        if (i < count)
        {
            irr::video::SLight data;
            data.DiffuseColor = particlearray[i].color;
            data.Radius = particlearray[i].size.Width*2;
            Lights[i]->setLightData(data);
            Lights[i]->setPosition(particlearray[i].pos);
            Lights[i]->setVisible(true);
        }
        else
        {
            Lights[i]->setVisible(false);
        }
    }
}

picture(note this image doesn't use the standard irr file. i adjusted ambient lightning, particle textures and the radius of the big light so it looks better):
Image[/list]
Last edited by Sudi on Tue Dec 28, 2010 2:23 pm, edited 17 times in total.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby shadowslair » Mon Mar 22, 2010 7:39 pm

Lol! The screenshot is a killer, but what I get strating the binary is not even close- before compiling the shaders I get a "unsupported texture format" thingy and I get some flat per-vertex lighted scene. Well, using crappy ATI 9550...

Ah, and hell YES! I wanna see more of this!!! :wink:
Image
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
User avatar
shadowslair
 
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Postby Sudi » Mon Mar 22, 2010 10:25 pm

shadowslair wrote:Lol! The screenshot is a killer, but what I get strating the binary is not even close- before compiling the shaders I get a "unsupported texture format" thingy and I get some flat per-vertex lighted scene. Well, using crappy ATI 9550...

Ah, and hell YES! I wanna see more of this!!! :wink:


Indeed it looks crazy with the standard example.irr change to lightradius in the irrFile to 100 or something like that. it will look way better.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby Sudi » Tue Mar 23, 2010 3:20 am

update:
-now spotlights are avaible and working
-started working on transparent refraction

stuff to come:
-shadow maps
-automatic normal/parallax mapping
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby ent1ty » Tue Mar 23, 2010 2:00 pm

Ok, I'm not very familiar with all the technologies used in games, so maybe, tell us what are the advantages/disadvantages of using this lighting instead of the irrlicht's default.

Oh, and what do you mean by "automatic normal/parallax mapping"? something like
IMeshSceneNode* mNode= smgr->addMeshSceneNode(blah blah);
mNode->makeParallaxMappingFromHeightMap("heightmap.bmp");
?

Also, I think, maybe it could be later added to base Irrlicht?
Height2Normal - convert height maps to normal maps

Code with brain, not heart.
- entity, a proud member of the Heartless Coders society
ent1ty
 
Posts: 925
Joined: Sun Nov 08, 2009 11:09 am

Postby Sudi » Tue Mar 23, 2010 3:37 pm

ent1ty wrote:Ok, I'm not very familiar with all the technologies used in games, so maybe, tell us what are the advantages/disadvantages of using this lighting instead of the irrlicht's default.

Visual quality? u can have an unlimited ammount of lights contributing to the same scenenode. normal irrlicht rendering is forward rendering which only supports 8 active lights with vertex lightning. the normal_map material is ofcourse per pixel but at max again 8 lights. irrlicht automaticly chooses to activate the 8 closests lights to the camera. The included lightmanager example shows how you can change this behaviour with for example 8 closest lights to scenenode or areas. but all this only works for small objects. Something like the picture i posted is impossible with forward rendering without taking a major performance hit. in that case you would have to draw the mesh for every light. My example scene has more than 200 lights so you would have to draw everything 200times.

ent1ty wrote:Oh, and what do you mean by "automatic normal/parallax mapping"? something like
IMeshSceneNode* mNode= smgr->addMeshSceneNode(blah blah);
mNode->makeParallaxMappingFromHeightMap("heightmap.bmp");
?

Also, I think, maybe it could be later added to base Irrlicht?


well obviusly i am not using the standard irrlicht materialtype behaviour. right now only solid, transparent and transparent_add are fully supported.
Next i will add normalmap/parallax reading for solids so it will support normal/parallax mapping without using tangent meshes. maybe automatic was the wrong word.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby ent1ty » Tue Mar 23, 2010 4:52 pm

Ok, thanks.
Height2Normal - convert height maps to normal maps

Code with brain, not heart.
- entity, a proud member of the Heartless Coders society
ent1ty
 
Posts: 925
Joined: Sun Nov 08, 2009 11:09 am

Postby devsh » Tue Mar 23, 2010 8:04 pm

I'm only curious how you fitted 200 lights in your shader (i could only put 110 something because i supported diffuse, specular, spot lights etc.)

My lightning was done in world space and Shadow Mapping too (Deffered Cascaded Variance Shadow Maps)

Image Which gives a pretty cool effect

Here you can see mindless lightning
http://www.youtube.com/watch?v=3-r88vbo-LE
Portfolio (WIP) and Development Blog:
http://indirectlightandmagic.tumblr.com/

Do you want to hire a GLSL graphics programmer cheaply???
Try me!
http://indirectlightandmagic.tumblr.com/contact
User avatar
devsh
Competition winner
 
Posts: 1302
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Postby Sudi » Tue Mar 23, 2010 8:09 pm

devsh wrote:I'm only curious how you fitted 200 lights in your shader (i could only put 110 something because i supported diffuse, specular, spot lights etc.)

My lightning was done in world space and Shadow Mapping too (Deffered Cascaded Variance Shadow Maps)


huh? i didn't fit any light in a shader...
Paper
Edit: basicly unlimited ammount of dynamic lights.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby Sudi » Wed Mar 24, 2010 2:13 am

Update added shadowmaps.
Image

download is also in first post
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby Kalango » Wed Mar 24, 2010 3:50 am

Good stuff...
Maybe the devs should start thinking put things like this in the next release... since a big amount of people dont want to "get too serious" with shaders and such...
Its not my case tho |:)
Kalango
 
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

Postby pippy3 » Wed Mar 24, 2010 4:32 am

Kalango wrote:Good stuff...
Maybe the devs should start thinking put things like this in the next release... since a big amount of people dont want to "get too serious" with shaders and such...
Its not my case tho |:)


this

I'd love for irrlicht to have a smarter lighting system by default
pippy3
 
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Postby Sudi » Wed Mar 24, 2010 6:53 pm

ok i think i got it. only problem is my laptop is not fast enough for shadows :wink:
Image
Image
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby Sudi » Wed Mar 24, 2010 10:27 pm

ok update uploaded the last posted pictures can now be made with the new version. next thing will be directional shadowmapping and then normalmapping.

Download
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
User avatar
Sudi
 
Posts: 1600
Joined: Fri Aug 26, 2005 8:38 pm

Postby etal2009 » Thu Mar 25, 2010 1:21 am

Will you be adding support for win32-visual studio, linux, and macosx?
etal2009
 
Posts: 16
Joined: Wed Mar 10, 2010 2:26 pm

Next

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest