Jump to content
  • Advertisement
Sign in to follow this  

X file - Terrain

This topic is 4371 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

Hello everyone, Ive been visiting this website for a long while now, and finally just registered heh. Anyway I just have a quick question. I'm creating a 3D terrain / scene editor and while I can already use MDX 1.1 included librarys to load and view static meshes and animated meshes I'm just wondering what everyone thinks would be the best approach to what I'm trying to achieve. Trying to achieve: I'm creating in 3D studio max my (base) terrain, lets say its 1000.0 units in length, 1000.0 units in width, 100 lenght segs 100 width segs and 20000 total faces. There will be no animation, no texture, no materials. Im trying to figure out the best approach at reading the .X file to "only" gather the vertice and normal information. I would then take this information and toss it into 2 arrays, 1 for (x,y) and 1 for (z), then using vertex and index buffers render the terrain. The reason behind wanting to gather this information is so when my (base) terrain is rendered I will be able to use the mouse to push & pull vertices as needed in the editor while placing other actual mesh objects in the world. Which then I would save to some type of file format I come up with for actual use in the engine. I guess im just looking for some feedback on what everyone thinks would be the best approach for this, using .ASE or .X files, using the helpers included with MDX to parse this information like I'm parsing .X files for animated meshes, or if I should just create my own file reading class specific for this job. Any ideas, referances, links, thoughts would be greatly appreciated. Thanks, Andy PS Suppose I should also state that the editor is being built using C# & MDX 1.1

Share this post

Link to post
Share on other sites
Are you using your base mesh (from 3dsmax) just to provide a flat template? Your code/editor being the part that actually modifies the terrains appearance?

If so, it strikes me as overly complicated - you could just generate the same thing on the fly in your application [smile]

Or, is the base mesh going to have some form to it - will it have, for example, a default set of hills/valleys/whatever?

Bare in mind that collecting normal data and then modifying the heights will invalidate it. Changing one of the height values may well require you to recompute a small region around the changed height value - not just the individual vertex that changed.

Using .X files is fairly convenient simply due to the existance of D3DX, but there are lots of open-source file parsers on the internet should you wish to try a more exotic format. Loading direct from a .3ds or even .max file shouldn't be too hard given a bit of research...


Share this post

Link to post
Share on other sites
Thanks for the reply,

Basically the base terrain I create in 3d studio max will have hills, depressions, etc.. as a sort of starting point.

The editor will be able to (tweak) those x,y,z coords as needed in order for world objects to look right in the scene.

I know in 3dS I can just (xRef) a scene object and do the checking that way, but that would just be to easy:) Plus I would like to keep everything I need in my MDI application that will consist of the editors / engine testing etc..

Im leaning towards just creating my own parser for .x files becuase all I want out of 3d studio is the x,y,z coords, I wont even be creating a mesh object out of the terrain.

I guess another example of what im trying to achieve would be that I have my base terrain loaded up in the editor and I decide I would like a pond to be placed somewhere, so in the editor I would check some input controls stating that when I push -Y down on a specific point I would like all surrounding vertices in a radius of 10.0f to follow the depression but for every
2.0f += 20% of the depression total.

Hmm decisions,
Talking about this helps in some wierd way lol

I suppose another route I could go is to just use 3ds as the pure editor but I would still need to have access to the x,y,z coords of the terrain so that when I create my character he wouldnt fall through the ground.

I cant remember, (maybe I'll go check now) but does creating a mesh object and using a mesh container allow me access to the values in the vertex & index buffers?

If so then I suppose I could just make this alot easier on myself and import the terrain as a mesh object, and pull those values out so I have access to them.

And if not I can just continue to write a parser that gathers the information I need.

I guess to sum up this overly long post of me rambling I'll state that im trying to get away from creating 3d terrain by just creating an array of [x,y] and then loading in a grayscale heightmap for the array of [z]. Doing so just doesnt seem very pratical as in my mind its not exact. I want all the control I can get in forming my small 3d world.

Anyway thanks for the reply and any further comments would be appreciated,

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!