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