OpenSceneGraph icon indicating copy to clipboard operation
OpenSceneGraph copied to clipboard

Any interest in an unofficial normals extension for AC3D

Open gordonshamway23 opened this issue 5 years ago • 0 comments

Hallo,

I dont't have a real issue with osg, but more or less a question. I made an extension for the osg ac plugin, which is responsible for importing 3d model in the AC3D format. The extension I made is already programmed, tested and working. The intention of my extension is to add functionality for specifying normals in *.ac model files explicitly. As of now normals can not be specified in AC3D files, but will be calculated automatically from vertices after parsing an ac file. This is done by taking adjacent vertices into account to calculate a smooth normal of a vertex. This is ok for most situations but having full control over normals for each vertex can help increase quality of 3D models, especially when modeling hard surfaces. So the problem is, the addition I made to the AC3D file format, is not officially supported by the standard and I can totally understand if you are not interested in such an addon. Now you can ask why do I want to get this extension in the osg repository. The answer is Flightgear :). As you all will know Flightgear makes heavy if not exclusive use of the AC3D format for loading aircraft models. So having this extension in the official osg build can help Flightgear to make Aircrafts look better in future. So I would like to know what you think about that?

Some more facts about my extension: 1, The extension is made in a way which is fully compatible with existing *.ac files. So parsing ac file without explicit normals is completely fine. It is therefore optional to use normals at all. 2. In code I used a macro EXPLICIT_VERTEX_NORMAL_EXTENSION which allows to completly include or remove the extension code to/from compilation. It does make the code a little ugly though, but it is nice to have, to see the unofficial additions to the ac plugin.

Here are some files describing the AC3D file format with and without my extension.

ac3d_file_format_2003_with_expilicit_normals.txt ac3d_file_format_2017_Nicolatis.txt ac3d_file_format_2017_Nicolatis_with_expilicit_normals.txt ac3d_file_format_2003.txt

And here the code of the plugin, just two files, my extension (ac3d.cpp) and the original code(ac3d_original.cpp). Sorry I had to zip it.

ac3d.zip

Feel free to have a look and I would be very happy to contribute it. I can easily make a pull request if you are interested.

Have a nice day.

gordonshamway23 avatar Nov 12 '20 21:11 gordonshamway23