关于图像:将纹理文件包含到collada文件中

Including texture files into the collada file

我想将我的纹理图像文件包含到我的collada文件中。
现在我有很多文件:.dae本身和.png纹理文件。

但是,我只需要一个文件:.dae,但其中包含纹理。

我可以以某种方式将.png图像存储在.dae文件本身中吗?
是否可以?
预先谢谢您!


尽管前面的回答是什么,但完全有可能将图像嵌入COLLADA文件本身。在<init_from>元素下,您会发现可以使用<ref>元素指定文件名,或者可以指定<hex format="PNG">,在其中可以将图像数据指定为十六进制编码的二进制序列。八位位组。但是,由于采用十六进制编码,因此与将图像文件包括在.zae归档文件中(实际上是具有不同扩展名的.zip文件和特殊的元数据文件)相比,存储效率有所降低。

我知道这个问题有几个月了,但我不得不更正先前的答案。


您不能在.dae文件中嵌入图像。这样做的方法是将它们放在一起成为一个zip文件。 COLLADA文件中纹理的路径应相对于存档中.dae文件的位置。

该zip文件有时会以扩展名.zae重命名。 COLLADA 1.5规范在第20页上正式定义了这些,此处重复以完成:

Archive Packaging

On import and export, DCC tools must support the .zae format, which is a zip archive of one or several .dae files
(COLLADA documents) and all the referenced content (textures). The
archive must include a file named manifest.xml, an XML-encoded file
that contains a element. This element is a UTF8
encoding of the relative URI pointing to a .dae file. If the URI
contains a fragment then the indicated element is the starting point
for application loading of the .zae archive. Otherwise, the
element will be the starting point for application loading
the .zae archive. If neither of these conditions is met then the
behavior is undefined.

The URIs in the .zae files can reference any other file in the archive
using relative paths from the root of the archive, in accordance with
the URI standard.

The archive itself may include other archives (zip, rar, kmz, zae).
The URI to reference a document inside a nested archive, itself
inside the .zae archive, will use the name of the nested archive in
the path.

For example:

1
./internal_archive.zip/directory/document.dae#element

It is not possible to reference content outside of an archive using a
relative URI, but it is valid to reference content using an absolute
URI, such as:

1
file:///other_directory/other_document.dae#element