Sign in to follow this  

Procedural Terrain Mesh Generation?

Recommended Posts

Mythics    135
Hello all,

I'm working on a game of sorts using mostly cubes (fairly minecraft-like).

I'm currently using 3D Perlin Noise with some custom tweaks to generate the terrain which works out fantastic, but I'm not quite sure how I should be going about rendering it in the best manner possible.

I definitely don't want to be over optimizing, but with the level of detail I'm going for, it's quite possible to have several million 'cube' faces visible at once. Instancing of individual faces certainly isn't desired in this case due to the expense there (tried it, obviously failed miserably due to the heavy amount of real time computations needed to translate/texture/etc).

So, my goal at the moment is to create some form of surface extraction algorithm. Rather than recreate the wheel, what might be out there to accomplish this simple task?

I'm obviously not just wanting to create a generic mesh with two triangles per every face, but slim down on those triangles when multiple faces are joined together on the same plane.

Any help, tutorial links, code, etc would be appreciated.

Edit: Thought I better specify, I'm using C# with XNA 4.0. I should be able to port most anything over though, but I'm sure someone has already done this in C# (xna shouldn't be terribly relevant I wouldn't think).

Mythics Edited by Mythics

Share this post

Link to post
Share on other sites
Dawoodoz    461
You can make a simple type of raytracing by storing the world compressed in a texture. HLSL with Shader model 4.0 and later have the "Load" and "GetDimensions" methods that makes it easy to read any type of information encoded in a texture.

Share this post

Link to post
Share on other sites
jefferytitan    2523
Hmm, I don't know a specific way, but one good way to start might be looking for neighbouring triangles with matching normals and shared vertices. You could go for a simple greedy algorithm, e.g. look for a triangle with a co-planar triangle strip along one edge, make it into a bigger triangle, repeat. However I do seem to recall that you can get graphics or physics issues if you have a large triangle sharing an edge with many small triangles.

See if the below helps:

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