is there a good tutorial on terrain editor?

2.3k views Asked by At

I am new to 3D Game programming, now studying a lot on DirectX and OpenGL, on Windows. But I come up with making a terrain editor, But I cannot obtain any open tutorial or ideas on the web.

is there a good tutorial or open source code for learning this?

Simple one is fine, I just wonder how to elevate or lower terrain, or putting a tree on the map, like the following video.

like the following video: http://www.youtube.com/watch?v=oaAN4zSkY24

1

There are 1 answers

2
vallentin On BEST ANSWER

First I want to say if you haven't chosen between OpenGL and DirectX, then it would be a good idea to do so. My choice is to use OpenGL since OpenGL is cross-platform and works on Windows, Linux, Solaris, Mac, Smartphones, etc. Where DirectX only supports Windows machines.

I can't give you a tutorial or open source code, since this is kinda big, even just a "simple terrain editor", that is still a very complex thing. Though, what I can give you, is some points you need to know about and read about, which if you know these then you will be able to create a "terrain editor".

Points you need to be able to do.

  • VBO's
  • Shaders
  • Multi Texturing
  • Picking / Ray Picking / 3D Picking

VBO's

A VBO or Vertex Buffer Object, is a way to upload vertex data (positions, normals, texture coordinates, colors, etc) to the GPU itself, this allows for really fast rendering and this is also currently the best way to render. Be aware that this is an OpenGL feature, though DirectX might have a feature like this as well.

Shaders & Multi Texturing

Shaders is for shading/coloring vertices and fragments of all primitives. OpenGL uses GLSL where DirectX uses HLSL, they are both very similar.

Multi Texturing is basically where you bind multiple textures and then through a shader calculate which texture to use for the current vertex/fragment. This way you will be able to achieve what you saw in the video.

Picking / Ray Picking / 3D Picking

Picking is the process of "shooting" a ray from the camera (3D space) or the mouse (2D screen space), then each time the ray hits/collides with something those things will be returned to the user. In you case, you would use the mouse (2D screen space) to create a picking ray, and then at the point on the terrain the ray hits, that is the point where we would want to change the terrain.

If you know nothing about Picking then try Googling, I found that it can be really hard to find good results for 3D related things as well, so if you want to you can read a question I posted some time ago here on Stack Overflow (click here to see the post), the post covers 3D Camera Picking and 2D Screen Space Picking, and there is code and I added my final code to the post itself also.

Extra

If you combine all these things you will be able to create a "terrain editor".

Some of the things I've explained might be OpenGL related, but there sure are things in DirectX which can perform the same kind of things.