Jump to content
  • Advertisement
Sign in to follow this  
jagguy2

X file or mesh with 3D app

This topic is 3970 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

q)i want to create a model with Blender and import it into directx. Do i save it as a X file or just a mesh file somehow? q)The reason i ask is because i need to know the height of the object as i want to go over it with a camera so I need the Y value of where i am at. Can i get a current height value of the object i import in from Blender

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by jagguy2
q)i want to create a model with Blender and import it into directx. Do i save it as a X file or just a mesh file somehow?


sorry, I can't answer your second question.

To your 1st Q:
Yes, you must save it as a .X file in order to use it with the D3DXLoadMeshFromX()-type functions. To do this, you must export the model you currently have open, with File->Export->.X File (I havent used blender in a while, look for export though, then the .x extension.)

I have used blender and have tried saving and then using exported .X files. It was mainly hit-and-miss (mostly miss). For some reason, the D3DXLoadMeshFromX()-types wouldn't work with the exported files. I even tried using other .X exporters available at the blender site with no luck.

I would try saving under a more structured format (.3ds for example), loading that file into a different modeling program, then export to .X with that other program (or just not use blender :/ , even though I do like it's interface)

Hope that helps

Share this post


Link to post
Share on other sites
Yes your post helped thanks.

q)I found the export into X file. Creating an X file eg for terrain isnt useful if i cant get the current height of what triangle i am on. Also for collisions i need the world coordinated of an object.
Can i get the X,Y,Z point of a triangle somehow of a loaded X file?

Share this post


Link to post
Share on other sites
Quote:
Original post by jagguy2
Can i get the X,Y,Z point of a triangle somehow of a loaded X file?


Yes, though not easily. You can access the data contained by the mesh's vertex buffer. It contains the position, texture coordinate, normals, etc of each vertex.

Share this post


Link to post
Share on other sites
ok by the sounds of it i dont load a terrain into an X file but to load a another file format eg raw is very complicated and to get the Y position requires a lot of code .

This is a confusing problem terrain loading

Share this post


Link to post
Share on other sites
You don't need to use a mesh for that. Just load the image, and generate triangles based on the height data it contains and render them yourself.

Share this post


Link to post
Share on other sites
if i have a terrain with hills ,valleys etc it is complicated to come up with a few thousand triangles, textures and vertices and indices by hand

Share this post


Link to post
Share on other sites
Quote:
Original post by jagguy2
if i have a terrain with hills ,valleys etc it is complicated to come up with a few thousand triangles, textures and vertices and indices by hand


Not really. You can do it in a couple for loops. For each x and y iteration of the loops, create a triangle with vertices who's y position is defined by the value in the image at that point.

The really complicated stuff will come later when you have to optimize it with a LOD algorithm.

Share this post


Link to post
Share on other sites
isnt using a terrain generator much easier then all by hand because it is very complicated to work out where a dozen hills , valleys and lakes should be in 60000 triangles.

Share this post


Link to post
Share on other sites
You're missing the point: you do generate your terrain in another program/generator/whatever. You then store the generated terrain info in an image file. You load the image into your game, and position vertices based on that info.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!