Exporters are creating doubles..

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
artich0ke
Gnoblar
Posts: 5
Joined: Sun Jan 08, 2012 2:02 pm

Exporters are creating doubles..

Post by artich0ke »

I made a mesh in blender, exported it as .xml and imported it again, i could remove 600 doubles from the model, so i saved it again and imported it, same issue. I then tried a .mesh file from a game that i'm gonna do some work for. I converted it to .xml and then imported it into Blender, this file also had doubles.

I tried 2 exporters for Blender from this page: http://www.ogre3d.org/tikiwiki/OGRE+Exporters both had this issue.

Does anyone know if the doubling occurs on import or on export, if it occurs only on import it doesnt matter.. maybe the doubling is needed for this format (im new to ogre3D and its format)? if not it's a serious issue.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 535

Re: Exporters are creating doubles..

Post by Kojack »

3d hardware only has 1 normal per vertex. This means that anytime you want a sharp edge in a model (not smoothed) duplicate vertices are needed. They will have the same position and maybe same uv coords, but different normals. For example, a correctly lit cube requires 24 vertices, not 8 like many people assume. Programs like blender can afford to use less efficient internal formats which don't need multiple vertices. Anywhere two adjacent triangles have different uv mappings there will be duplicate vertices too (even if you have a cube with no normals, a minimal of around 12 or so vertices are required for the textures to not be screwed up).
This isn't an ogre issue, it applies to all modern 3d hardware.
f00bar
Halfling
Posts: 57
Joined: Sun Feb 15, 2009 4:00 am
x 1

Re: Exporters are creating doubles..

Post by f00bar »

To simplify Kojacks answer: You can set the model to smooth shading in blender, then each vertex is exported only once (if material and uv match for faces of vertex). For organic/smooth surfaces that is what you want to use. However, if you have hard edges and depending on material and lighting, this does maybe not look like you want.
artich0ke
Gnoblar
Posts: 5
Joined: Sun Jan 08, 2012 2:02 pm

Re: Exporters are creating doubles..

Post by artich0ke »

Thanks for your replies. I never knew smooth shading had an impact on the verticies themselves, thought it was just used as a temporary visual effect.. glad i asked :)
artich0ke
Gnoblar
Posts: 5
Joined: Sun Jan 08, 2012 2:02 pm

Re: Exporters are creating doubles..

Post by artich0ke »

hmm i still seem to be able to reduce the file size by first exporting to .xml, load the file again, delete all doubles and export again.. yes i always click "smoothing" first now.

This doesnt always work though, i guess it depends on which format it was before converting it to .xml.. It was successfull with a .obj file where i reduced the file size 25-30% by deleting doubles, compared to not removing the doubles.