Blender export file with text

Started by
4 comments, last by Daaark 11 years, 7 months ago
How do you export information from blender to import in directx?

i guess i would need a list of all my triangles from the model like this:

count
x,y,z , normal, u, v , texture name
x,y,z , normal, u, v , texture name
x,y,z , normal, u, v , texture name
x,y,z , normal, u, v , texture name
x,y,z , normal, u, v , texture name
x,y,z , normal, u, v , texture name
x,y,z , normal, u, v , texture name
x,y,z , normal, u, v , texture name


which export format do you use when using blender?

i am using DirectX11 and i want to read the triangles so i have full control over them.
Advertisement
Open the script editor in blender, and write out a python script that saves that information to a file.

http://www.blender.org/documentation/blender_python_api_2_63_21/
Ahh great! then i can custom the export file myselft! perfect!
If you are trying to get a .x file, blender already comes with a directx script to export data in that format. If you are trying to create your own format, then yes, you must learn the blender python api to pull data out and format it however you like.
I think i will try to export a new format that is good for me.
However i am not sure how to map the correct texture with the specific triangle.

I guess i have to load all textures and then map the texture array position to the triangle in some way...

hm....
Sort your faces by material, then write them out like that. Much easier when you go to render.

Material 1

x,y,z , normal, u, v
x,y,z , normal, u, v
x,y,z , normal, u, v

Material 2

x,y,z , normal, u, v
x,y,z , normal, u, v
x,y,z , normal, u, v

etc...

But it will work best if you can make your models only use 1 material.

This topic is closed to new replies.

Advertisement