Friday, April 16, 2010


Learning some HLSL as the plan requires sometime more than what BasicEffect can handle. It doesn't do multiple diffuse textures per vertex. The plan is still very theoretical, and I'm not sure if I'm even smart enough to make it happen.

The screenshots before are simply a Miller projection wrapped around the grid. This means however that the texture border's don't line up to the grid borders. What I want is a more 'cellular' look and feel to it, along with a height map.

Cell Influence

foreach (neighbor in neighbors)
    foreach (vertex in neighbor.Vertices)
        Calculate distance and then cell's influence on this vertex
        Cell.NeighborVertices[ neighbor.Index ].Add( Vertex, Influence );

Now, we have a list of neighbor vertices that the cell has influence over. The distance and amount can be adjusted like a drawing brush - soft or hard brush. In this step, the neighbor vertices should be given a UV channel that lines up with the cell.

Blended Textures and UV Channels

Each vertex will have a minimum of three UV coordinates as it will have at most, three cell textures to blend (cell brushes shouldn't extend beyond one neighbor). Add in another texture channel or two for normal maps or detail overlays (just a tiled Miller wrap) and soon, every vertex has 5 UV channels. Currently I'm focusing on the first 3.

Paged textures will allow multiple textures to be used and not have to create channels in every cell for each texture. Each neighbor lookup will have assigned to a channels 1 or 2. Then just alternate channels for each neighbor. Except the 12 pentagons... Yeah, going to have to figure out something different there...

Height Maps

The current screenshots show a simple height-map retrieved from the diffuse texture. When moving to a more cellular approach, this kind of height-mapping won't be satisfactory. Instead, a series of small height-maps can be loaded and applied to cells individually. Using the neighbor influence lookup, the map can spill over and scale down into neighboring cell.

No comments:

Post a Comment