[fixed]createMeshWithTangents parameters not working?

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
squisher
Competition winner
Posts: 91
Joined: Sat May 17, 2008 2:23 am
Contact:

[fixed]createMeshWithTangents parameters not working?

Post by squisher »

Hi, not sure if this should be moved to the bugs area or if there is a patch or trick to making this work. (I really hope there is, I've been pulling my hair out over this..)

EMT_SOLID, no tangents... (Nice and smooth)

Image


createMeshWithTangents(mesh, false, true, false);

(Triangles show! Yuck)
For reference, here are the parameters:
mesh Input mesh
recalculateNormals The normals are recalculated if set, otherwise the original ones are kept.
smooth The normals/tangents are smoothed across the meshbuffer's faces if this flag is set.
angleWeighted Improved smoothing calculation used



Image



In Blender, smoothed the way I want it

Image


In blender with normals shown.

Image

The double vertices are in certain spots in order to make it sharp. I tried it without the double vertices and it made no difference. I also tried it with triangles instead of quads.

I am using IrrBlend to export, although it shouldnt make a difference.


Help? Patch? Trick? Please please please? :shock:


[Edit: removed extra images to shorten my post]
Last edited by squisher on Sun Nov 01, 2009 4:50 pm, edited 2 times in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The smoothing does not work if vertices are duplicated. This could only be remedied with a far more complex version of the method. I'll move this thread to bug forum, though, as we keep getting such reports. Maybe you also want to provide a bug ticket on our tracker, which helps us to not forget this issue!
squisher
Competition winner
Posts: 91
Joined: Sat May 17, 2008 2:23 am
Contact:

Post by squisher »

hybrid wrote:The smoothing does not work if vertices are duplicated. This could only be remedied with a far more complex version of the method. I'll move this thread to bug forum, though, as we keep getting such reports. Maybe you also want to provide a bug ticket on our tracker, which helps us to not forget this issue!
I removed the doubles and it still glitches. Below is with the parameters false,true,false. (TTF, TTT, and FTT all looked even worse.)

Image


This is what it looks like in blender. Ugly, but you still don't see triangles. Note, no doubles.

Image


And here's the irrmesh file I'm using. So, how can I fix this?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, two things which create the bug here. One is an (obvious) typo, which messes the normals with or without the flag. That's simply because the tangents are partially not recalculated instead of the normals. Don't know how this could happen.
A second problem is with the createXMesh methods. They all duplicate the vertices, which is not really acceptable. We need to rewrite all those methods, which might take somewhat longer than the other fix (which should at least keep the proper normals if the first parameter is false).
squisher
Competition winner
Posts: 91
Joined: Sat May 17, 2008 2:23 am
Contact:

Post by squisher »

Awesome. Think you could paste the quick'n dirty code fix for the typo? I'd like to recompile my copy of Irrlicht with it.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The typo is fixed in the 1.5 branch now:
http://irrlicht.svn.sourceforge.net/vie ... threv=2777
As said, the other fixes will take some time.
Post Reply