How to use texture in imported model for TerrainMaterial.mixTexture?

Hi,

the following article shows how to create a material with texture splatting:

Now, I have 3d model with included RGB texture, which I would like to use as the source for .mixTexture property. However I dont know how to access the texture from model to pass it into mixTexture.

Here’s an example with the model: Babylon.js Playground

Thanks for any advice.

Hello and welcome!

First we need to find the terrain mesh

const terrainMesh = scene.getMeshByName('terrain')

Then use it’s albedo texture as mixmap texture

terrainMaterial.mixTexture = terrainMesh.material.albedoTexture

Example - https://playground.babylonjs.com/#1AERE4#4

3 Likes

Perfect, thank you so much.

1 Like