问题描述
我有一个解析.3ds文件并上传网格的代码。我有几个.3ds文件,但我的代码中有一个错误。所以现在我试图生成一个简单的.3ds文件(又名一个三角形或一个立方体),但我不知道如何创建一个.3ds文件。
我目前拥有的档案已加密。我在其他网站上找到了一对,他们没有任何简单的模型。
你如何为一个简单的三角形和立方体制作.3ds文件?有没有可以制作一个的现有软件?或者我可以为它写一个脚本? 解决方案
我有一个解析.3ds文件并上传网格的代码。我有几个.3ds文件,但我的代码中有一个错误。所以现在我试图生成一个简单的.3ds文件(又名一个三角形或一个立方体),但我不知道如何创建一个.3ds文件。
我目前拥有的档案已加密。我在其他网站上找到了一对,他们没有任何简单的模型。
你如何为一个简单的三角形和立方体制作.3ds文件?有没有可以制作一个的现有软件?或者我可以为它写一个脚本? 解决方案
创建3ds文件比解析它更困难
因为您需要按顺序使用3D Studio所需的所有块,所以不会出现任何错误。在解析中,您只需要几何,矩阵和纹理,并可以忽略其余部分。 3ds 文件格式未打开,只有部分解码/记录,因此这可能是一个难以解决的问题。
我将重点放在调试解析器本身上:
尽可能多地下载3ds文件
例如,从有很多免费的3ds文件,只需选择以下过滤器:
$ b
开始解码最简单的(仅限几何)
您会看到有些模型会很好,有些不是。因此,对那些没问题的问题进行排序,并查看他们使用哪些信息块将帮助您确定问题所在。在每个文件的某个地方输出已使用块的列表是一个好主意,这样您可以更轻松地确定要编码哪些块以及忽略哪些块。
很遗憾,我的C ++ 3ds解析器大约是54千字节
这几乎是答案体的限制的两倍,所以我可以不要直接在这里发布。此外,它意味着你不能在这里发布你的整个代码(只是大块枚举几乎30KB),所以试着只关注重要的东西。当您将特定问题帖子地址打到 3ds 文件+输出图片+您正在使用并忽略的区块列表时,我们才能真正帮助您。
我这几年的代码回来了,它是我的一个更大的lib的一部分,所以代码并不完整。它只包含3ds解析部分+导出到基于OpenGL VBO的矿山几何类,但它应该足以与您的代码进行比较,以查看问题出在哪里。这个解析器也不是100%工作,仍然有一些文件不能正确支持(因此是目录名称)。请参阅加载
和保存
成员函数...
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?
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:
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:
sort them by type
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.
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 ...
这篇关于如何为一个简单的三角形制作.3ds文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!