3

I'm a beginner programmer and new to Unity. I'm currently practicing hexgrid building with Unity5. My current hexgrid consists of flat hexes, which have either a grassland or ocean 2D texture. (Current hexgrid)

I'd like to have a sandy shoreline in my hexgrid (on grassland tiles which have ocean tiles as neighboring tiles).

My question is: what is the best, most efficient way to implement this?

I thought of making a texture for each possible shoretile, but that would be about 64 different textures depending how many ocean tiles the grassland neighbors and from which direction.

I also need "blurry" texture lines between desert and grassland hexes and deep ocean and shallow ocean hexes, and I have no idea how to do that...

Any advice is appreciated. Thanks!

EpicCheese
  • 35
  • 4

1 Answers1

0

I think you should only need 4 or 6 textures. With hexes you can only have two scenarios in a land/sea corner. Either the shoreline is forming a peninsula (convex land/concave sea) or a fjord (concave land/convex sea).

So two main trapezoid textures that paint a beach from the tile edge inwards would cover all land-beaches on peninsulas and all sea-beaches on fjords.

In the opposite case you'd just need a small triangular extension of that texture to fill in the gap between the trapezoids.

This is what I mean: https://i.stack.imgur.com/3OsY7.jpg

Source: I once tried to figure out how Alpha Centauri draws its terrain by analysing the texture files. I'm reasonably sure that's how they did it.

As for handling a desert, grass, sea corner I believe they first blended the land terrains and then overlayed the shoreline.

Kempeth
  • 1,856
  • 2
  • 22
  • 37
  • The way you see shorelines as convex and concaves is intriguing, but it brings a lot more questions and problems to my mind. I'm guessing the trapezoid textures here are like 1/2 hexas? Wouldn't that mean I'd have to stick 2 different textures on one mesh? – EpicCheese Feb 29 '16 at 17:19
  • @EpicCheese I'd make the tapezoids 1/4 the width of the hex just to avoid any overlap. I've added a link to an illustration what I mean. As for multiple textures. If that is a problem I guess you'll have to blend them before applying them to the mesh. – Kempeth Mar 01 '16 at 07:58
  • Thanks! This was helpful to some extend. – EpicCheese Mar 01 '16 at 12:24