Sign in to follow this  

.x Files and their use as terrain meshes

Recommended Posts

Hi, I'm currently coming towards the end of finishing the terrain/terrain editor component of my game engine. BACKGROUND At the moment I am storing the height and normal of each point on the terrain in a table and reading it back from the x,z position of the player to enable 'walking' on the terrain. As I want to be able to use terrains of any size I split the terrain up into a number of differnet meshes (all the same shape/size), this allows me to cull the terrain meshes that cannot be seen. However this means either saving out an .x file for however many terrain sections there are, or writing my own custom terrain saving/loading code. (At the moment I use my own terrain load/save code). I have since found that I can use D3DXIntersect using a ray cast downwards from the player to facilitate walking on the terrain, and retrieveing the normal for that point. Using this method would allow me to remove a lot of code in the engine, especially if I switched to using a single x file (for saving and loading). QUESTIONS Is using D3DXIntersect slow? (Or are there better methods out there, bearing in mind that the terrain is split up into smaller meshes and a first test is done against a bounding box). (I don't have the finished code to test this properly yet, and if someone could give some insight it would save me a lot of work) If I was just using one mesh would I be able to store all of the terrain meshes into subsets and test them for fustrum culling? Would this affect my terrain editor in the sense that if I changed the height at the edge of one submesh would it pull the vertices up on the adjacent submesh to match it, or in the editor would I need to put it back into one big mesh, then save out into smaller sub meshes again? I know that I could test all of these things myself, just the amount of reorganising in the code and stuff would take a quite a while, and if anyone has any answers/insight/good links to hand it would be much appreciated. If this makes no sense, or any points need clarifying, or whatever, just let me know. Thanks in advance!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this