Exporting Blender 2.8 tangent to ogre XML

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


mrmclovin
Gnome
Posts: 324
Joined: Sun May 11, 2008 9:27 pm
x 20

Exporting Blender 2.8 tangent to ogre XML

Post by mrmclovin »

Doing an experimental blender 2.8 exporter for ogre2.

As far as I understand, a Blender vertex can have multple tangents depending on which face the vertex participates in. In Ogre2's mesh XML, I can only specify one tangent per vertex. Does this mean I cannot map Blender's tangents directly to Ogre?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5502
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1370

Re: Exporting Blender 2.8 tangent to ogre XML

Post by dark_sylinc »

Hi!

When a vertex has more than one normal or tangent, the only solution is to duplicate the vertex. That's how traditional GPUs work.

Cheers
mrmclovin
Gnome
Posts: 324
Joined: Sun May 11, 2008 9:27 pm
x 20

Re: Exporting Blender 2.8 tangent to ogre XML

Post by mrmclovin »

dark_sylinc wrote: Fri Apr 17, 2020 7:49 pm Hi!

When a vertex has more than one normal or tangent, the only solution is to duplicate the vertex. That's how traditional GPUs work.

Cheers
Thanks for the article. That cleared up things I haven't thought about. Just out of curiosity regarding the optimizations, e.g. a 36 vertices cube with some vertices that share the same normal, and hence one can be eliminated - isn't this type of non-destructive optimization something that should be done in Ogre's XML importer? It would definitely make it easier to make exporters, as you wouldn't have to implement the same advanced optimization algorithm for each exporter. Instead it would be the quick and dirty way without loosing performance :)
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5502
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1370

Re: Exporting Blender 2.8 tangent to ogre XML

Post by dark_sylinc »

mrmclovin wrote: Fri Apr 17, 2020 11:26 pm Just out of curiosity regarding the optimizations, e.g. a 36 vertices cube with some vertices that share the same normal, and hence one can be eliminated - isn't this type of non-destructive optimization something that should be done in Ogre's XML importer? It would definitely make it easier to make exporters, as you wouldn't have to implement the same advanced optimization algorithm for each exporter. Instead it would be the quick and dirty way without loosing performance :)
Importers are usually in a better position since they can detect duplicates as they add new vertices to their sets, and dump only what's necessary (producing smaller outputs and thus improving performance)

Blender is an exception though since an exporter written in Python has poor performance.

Exporter performance is also often second class citizen, since it happens offline. Iteration time is still very important though (i.e. modify -> view in-engine -> modify) but you can script two paths: unoptimized (doesn't remove duplicates) and optimized (removes dupes).
  • MeshMagick supports removing duplicates. You have to convert it to v1 first though.
  • DERGO also has VertexUtils::shrinkVertexBuffer but it's more basic: It removes binary-exact duplicate vertices, and it's just code. It's not an offline tool.