Shadows

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
ProdigalSquirrel
Posts: 2
Joined: Mon Aug 13, 2007 9:12 pm

Shadows

Post by ProdigalSquirrel »

I can't get shadows to work.

From what I can tell through the tutorials and such, adding in shadows is simply a matter of setting the shadows flag to true when you call createDevice. Like so...

Code: Select all

IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<s32>(SWIDTH,SHEIGHT), 32, false, true);
That doesn't seem to do the trick though.

Could it just be that my graphics card doesn't support irrlicht's method for rendering shadows?
AlexL
Posts: 184
Joined: Tue Mar 02, 2004 6:06 pm
Location: Washington State

Post by AlexL »

In tutorial 08.SpecialFX it goes over how to add in shadow volumes exactly, basicly what you are missing is adding a shadow volume to your node via node->addShadowVolumeSceneNode()

Hope that answers your question ;)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Be warned that the shadows are cack as they will kill your frame rate. You can check the projects forum for some shadow shaders which i think should be more efficient.
Image Image Image
ProdigalSquirrel
Posts: 2
Joined: Mon Aug 13, 2007 9:12 pm

Yay

Post by ProdigalSquirrel »

Thanks for the quick responses.

I was actually adding shadow volumes, which I forgot to mention. However, I'm loading the scenes as an .irr file, and I don't think it is calling the addShadowVolume function correctly.

Code: Select all

/** SCENES */
	scene->loadScene("maps\\floodwall.irr");
	scene->setAmbientLight(SColorf(0.8, 0.8, 0.8));
	array<ISceneNode*> nodes;
	scene->getSceneNodesFromType(ESNT_MESH, nodes, scene->getRootSceneNode());
	DEBUG(nodes.size());
	for(unsigned short i=0; i<nodes.size(); i++){
		IAnimatedMeshSceneNode* m = dynamic_cast<IAnimatedMeshSceneNode*>(nodes[i]);
		m->addShadowVolumeSceneNode();
		m->setMaterialType(EMT_PARALLAX_MAP_SOLID);
	}
There are probably much better of ways of doing the above code, but I'm new to irrlicht.

Also, I'll probably just check out the shadow shaders, that sounds better, especially since I need to learn how to use the shader support.
Post Reply