Shadow Problem

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

Shadow Problem

Post by sudi »

Ok i got a problem with the stecil shadows in irrlicht:

I initialice my device like this:
//The Device
device = createDevice(EDT_OPENGL, dimension2d<s32>(config.x, config.y),
32,config.fullscreen, true, false, receiver);

and i load my mesh like this:

if(IAnimatedMesh* mesh = smgr->getMesh("media/meshes/bombermanX.x"))
{
pnode = smgr->addAnimatedMeshSceneNode( mesh );

// add shadow
//pnode->addShadowVolumeSceneNode();

//pnode->setParent(camera);
pnode->setScale(vector3df(10,10,10));

pnode->setRotation(vector3df(0,90,0));
//Position has to be changed
pnode->setPosition(position.get3df());

//Material_Fags
pnode->setMaterialFlag(EMF_ANISOTROPIC_FILTER ,true);
pnode->setMaterialFlag(EMF_NORMALIZE_NORMALS ,true);
pnode->setMaterialFlag(EMF_LIGHTING ,true);
}

when i load like this the scene looks normal but when i uncomment the shadow line then the whole scene goes dark and the frame rate drops to 1 or even below. does anyone has a clue?
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.
razmott

Post by razmott »

Hi !

I know it's a old message but I've exactly the same problem.
Does anyone know ?
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

sry but this is a serious problem...lol.....hey come on i don't know whats going wrong.
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.
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

Perhaps ... you need to... Add a light to the scene...
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Aye, definately try adding a light to the scene :)

If it still doesnt work, please post all the code for us to help out.
razmott

Post by razmott »

Hi !

I've a light in.
I've test with the example (SpecialFX), and I got the same problem !
Jan_
Posts: 16
Joined: Wed Sep 28, 2005 11:39 am
Location: Germany, Chemnitz, Bgst.

Post by Jan_ »

what graphics card have you?
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

same here got the light in the scene and it doesn't work
my card is a geforce4ti 4200
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.
lostpencil
Posts: 17
Joined: Fri Dec 16, 2005 5:46 pm
Contact:

Post by lostpencil »

Hey Guys,

I think you need to enable the stencil buffer on your createdevice call. The fifth parameter should be set to 'true'. Hope that helps.
Cheers,
Paul Mikulecky
Lost Pencil Animation Studios Inc.
http://www.lostpencil.com

"The art of character animation is to try
to catch lightning in a bottle.... one volt
at a time." Brad Bird
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

no that doesn't help!!!!
we enabled the stencial shadows.
otherwise there wouldn't be the performance drop and the dark scene!
but there is light in scene as well and i don't know whats going on
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 »

nobody?
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.
lostpencil
Posts: 17
Joined: Fri Dec 16, 2005 5:46 pm
Contact:

Post by lostpencil »

Hey Sudi,

Well, I have stencil shadows working and the code looks similar to yours.

Maybe it's the model? What about the surface that is 'catching' the shadow? Does it have enough faces to catch the light/shadow? What version of Irrlicht are you using (I'm playing with 0.14). If you want you can email me (paul@lostpencil.com) the model and I can plug it into my code and see if I get shadows.
Cheers,
Paul Mikulecky
Lost Pencil Animation Studios Inc.
http://www.lostpencil.com

"The art of character animation is to try
to catch lightning in a bottle.... one volt
at a time." Brad Bird
lostpencil
Posts: 17
Joined: Fri Dec 16, 2005 5:46 pm
Contact:

Post by lostpencil »

One thing that is different that I just noticed is that I'm using DirectX9, and not OpenGl.
Cheers,
Paul Mikulecky
Lost Pencil Animation Studios Inc.
http://www.lostpencil.com

"The art of character animation is to try
to catch lightning in a bottle.... one volt
at a time." Brad Bird
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

ok its really weird cause when i plug my loading code for the mesh in the special fx tutorial with opengl driver it works fine
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.
lostpencil
Posts: 17
Joined: Fri Dec 16, 2005 5:46 pm
Contact:

Post by lostpencil »

Hmm... doesn't sound like the model then...

Another thing I discovered when playing with shadows (at least using DirectX9) is that when the attenuation values for the light are set to strange values it can cause the scene to go black. A good set of values that seems to work for most cases:

Code: Select all

Attenuation0 = 0.0f;
Attenuation1 = 1.0f / Radius;
Attenuation2 = 0.0f
There is good information regarding these values in the directx documentation. I'm not sure what effect they have in OpenGl and I believe you have to play around with them in the Irrlicht code. I modified the engine so I can update them through the Slight structure.
Cheers,
Paul Mikulecky
Lost Pencil Animation Studios Inc.
http://www.lostpencil.com

"The art of character animation is to try
to catch lightning in a bottle.... one volt
at a time." Brad Bird
Post Reply