Recalculation of normals with custom rotations on bone mesh

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
MrJones
Posts: 15
Joined: Sun May 23, 2010 1:02 pm

Recalculation of normals with custom rotations on bone mesh

Post by MrJones »

Sadly after my issues with setting manual bone rotations and still being able to obtain the absolute positions with those custom rotations applied were so nicely solved, I apparently have another problem:

At the moment I'm calling animateJoints() and updateAbsolutePositionOfAllChildren() of the root node to get all bone positions in place and get the default unchanged bone rotations, then I'm picking out bones in irrlicht code and setting custom rotations to them. Another updateAbsolutePosition() will update the bones' absolute positions based on their new rotations so ->getPosition() works and I can apply things to their new positions.

Now it appears that while this works fine for the basic rotation itself and also getting the absolute positions of the rotated things, Irrlicht apparently doesn't care to recalculate the normals accordingly (probably animateJoints() would do this but I'm changing the rotations afterwards which another call to it would override). This results in extremely wrong and ugly lighting for any bone that is more than slightly rotated away from its initial, unchanged rotation.

I searched the API but couldn't find a function I could possibly call without wiping my rotations away again that simply recalculates the normals based on the bones' current rotations and positions. Does someone know how I can prompt such a recalculation without overriding my custom bone rotations?
blub
MrJones
Posts: 15
Joined: Sun May 23, 2010 1:02 pm

Post by MrJones »

Here some screenshots that show the blackness that appears due to not correctly altered normals when I apply my custom bone rotations:

Image
Image
Image
Image
Image
blub
MrJones
Posts: 15
Joined: Sun May 23, 2010 1:02 pm

Post by MrJones »

Thanks to CuteAlien, I was able to find and use that normals debug display and as it seems the normals *are* adjusted during animation but are just horribly broken even in unanimated idle state:

Image

So I guess I have to fix the model or the broken .b3d exporter here :-/
blub
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Post by Valmond »

I use the "b3d pipeline" and it works okay, what kind of exporter do you use?
Post Reply