<p>No idea about DirectX, but in OpenGL the buffers are just <a href="https://en.wikipedia.org/wiki/Vertex_buffer_object" rel="nofollow noreferrer">a block of binary data</a> so you can easily load and save them.</p>

<p>In any 3D framework, changing the object position to achieve a different relative arrangement of a scene is not done through the <em>view</em> matrix (that represents the camera position and viewing direction) but through the <em>model</em> matrix of each model. Note that the vertex and index buffers stay unaffected by matrix transformations, that is the main benefit of such pipelines.</p>

<p>Perhaps you could do your study with less effort using a 3D game engine, to list just a few:</p>

<ul>
<li><a href="https://godotengine.org/" rel="nofollow noreferrer">https://godotengine.org/</a></li>
<li><a href="https://www.unrealengine.com/" rel="nofollow noreferrer">https://www.unrealengine.com/</a></li>
<li><a href="https://unity.com/" rel="nofollow noreferrer">https://unity.com/</a></li>
</ul>

<p>I am not aware that any of them would support loading the raw buffers straight away, but they can load <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file" rel="nofollow noreferrer">OBJ files</a>. OBJ is one of the oldest text-based 3D model formats. It has a simple structure, so you can easily convert your buffer data to an OBJ file.</p>

CC BY-SA 4.0
2020-06-12T15:44:56.113Z
Yes, using a game engine to write a small application could be the simplest solution. For example Unity has APIs to create meshes from vertex/index buffers https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Mesh.SetVertexBufferData.html and other APIs to render them.
wip
CC BY-SA 4.0
2020-06-10T12:23:22.380Z
2020-06-10T12:23:22.380Z
Isolin
<p>I have many sets of vertex and index buffers that I’d like to render on to the screen. Ideally each model in different locations with-in world space. I’m actually doing a statistical study on spatial relationships between models in world space. </p>

<p>I have done a lot of reading on the DirectX graphics pipeline to try and get a basic understanding of how it works.</p>

<p>Instead of programming my own model viewer from the ground up, I thought I’d first take a look at some pre-built solutions first to save me the time. I found this: <a href="https://github.com/walbourn/directxtkmodelviewer" rel="nofollow noreferrer">https://github.com/walbourn/directxtkmodelviewer</a></p>

<p>From what I can tell, it only supports loading models from DirectX SDK .SDKMESH files and .VBO files. So 2 questions:</p>

<p>1)  How do I convert my vertex and index buffers to one of those file formats?</p>

<p>2)  For changing the models world space in the viewer, isn’t that done by changing the view matrix before uploading the model? </p>

<p>Also, if this can be done in standard 3D modeling application, that would be ideal. All I want to do is view the models in relation to each other. I haven’t been able to find any applications that accept vertex and index buffers in raw form though. </p>

<p>Thank you.</p>

<rendering><transformations><directx>
Converting Vertex and Index buffers to a File Format
junfanbl
# Converting Vertex and Index buffers to a File Format

(Asked by: username_0 on 2020-06-04)

I have many sets of vertex and index buffers that I’d like to render on to the screen. Ideally each model in different locations with-in world space. I’m actually doing a statistical study on spatial relationships between models in world space.

I have done a lot of reading on the DirectX graphics pipeline to try and get a basic understanding of how it works.

Instead of programming my own model viewer from the ground up, I thought I’d first take a look at some pre-built solutions first to save me the time. I found this: <https://github.com/walbourn/directxtkmodelviewer>

From what I can tell, it only supports loading models from DirectX SDK .SDKMESH files and .VBO files. So 2 questions:

1) How do I convert my vertex and index buffers to one of those file formats?

2) For changing the models world space in the viewer, isn’t that done by changing the view matrix before uploading the model?

Also, if this can be done in standard 3D modeling application, that would be ideal. All I want to do is view the models in relation to each other. I haven’t been able to find any applications that accept vertex and index buffers in raw form though.

Thank you.

**Tags:** rendering, transformations, directx


---

## 1 answers

### Answer by username_1 on 2020-06-10. Score: 4 | Accepted answer

No idea about DirectX, but in OpenGL the buffers are just [a block of binary data](https://en.wikipedia.org/wiki/Vertex_buffer_object) so you can easily load and save them.

In any 3D framework, changing the object position to achieve a different relative arrangement of a scene is not done through the *view* matrix (that represents the camera position and viewing direction) but through the *model* matrix of each model. Note that the vertex and index buffers stay unaffected by matrix transformations, that is the main benefit of such pipelines.

Perhaps you could do your study with less effort using a 3D game engine, to list just a few:

* <https://godotengine.org/>
* <https://www.unrealengine.com/>
* <https://unity.com/>

I am not aware that any of them would support loading the raw buffers straight away, but they can load [OBJ files](https://en.wikipedia.org/wiki/Wavefront_.obj_file). OBJ is one of the oldest text-based 3D model formats. It has a simple structure, so you can easily convert your buffer data to an OBJ file.

> **Comments:**
> **username_2**: Yes, using a game engine to write a small application could be the simplest solution. For example Unity has APIs to create meshes from vertex/index buffers https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Mesh.SetVertexBufferData.html and other APIs to render them.  

---

