Loading...
 
Texture blending        

Texture blending

Grit supports texture blending within a material by using UVW channels to control the sharpness and the weighting of the textures. Diffuse, specular and normal maps are blended together.

Setup

  • The second UVW channel controls the sharpness of the blend, by using the red channel: 0 red means total smooth blend and 255 total sharp blend.

Image
Example of the color in the second UVW channel, controlling the sharpness.


  • The third UVW channel is used for the different texture variation, follows this scheme:
    • Black: First texture
    • Red: Second texture
    • Green: Third texture
    • Blue: Fourth texture

Image
Example of the color in the third UVW channel, each different color means a different texture.


Although not yet tested it is possible to blend more than 4 textures but it could be expensive.

To paint the UV Channels, in 3D Studio max, use the vertex paint modifier, selecting channels 2 and 3 respectively. You will need to apply a vertex paint modifier for each channel (one for the sharpness, and another for the textures channel)

Material example

There are different material attributes that are useful for texture blending such as _specularFromDiffuse_ to reduce textures, and _textureScale_ to scale the UVs for each texture (In case one texture should be bigger than others)

Image
Texture blending example in Playground


 material "terrainLAY1" {
     blend = {
         {diffuseMap="textures/grass.dds", normalMap="textures/grass_N.dds", specularFromDiffuse={-0.5,0.2} },
         {diffuseMap="textures/dirt.dds", normapMap="textures/dirt_N.dds", specularFromDiffuse={-1.0,0.2}, textureScale={2,2} },
         {diffuseMap="textures/rock.dds", normapMap="textures/rock_N.png", specularFromDiffuse={0.0,0.5} },
         {diffuseMap="textures/beachsand.dds", normapMap="textures/beachsand_N.dds", specularFromDiffuse={0.5,0.8} },
     }
 }

Category:Guides?