Skip to main content
GameDev.net gamedev.net
🔒 Locked

Blender export file with text

Started by Kurt-olsson Sep 24, 2012 at 6:31 PM 4 replies 1.1k views
Original Post
Kurt-olsson
Kurt-olsson
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.
Daaark
Daaark
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/
Kurt-olsson
Kurt-olsson
Ahh great! then i can custom the export file myselft! perfect!
LevyDee
LevyDee
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.
Kurt-olsson
Kurt-olsson
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....
Daaark
Daaark
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.