Shader and light explanation!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
PsycoDad
Posts: 36
Joined: Mon Jan 09, 2006 8:30 am
Location: Munich/Germany

Shader and light explanation!

Post by PsycoDad »

Hello again.
I have great problems to make my FPS terrain. I want to add light and shaders in it, but i don´t know how to handle with that. Please don`t say, use the search funktion or make the tutorials. I did both, but didn`t find answers to my questions.

My terrain is ready, i load different .3ds files with .bmp textures and i use the metatriangleselector for collision detection. I load it with OpenGL.

Know i hope you can explain me how to use light and shaders.
At the moment i load all objekts with

Code: Select all

node->setMaterialFlag(EMF_LIGHTING, true);
But i want to make the terrain look like afecelis terrain looks in this
http://www.danielpatton.com/afecelis/Ir ... test01.jpg

I think i must add an ambient light, an also a static light to make the shadows. But i don´t know where to put the code for this, and i don`t know what i must set to my nodes, for the shadow. ->setMatrialFlag(?????)

Maybe afecelis or somebody else can give me a crash course for dummys in useing light and shaders.
THX for replys!

And excuse my bad english!
Wer andern eine Bratwurst brät, der hat ein Bratwurstbratgerät!
hybrid

Post by hybrid »

Sorry, but there are several examples which use lights and shadows part of Irrlicht. So you should at least find some code which generates light nodes. Search for something like addLisghtSceneNode.
And don't mix up shaders and shadows. They have nothing in common. Well, you might use shaders for shadows, but in general these are two completely different things.
hybrid

Post by hybrid »

Sorry, but there are several examples which use lights and shadows part of Irrlicht. So you should at least find some code which generates light nodes. Search for something like addLisghtSceneNode.
And don't mix up shaders and shadows. They have nothing in common. Well, you might use shaders for shadows, but in general these are two completely different things.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

The Special FX tutorial gives an example of using lights and shadows.

You can add a shadow to an IAnimatedMeshSceneNode by calling node->addVolumeShadowSceneNode(). And making sure that when you create the device you have the stencil buffer parameter set to true. Then that should create shadows from the lights you add e.g. by using smgr->addLightSceneNode(...).

For me this kills the framerate and only works if the camera is at a low tilt... not sure why, maybe you'll have more luck!
Image Image Image
xterminhate
Posts: 206
Joined: Thu Sep 01, 2005 9:26 pm
Location: France

Post by xterminhate »

Lightmaps may help.
Return to Irrlicht after years... I'm lovin it.
It's hard to be a Man !
Si vis pacem para belum
Amt0571
Posts: 128
Joined: Mon Mar 06, 2006 6:29 pm

Post by Amt0571 »

I think that for lighting a terrain, lightmaps are the best option. They're fast and have far higher quality than dynamic shadows.
Post Reply