Deferred Rendering

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

Do you think this is usefull and needs further improvements

Yes
99
93%
No
0
No votes
I really don't care
8
7%
 
Total votes: 107

sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Deferred Rendering

Post by sudi »

Ok this is the first beta release.

Download (mingw32 and visualstudio) (offline :( )

Source Download (offline :( )

Kindly packaged by someone else (collection of releases, no idea whats in there actually)

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 Sat Aug 30, 2014 7:14 pm, edited 18 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.
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

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:
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

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?
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Ok, thanks.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

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
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
Kalango
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

Post by Kalango »

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 |:)
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

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
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
etal2009
Posts: 16
Joined: Wed Mar 10, 2010 2:26 pm

Post by etal2009 »

Will you be adding support for win32-visual studio, linux, and macosx?
Post Reply