Terrain Stencil Demo Advanced[Nodes]

Hi! Due to Thatimsters question I decided to make this little demo which introduces to a very advanced method for storing multiple tiled textures in terrain and blends them with one texture. It can use up to 5 textures.

The .blend is aviable here:
Terrain Demo Advanced

Feel free to append materials or node setups from it. The textures are made by nobiax

Hm… Now I am thinking what is more effecient for framerate - either mixing between 2 colors or multiplying 2 colors and than adding colors? Which method affects framerate more?

I mean either:


cola = mix(col0, col1, blendmap.r)
colb = mix(cola, col2, blendmap.g)
colc = mix(colb, col3, blendmap.b)
colfinal = mix(colc, col4, blendmap.a)

or


cola = col0 * ((1 - blendmap.rgb) * blendmap.a)
colb = col1 * blendmap.r
colc = col2 * blendmap.g
cold = col3 * blendmap.b
cole = col4 * blendmap.a
colfinal = cola + colb + colc + cold + cole

Which method would provide better framerate?

Why not try both and test it somehow? Maybe throw in a function to track execution time?

Hm… In nodes? Is it possible? If it’d affect FPS much, I may try it, but I don’t think that those stencils affect it so much. What math is behind the mix()? If it is more than vector * vector and vector + vector than the second version will run better.