How to apply more than 4 textures to the mesh/terrain?

Hi all, I applied this Splatmap Project to my project and now I have 4 different textures for my terrain. In the shader code, I understand that it uses RGBA channels which is 4 maximum.

Is there any trick/pattern I can add more than 4 textures to the terrain? I want to apply some decals (based on the characters’ positions) so I need to exceed that number.

Here is an example image, let’s say I have 4 different textures on my terrain and need to apply decal to the terrain which requires me to paint another texture I guess.

(P.S. I need to do in the shader for performance reasons can’t use light cookies)

Hi @Ertugrul_Cetin,

The easiest way would be to use a 2nd splatmap texture, that will give you another 4 channels to use. But eventually you will most likely hit the max samplers limit which is usually 16.

A more advanced way is by using texture arrays which can bypass that limit, but that right now may require patching the PlayCanvas engine. @redka on the PlayCanvas Discord server showcased that.

Hope that helps.

1 Like

Thanks! Let me check that. You mean another Splat Map image like this above right?;
Screen Shot 2022-11-12 at 20.17.39

Yes exactly, and rework the shader to use both splatmaps, one after the other.

1 Like