Lighting manager - normal & specular mapped with shadows

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

stefbuet wrote:The performance drop is due to shadow use.
I got 80FPS with this demo shadows on, 600FPS without shadows.
1 point light shadow = 6 x spot light shadow.
That's why I'll use 1 shadow light and all others wont cast shadows.
I would use your defered renderer if it had point lights & normal mapping but I didn't see that, and I don't want to spend my vacacion time only on the lighting system, need to work on the game too.
1 point light shadow = 2 paraboloid renders ;)

http://citeseerx.ist.psu.edu/viewdoc/do ... 1&type=pdf

Deferred rendering is much easier than what it looks. Give it a shot when you have time, it is really worth, the only drawback i see to it is that it is raster dependant.

Could you, please, use EasyShare instead? my isp is shared, and megaupload won't allow me to download a single thing... There is ALWAYS someone downloading files 1GB long... :evil:
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

@Tihtinen : I don't know what's wrong :(

@Mel : I uploaded the archive to easyShare.
I also tryed defered lighting. It's cool, and I will stay with it. I made a basic implementation, now I need to build normal mapped lighting. I guess I'll stay more time than exepted on it, but I'll try to learn lot of things then. I'll try to handle transparency, and post process everything with anti aliasing with edge detection, bloom and motion bloor (It'll really take more time than exepted :shock: but well, it's cool).

Now about shadows, I think I'll give a shot too. I understood the standart method with 6 renders, but as we saw it, it's too slow. I've looked at your paper, and it looked hard :D but I'll study it and I hope I'll manage to do something with it, so thank you very much for this tip :wink:
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Dual paraboloids or virtual cubemaps are the way to go.

Dual paraboloids give the best performance but at the expense that you have to tessellate your scene (Because the distortion has to be done in the vertex shader, maybe there is some faster technique using geometry shaders but I haven't heard of such).

This is a fantastic post on getting these running with shadow maps: http://graphicsrunner.blogspot.com/2008 ... pping.html
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
detvog
Posts: 19
Joined: Sun Mar 02, 2008 8:49 am

Lights

Post by detvog »

How many lights can i make with this manager and how can i make this with an amimated mesh ? (model)

sorry, iam new in irrlicht.









sorry for my bad english....
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

You can use as many lights as you want.
To use an animated mesh, you just do it as in the exemple with the simple room. However if you want to use normal mapping, you have to use a tangent mesh, you can obtain one from the original mesh with the mesh manipulator API, see "pixel pixel lighting" Irrlicht tutorial to see how to do that :wink:
detvog
Posts: 19
Joined: Sun Mar 02, 2008 8:49 am

Post by detvog »

Have anyone a little codesnipped how i can make the manager with
an animated player-modell like sydney.md2 ?






sorry for my bad english
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Yep :

Code: Select all


#import "LightingManager.hpp"

//......

void main() {

    //....your code

    IMesh *simpleMesh=smgr->getMesh("sydney.md2");
    IMesh *t_Mesh=smgr->getMeshManipulator()->createMeshWithTangents(simpleMesh);
    IMeshSceneNode *node=smgr->addMeshSceneNode(t_Mesh);
    node->setMaterialTexture(0, driver->getTexture("sydneyTexture.png"));
    node->setMaterialTexture(1, driver->getTexture("normalMapTexture.png"));
    node->setMaterialTexture(2, driver->getTexture("specularMapTexture.png"));
    t_Mesh->drop();

    //create a simple red light
    PhongLight* light=myLightingManager->addPointLight();
    light->setColor(SColor(0,255,0,0));
    light->setPosition(core::vector3df(50,50,50));

    //Add sydney to lighting render, and make it normal mapped, specular mapped
    LightedNode *myNode=myLightingManager->addNodeToLighting(node);
    myNode->setNormalMapUse(true);
    myNode->setSpecularMapUse(true);


    while(device->run()) {

        driver->beginScene(true, true, SColor(0xffffffff));
        myLightingManager->drawLighting();
        driver->endScene(); 

    }

}//end of main function
detvog
Posts: 19
Joined: Sun Mar 02, 2008 8:49 am

Post by detvog »

Thanks.

sydney is a singlemesh. The model is not animated or ?

Can i use a IAnimatedMeshSceneNode?
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Yeah the problem is if you want to use normal mapping with animated mesh because the mesh manipulator can only create tangeant mesh for static mesh. However you can use an animated mesh without normal mapping, specular mapping is Ok.

Just skip the tangeant mesh creation, add the mesh as usual :

Code: Select all

IAnimatedMesh *mesh=smgr->getMesh("sydney.md2");  
    IAnimatedMeshSceneNode *node=smgr->addMeshSceneNode(mesh); 
    node->setMaterialTexture(0, driver->getTexture("sydneyTexture.png")); 
    node->setMaterialTexture(2, driver->getTexture("specularMapTexture.png")); 
  
detvog
Posts: 19
Joined: Sun Mar 02, 2008 8:49 am

Post by detvog »

Yep, the Lightmanger now work great for me. With animated modells too.
I have any Shaders from this forums. My Watershader do not work at time, when i render the Lightmaps. My screen is total black.
Hm, i must search why.





Sorry for my bad english
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Because the lighting manager changes itss shader.
Try to exlude the water node from lighting calculation with :
myLightingManager->excludeNodeFromCalculation(waterNode);
I'm not sure about the function name, pretty much the same ;)
detvog
Posts: 19
Joined: Sun Mar 02, 2008 8:49 am

Post by detvog »

I use the opengl watershader from the topic

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=39624.

Without the lightningmanger the shader works good for my.
But when i use the manager my screen is total black.
I have exlude the waternode from lighting calculation.
The screen is black.

PS: My project do not use a fps-camera. I have a 3rd player camera.
This all works without the lightmanger.


Sorry for my bad english.
PaperCutDoom
Posts: 6
Joined: Sun Apr 03, 2011 3:06 am
Location: Hawaii

Re: Lighting manager - normal & specular mapped with shadows

Post by PaperCutDoom »

Hey, I know this is a very old topic, but I was wondering if you could re-upload this. The links are broken and I really, really want to use it!
There are 10 kinds of people in this world, the ones who understand binary and those who don't.
Post Reply