miércoles, 18 de noviembre de 2015

Blend Modulate Textures

It's been a wile since I promised to do this tutorial so I finally decided to write it.
Sometime ago I came across a feature in the Source engine games that is called Blend Modulate Textures, they are a 2 channel texture that tells the LightmappedGeneric shader how to blend from $basetexture to $basetexture2.

Here is the wiki article: https://developer.valvesoftware.com/wiki/$blendmodulatetexture

Ok, so every texture has 4 channels Red Green Blue Alpha, blend modulate textures only uses the first 2 of those.
The Red channel controls the roughtness/smoothness of the blending, the more white the more soft the transition is. Try to avoid completelly black because that causes the shader to not have transition at all directly making a cut between the basetextures.
The Green channel is a multiplier texture of the blend, so the whiter it is the more $basetexture is going to be in that area, the darker more $basetexture2 is used.

So let's see how this can be used for improving a lot you level.

This is valve's most used blend modulate texture, it's pretty good and works nicely in most cases.
To blend dirt, grass, gravel, etc use the valve stock one. But if you are going to blend something with a bit more complexity, you may want to create a custom blend modulate texture.

This is one I made for one of the maps I'm working on:
Here is how the material looks in the game without any blendmodulatetexture.
Here it's how it looks with the valve stock one.
And finally here it's with the custom blend modulate texture made by me:
Take a closer look and you can see how the moss gets inside the cracks of the stone blocks, this really makes the transition to look a wole lot more natural.

This textures can be autored in any image editing software.
I suggest you to use for the Red channel some noise as base and then overlay like a height map of the texture if you have it so the deeper parts get a more easy/rought transition(remember to not go totally black).
In the Green channel again use as a base a heightmap from the basetexture if you have it, or an ambient occussion map that can be taken from the blue channel of your normalmap, blur it a little to smooth the transition and then add some noise to it.

It's a matter of testing it in the engine, I recomend making a small test map and when you create the material use the measurement orange texture as basetexture2 so you can see more clearly how your textures are mixing.

Here are some previous experiments I made on the matter:
Well. I think that's it for now. I will try to post again soonish.

No hay comentarios:

Publicar un comentario