The goal: enable heightmap and texture blending between cells.
It sounds innocent enough - just fine affected mesh vertices and blend away! Four months of slow work (broken by countless TF2 sessions and some monumental Minecraft bases), and I've finally got step 1 working. There's still some clean-up work on step 1, but that'll be easier and the motivation is now returning.
The problems: The previous major version did a couple things wrong. I got heightmapping and texturing working over the entire sphere using a Miller projection. This had potential, but lacked in several areas: the 'hexness' of the map was lost and it required a very, very high resolution texture to look decent.
I wanted to maintain the hex feel of the map, yet be able to blend heightmaps to create continuous mountain ranges, sea beds, and other land features. Each cell has the potential to align differently in UV space meaning that seams wouldn't match up easily like a flat 2d grid. The first idea was to add more texture channels to each mesh vertex:
- Base cell UV's
- Neighbor channel 1 (neighbors 1 & 3)
- Neighbor channel 2 (neighbors 2 & 4)
- Neighbor channel 3 (neighbors 3 & 6)
- Optional detail channel 1 (micro detail - bumpmap, etc...)
- Optional detail channel 2 (macro, miller projection - color shifts, shading...)
Then to write all the testing tools to ensure that the mesh is being build correctly...
The testing tools allowed me to achieve a nice unwrap of the icosahedron mesh and from there to write a 2d-map importer... This step turned out very useful. I can open up Photoshop, set an indexed color palette, and draw the map over the top of an exported unwrap of the cell points, then read it back into the game.
Finally, the blending step. The problem lies in that each cell is independently textured. This will ensure better resolution when zoomed in without massive textures and help to maintain the hex board game feel. The first plan went something like this:
- Create base cells
- Build base UV coordinates as a single large hexagon or pentagon
- Find and sort neighbor cells
- Start building render mesh
- Subdivide each cell for the render mesh.
- Lookup neighbor mesh vertices 'affected' by each cell vertex.
- Take affected vertices appropriate texture channel (each vertex has 4+ texture channels - base, neighbor 1, 2, and 3) and align to the cell edge. This is the part that proved to take the longest and I've still got the texture blending ahead.
Edit:
Scrap that, polar's didn't work for helping with UV mapping. Things get too funky around the poles.
Random Picture
