Shadows on a cube?
Shadows on a cube?
How do i make a stencil shadow on a cube, it only seems to accept animmeshes?
C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com
Visit www.d-grafix.com
This came up here with no really satisfactory responses:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32081
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32081
Yeah a cube mesh would be better. In fact, making your whole level in a modelling program would give much faster results (draw the whole thing in one call instead of hundreds). If you need to use a tiled world then consider using my batching mesh which will give you a good performance boost.
Code: Select all
irr::scene::IAnimatedMeshSceneNode* toAnimMeshSceneNode;
irr::scene::IMesh * toMesh;
irr::scene::IAnimatedMesh* toAnimMesh;
irr::scene::IMeshSceneNode*temp = b3d::B3dSmgr->addCubeSceneNode(size) ;
irr::scene::IMesh*tmesh = temp->getMesh();
irr::scene::SAnimatedMesh * am=new irr::scene::SAnimatedMesh();
am->addMesh(tmesh);
toAnimMesh = am;
toAnimMeshSceneNode = b3d::B3dSmgr->addAnimatedMeshSceneNode(toAnimMesh,ValidateParent(parent));
toAnimMeshSceneNode;
temp->setVisible(false); //TODO// Find a solution to this ugly hide!!
This converts the cube into an animated mesh which allows for shadows (shadows are not available on IMesh for some odd reason) as i discovered by a bit of forum scouring.
There is one small problem with this though, the creation leaves the original mesh lying about and will not let me drop it. (i suspect the geometry is linked with the new one somehow).
Howevwer, i have fixed it with a bit of a hide hack, but its still there It would be nice if someone with more experience could clean this method up for me,[/code]
C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com
Visit www.d-grafix.com
You made this yet you can't do simple shadow maps, wow. Not saying you should use them or anything, I don't care but I am still amazed you can do all that and not use shadow maps. Infact even a static lightmap would work here, you already wrote a lightmapper yourself!I took a look at Xefects but i would prefer an engine-native solution (plus im too much of a noob to fully understand it ).
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
bitplane wrote:Yeah a cube mesh would be better. In fact, making your whole level in a modelling program would give much faster results (draw the whole thing in one call instead of hundreds). If you need to use a tiled world then consider using my batching mesh which will give you a good performance boost.
Well my point in making this program is tu create some generator of dungeon (random or reading from txt file) so i think that i cant use any world creater.
But i'll check your class
Well i am afraid that this will end with a big memory slickThere is one small problem with this though, the creation leaves the original mesh lying about and will not let me drop it. (i suspect the geometry is linked with the new one somehow).
P.S.
So does anyone have some cube mesh wich i could use ?
Last edited by MarcinS on Sun Mar 01, 2009 2:04 pm, edited 1 time in total.
Code: Select all
cube->getMaterial(0).GouraudShading = false;
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
hehe, lets say i can understand when its in a language i understand. I have been using c++ for a very little time, and irrlicht for a lot less (i started learning it ages ago and then got attracted away by C# but am now disenchanted at my options there and am back.) The Language and b3d Engine T.Ed was writen in i know well.You made this yet you can't do simple shadow maps, wow. Not saying you should use them or anything, I don't care but I am still amazed you can do all that and not use shadow maps. Infact even a static lightmap would work here, you already wrote a lightmapper yourself!
I understand the principles behind it but i still have to use the phrase book every 2 seconds when looking at c++/Irrlicht code. (and i do not like simply bolting in code to my project until i understand it implicitly )
Basically, ive worked out how to use stencil shadows on everything "animated" except cubes and other static meshes. I suppose its more of a mission to learn more about the way Irrlicht behaves internally. I am still a bit confused over SMesh IMesh IAnimMesh SAnimMesh etc..
C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com
Visit www.d-grafix.com
Code: Select all
toAnimMeshSceneNode = b3d::B3dSmgr->addAnimatedMeshSceneNode(toAnimMesh,ValidateParent(parent));
there is no parent in this case, it is actually all part of a larger class construct. I put parent there in case i want one. Otherwise its 0.
C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com
Visit www.d-grafix.com
thanks to dgrafix it works..
But i add also
becosue i have big problems with
It hardly ever was able to "see" the cube that mouse was pointing at.. with this line it works ok
Well it works when you are near the light but when you get to the edge of it then i again start to act strange
I am going to use BlindSide Xeffects for shadows maby that will work better
But i add also
Code: Select all
tmesh->setBoundingBox(temp->getBoundingBox());
Code: Select all
target = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(core::position2di(receiver.MouseX(),receiver.MouseY()));
Well it works when you are near the light but when you get to the edge of it then i again start to act strange
I am going to use BlindSide Xeffects for shadows maby that will work better
Still got that irritating memory hole though :/
I wish i could find a clean and easy way to convert a static mesh (one that cleans up after itself)
I wish i could find a clean and easy way to convert a static mesh (one that cleans up after itself)
C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com
Visit www.d-grafix.com