normals of a sized mesh, ID: 2924230

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
damur
Posts: 1
Joined: Sat Jan 02, 2010 1:23 pm

normals of a sized mesh, ID: 2924230

Post by damur »

Check: Tracker-Link

First of all, lightning on sized meshes works. Except if you scale one dimensions to zero, but I think this case doesn't make sense and it's not a bug of irrlicht, but of opengl / directx. It does not matter, so let's forget about that.

But the normals shown by DebugDataVisible confused me. Please look at the images I uploaded to the tracker. I scaled the dwarf very flat, and the normals should all point up or down now, like in my fixed version.

This is how I have changed the normal-drawing for-loop in CAnimatedMeshSceneNode::render()

Code: Select all

driver->setTransform(video::ETS_WORLD, core::matrix4());
for (u32 i=0; i != mb->getVertexCount(); ++i)
{
	core::plane3df normalPlane;
	normalPlane.Normal = v->Normal;
	AbsoluteTransformation.transformPlane(normalPlane);

	core::vector3df normalPosition = v->Pos;
	AbsoluteTransformation.transformVect(normalPosition);

	if (normalize)
		normalPlane.Normal.normalize();
	
	driver->draw3DLine(normalPosition, normalPosition + (normalPlane.Normal * DebugNormalLength), DebugNormalColor);

	v = (const video::S3DVertex*) ( (u8*) v+vSize );
}
This also needs to be changed in CMeshSceneNode::render() and perhaps other sceneNodes?
I used plane3df, because I couldn't find another way to transform a normal, any ideas?
Post Reply