wjc272008 / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

Blender loader duplicates vertices #466

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Load the default cube from Blender

What is the expected output? What do you see instead?
Assuming there are no texture coordinates or vertex colors, the cube should 
have 8 vertices (or 24 due to normals). However right now the cube is loaded 
with 36 vertices, as exactly 3 vertices are generated per triangle. I expect 
the Blender loader to automatically share vertices if their attributes are 
identical.

Original issue reported on code.google.com by ShadowIs...@gmail.com on 12 Feb 2012 at 9:43

GoogleCodeExporter commented 9 years ago
I am raising this issue to "Critical" priority since it may cause many models 
to inflate in vertex count without any way to fix it without reimporting the 
.blend model again once a fix has been done.

Original comment by ShadowIs...@gmail.com on 28 May 2012 at 5:56

GoogleCodeExporter commented 9 years ago
The vertices are referenced 36 time even though only 8 instances of Vertex3f 
are created.
I can try to create less references but I am not sure how to solve smooth/solid 
issue then.
In blender when the object has a smooth flag on then a vertex will have only 
one normal assigned. But when the smooth flag is off then it will have one 
normal for each face it is assigned to.

Does Ogre loader solve the smooth/solid issue?

Original comment by mrogu...@poczta.fm on 29 May 2012 at 1:35

GoogleCodeExporter commented 9 years ago
@Kaelthas_Spellsinger@o2.pl: Since you compute all attributes of a vertex 
including normal, you can just merge identical vertices together with some 
margin for rounding errors and such.
Since Blender allows to specify smooth/flat shading per vertex (or face?) and 
you can access that data then you can only generate 3 vertices per triangle 
only for those triangles marked as flat.

Original comment by ShadowIs...@gmail.com on 29 May 2012 at 5:15

GoogleCodeExporter commented 9 years ago
OK I'm halfway there.
I've managed to import static model with much less amount of vertices.
If all faces of the model are set to smooth then the amount of vertices is 
equal to the amount in blender.
The most memory is used when all faces are set to solid. But I guess this will 
happen rather rarely.

Only animations will need to be fixed so I guess I'll spend a few more days on 
that issue.
And the textures testing also awaits me to check if nothing had changed.

To sum it up,
I guess that soon this will be fixed and the amount of vertices will be greatly 
reduced.

Original comment by mrogu...@poczta.fm on 6 Jun 2012 at 10:22

GoogleCodeExporter commented 9 years ago
Fixed.

Original comment by mrogu...@poczta.fm on 17 Jun 2012 at 10:35