Importing blender model into DirectX 11.2 C ++ application

I am new to DirectX applications, with decent knowledge of C ++ and some experience with Blender. So for beginners, I would like to know how one can import, say, a UV sphere from Blender into a DirectX 11.2 C ++ application. I am using the november edition compiler. Is there a tutorial on working with Blender models in DirectX applications that is up to date? Since I read that .X format is no longer supported after DirectX 10 and I need to use it in DirectX 11.2 environment. I hardly know what to do or which direction to go in, so any help would be greatly appreciated.

+3


source to share


2 answers


If you just want to render some 3D objects with native DirectX, there is no other way than to do all the initialization stuff by writing a file loader for some format that Blender can export and set up the appropriate render pipeline. Indeed, the road is long until you see your Blender model in your own application. But if you intend to write your own graphics engine, this is the way to go after all. If that's not your goal, I recommend that you use an open source 3D engine of your choice.

I used a very good online tutorial on a web page that unfortunately no longer exists and of course the MSDN library to learn about DirectX 11. You can still find these tutorials on the internet archive . Also, I found another tutorial that seems to look good at first glance.



Unless you need to do the special things that Blender has to write to the file you export, I suggest using the .obj format as it is easy to understand and download.

By chance I am writing my own graphics engine at the moment. Therefore, if you have further questions on this topic, do not hesitate to contact me.

+4


source


You can always create your own format if it's, I don't know, just for some school project or something similar (wild guess). Format the data the way you want, for example:

X,Y,Z,R,G,B\n
X,Y,Z,R,G,B\n
X,Y,Z,R,G,B\n... 

      

for vertices, and after you list all your vertices, you can use some char like '$' or '%' or something similar, which means the end of the vertices and the start of the indices, which will make it easier to parse later. You can assume this is always a TriangleList topology, but you can also highlight the first line of the file for configuration and have int 1, for example, imagine that you will be using a trinagleList and so on ...



Hope it helps!

PS: Julian's answer is better, in my opinion, it's always good to learn new useful things for future projects (like in Bioware: D), suggesting an alternative here.

+2


source







All Articles