how to make .3ds file for a simple triangle

六眼飞鱼酱① 提交于 2019-12-12 06:17:40

问题


I have a code that parses .3ds file and uplaod the mesh. I have couple .3ds files but there is a bug in my code. So right now i'm trying to generate a simple .3ds file (aka a single triangle or a cube) but I'm not sure how to create a .3ds file.

The files I currently have are encrypted. I found couple on other websites and they don't have any simpler models.

How do you make .3ds file for a simple triangle and a cube? Is there an existing software that can make one? or can i write a script for it?


回答1:


creating 3ds file is a bit harder then parsing it

Because you need to use all the chunks needed for 3D studio in their order, without any errors. In parsing you need just the geometry,matrices and textures and can ignore the rest. 3ds file-format is not open and only partially decoded/documented so this can be a hard problem to do right.

I would focus on debugging the parser itself instead:

  1. download as many 3ds files as you can

    For example from TurboSquid there are quite a lot of free 3ds files there just select the filters for:

    • max price 0
    • *.3ds extension
    • 3D models
  2. sort them by type

    • geometry only
    • with colors
    • with textures
    • with sub meshes
    • and combinations
  3. start decoding the simplest ones (geometry only)

    You will see that some models will be fine and some not. So sort those which are OK and which not and see which chunks they use it will help you to identify where the problem is. It is a good idea to output list of used chunks per file somewhere so you can more easily determine which chunks to encode and which to ignore.

Sadly mine C++ 3ds parser is around 54 KByte

Which is almost twice the limit of answer body here so I can not post it here directly. Also it means you can not post whole code of yours here too (just the chunks enum is almost 30KB) so try to focus on the important things only. When you hit a specific problem post address to 3ds file + image of your output + list of chunks you are using and ignoring so we can actually help.

  • here mine 3ds parser in C++ and some free 3ds files for testing

I code this few years back it is a part of a larger lib of mine so the code is not whole. It contains just the 3ds parsing part + export to mine geometry class based on OpenGL VBO but it should be enough for comparison with your code to see where the problem is. This parser is also not 100% working there are still some files it does not support correctly (hence the directory names). See load and save member functions ...



来源:https://stackoverflow.com/questions/31690858/how-to-make-3ds-file-for-a-simple-triangle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!