Camera and tiles

Hello. Back again with a new post on the status of my terrain engine hobby project.

As I wrote in the last post, I have been working on this project for a little while already, and this post is also about things already added.

A terrain engine isn’t any fun if you can only look at from one angle, so I added a camera class. The camera can be rotated and moved, both in absolute and relative coordinates. It works good and looks good. However i can only move the camera with the keyboard right now. I think adding mouse control will be a good challenge in the future.

I decided to divide the terrain into smaller tiles. I made it so the height map is set to a certain size, and the tile size is set to a smaller size, and the terrain engine will create nice tiles from that. Works good, and the tiles blend together nicely.
I thought that dividing the terrain into tiles would be a good idea for several reasons:
-I can create and drop tiles on the fly, based on camera position. This will save memory.
-I need to optimize the terrain. It’s very slow as it is now. I can optimize more aggressively on tiles further away from the camera. When I add texture mapping, I can use lower quality texture on tiles further away.
-Each tile is drawn by itself, therefore the entire terrain is not moved to the GPU in one go.

There are also some drawbacks:
-I need to create a system to keep track on what tiles are in memory, witch I need to create and witch can be dropped.
-It might be difficult to optimize the terrain on the edges of each tile. There could be holes if I’m not careful.

Two tiles

Two tiles

Looks pretty good. πŸ™‚

I finished the system that creates smaller tiles from the large height map, so now I need to create a system that keeps track of the tiles in memory, witch are needed and creates or drops them as needed. Hopefully this should prove to be doable. πŸ™‚



Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: