Read 3D models from obj files with new version of Ab3d.PowerToys

by abenedik 29. November 2013 13:40

Ab3d.PowerToys library continues to get great new features. The new version gets ability to read 3D models from obj files. This adds a great new value to the Ab3d.PowerToys library because now it is possible to import 3D objects directly with the library.
Obj file format is very common file format to store 3D models. The model data is written in simple text format.

The following screenshot shows a 3D ship model that was read with the new Ab3d.ReaderObj library:
ReaderObj screenshot

Because now it is possible to import 3D models only with Ab3d.PowerToys library, the question arises if we still need Ab3d.Reader3ds library to read 3ds files. The following are the main differences between obj and 3ds file format:
obj is a text file; 3ds is a binary file,

  • 3ds file can define hierarchy of 3D objects with object transformations; obj file does not support hierarchies and transformation,
  • obj file does not support animations,
  • 3ds file is not capable of storing texture file names that exceed the 8.3 format; file names in obj file can be in any length.



The main difference is that animations and object’s hierarchies are supported only by 3ds files. For example if you need to create 3D objects similar to that used in Robotarm sample where rotating one part of the robot also rotates all child objects, you will need to use 3ds files to store the hierarchies.
Anyway obj files are still very common to store simple 3D models.

I would also like to mention that the code that is used to read obj files is highly optimized to parse the values from text files very fast. Also when common methods like Split and Regex are used to parse large text files in .Net with the memory usage can be very high – many string instances can be created. The code in ReaderObj class has been optimized also in regard to memory usage to minimize the creation of many string instances.

The version also has the following new features and bug fixes:

  • Fixed performance of LinesUpdater when the camera or other property is not changed (before lines were recreated every time, now only when they need to),
  • Added additional override of Dumper.Dump with Model3D as paramter to write Model3D info to Visual Studio output or immediate window.


The new version also comes with a new very interesting arrows sample that animate the arrows in a very nice way. The following screenshot show the sample:
Arrows sample screenshot

You can also see the new sample in a new video that also shows some other samples.

Tags:

Ab3d.PowerToys