Stencil shadows failing on .3ds
-
- Posts: 22
- Joined: Sun Oct 15, 2006 10:02 pm
Stencil shadows failing on .3ds
Hey,
I'm not sure if it's been said somewhere, but are .3ds meshes not subject to casting shadows? When I load an md2, it shadows fine, but when I add a ShadowNode to the .3ds mesh, the whole program hangs (this by changing only the path to the mesh being loaded, nothing else).
Any ideas?
I'm not sure if it's been said somewhere, but are .3ds meshes not subject to casting shadows? When I load an md2, it shadows fine, but when I add a ShadowNode to the .3ds mesh, the whole program hangs (this by changing only the path to the mesh being loaded, nothing else).
Any ideas?
-
- Posts: 22
- Joined: Sun Oct 15, 2006 10:02 pm
Cool yeah. I was just wondering if there was a bug with .3ds initially since some ppl have told me there are some between irrlicht and the format. Here's the code:
That's it as far as the dice. The md2 model I load casts shadows and is pretty much identical in creation:
The only difference is the md2 animation really. When I comment out the addShadowNode for the dice, everything works, but that single line makes it hang completely.
I'm a bit perplexed.
Thanks for the help.
Code: Select all
diceArray = new IAnimatedMeshSceneNode[8];
Random random = new Random();
for (int i = 0; i < 8; i++)
{
diceArray[i] = device.SceneManager.AddAnimatedMeshSceneNode(diceMesh, null, i);
diceArray[i].SetMaterialFlag(MaterialFlag.LIGHTING, true);
diceArray[i].Rotation = new Vector3D(0, 0, random.Next(8) * 90);
}
// Initialize the dice positions here
for (int i = 0; i < 8; i++)
{
diceArray[i].ID = -(i + 1);
diceArray[i].AddShadowVolumeSceneNode();
diceArray[i].SetMaterialFlag(MaterialFlag.NORMALIZE_NORMALS, true);
}
smgr.ShadowColor.Set(220, 0, 220, 0);
Code: Select all
IAnimatedMesh mesh = smgr.GetMesh(@"C:/Irrlicht/irrlicht-1.1/media/faerie.md2");
IAnimatedMeshSceneNode anode = smgr.AddAnimatedMeshSceneNode(mesh, null, 0);
anode.Position = new Vector3D(0, 30, 0);
anode.SetMD2Animation(MD2AnimationType.STAND);
anode.SetMaterialTexture(0,
driver.GetTexture("C:/Irrlicht/irrlicht-1.1/media/Faerie5.BMP"));
// add shadow
anode.AddShadowVolumeSceneNode();
smgr.ShadowColor.Set(220, 0, 0, 0);
anode.SetMaterialFlag(MaterialFlag.NORMALIZE_NORMALS, true);
I'm a bit perplexed.
Thanks for the help.
-
- Posts: 22
- Joined: Sun Oct 15, 2006 10:02 pm
wow, thats a monster of a mesh!
I've been sat here for the last 5 mins trying to load it.. for such a simple shape you might want to try something a bit more optimized. also, you should triangulate your mesh before exporting it, that way irrlicht won't have to.
if you insist on using such a large mesh, you should use a different mesh for shadow generation (use setMeshToRenderFrom)
I've been sat here for the last 5 mins trying to load it.. for such a simple shape you might want to try something a bit more optimized. also, you should triangulate your mesh before exporting it, that way irrlicht won't have to.
if you insist on using such a large mesh, you should use a different mesh for shadow generation (use setMeshToRenderFrom)
-
- Posts: 22
- Joined: Sun Oct 15, 2006 10:02 pm
So are you saying that the mesh is effectively hanging cause it takes too long to do the shadow calculation? It seems to be running fine with normal dynamic lights, strange...
Anyway, as far as setting a different mesh for the shadow, do I have do have that mesh loaded at a node, or do I just specify a different node and irrlicht sort of "replaces" it for the shadow calculation? (The Irrlicht doc didn't say much about it)
Thanks again for the help!
Anyway, as far as setting a different mesh for the shadow, do I have do have that mesh loaded at a node, or do I just specify a different node and irrlicht sort of "replaces" it for the shadow calculation? (The Irrlicht doc didn't say much about it)
Thanks again for the help!
Code: Select all
IShadowVolumeSceneNode *shadow = node->createShadowVolumeSceneNode();
shadow->setMeshToRenderFrom(simple_mesh);
-
- Posts: 22
- Joined: Sun Oct 15, 2006 10:02 pm
-
- Posts: 22
- Joined: Sun Oct 15, 2006 10:02 pm
Do you know if C# has the ability to carry out that function? It doesn't have a shadowvolume node type, and neither iscenenode nor IAnimatedMeshSceneNode have functions to set the shadow rendering to a different mesh. And there's no createshadow function, only the addShadow, which returns IsceneNode. The documentation only mentions addShadow, too.
It is a problem of performance, I'm sure of that now, just need to get that shadow to be rendered by a simple 6-poly cube, but C# doesn't have that ability it seems...
It is a problem of performance, I'm sure of that now, just need to get that shadow to be rendered by a simple 6-poly cube, but C# doesn't have that ability it seems...