# Tiled Terrain - where to start

Hey all,
I was hoping someone could point me in the right direction for where to start here.

Context:
I’d like to create a retro tycoon-style terrain editor.

One like in this package:

Web Demo:
https://www.tycoontile.com/demo/

I understand how to create a mesh and manipulate heights.
But what I’m currently stuck on is getting the terrain to render the proper texture/shader depending on the applied “ground type” at a coordinate (eg. green for grass, brown for dirt, etc…)

My Thought Process:
My idea would be to create a 2d grid that would store the type of terrain for each grid coord. But that is where I’m kind of stuck. How would I “color” each tile in the mesh to be the appropriate color? I’ve implemented and followed tutorials on how to set the color of a vertex based on its height. But how do I translate a 2d grid to apply the proper texture to each “tile” on a grid?

Thank you

I’m not really sure I understand your problem/question. The images in your link don’t look textured, just vertex colored. So giving each vertex a color and picking a vertex colored shader should be enough. Keep in mind that pixels in a triangle get interpolated between their vertices. So usually you would want separate vertices (not shared ones!). Look up “faceted mesh/shader”.
You could also just have a 4 pixel texture with your height colors and set the UV’s to the center of the desired pixel. So all 3 vertices of a triangle would point to uv = 0.25,0.25 for example.
The question is also, when there is a ready solution why don’t you pick that one instead? Could safe you some time and hazzle.
Also I would avoid to call these “tiles” because that could confuse with Unity’s 2d tile system. But I have no better word for it either.

1 Like

That makes sense to me now, I wasn’t sure how the blended color would work with vertex colors but I get the seperate vertices idea!

The already made solution costs \$ and half the fun is learning anyway

Thanks for your help, I’ll look into it!

1 Like