Advertisement

Scalable shader to blend multiple materials in general form

Started by August 24, 2024 10:20 AM
10 comments, last by kotets 3 weeks ago

My algorithm / logic is maybe a bit random, first thing I ended up with, so vertex re-use patterns become really strange with a lot of materials 😂

Purple = reused vertex. Empty = duplicated vertex.

So a chunk (32x32x32 in my case) with ≥ 4 materials might have its reuse rate lowered, but these chunks are pretty rare in general and even when they happen, there is usually a biome transition or some specific place, so it reduces reuse only around transition area.

But as a benefit — it is a single material and one shader for every possible terrain material in the game, under a switch statement in the fragment shader, blended using 4 blend weights.

Advertisement