Is it possible to mix materials or blend textures?

Is it possible to do something along the lines of mixing materials in Playcanvas? or even mixing textures?

So in other 3D packages you can do something like the below to blend between materials/textures.

Material blending. (In blender it’s Shader)

Texture blending.

The case use is for helping eliminate tiling in larger objects or objects that are used frequently to make them feel diverse depending on the case. Using world space to offset textures, object space, terrain etc.

I’d imagine this would be handled either using shaders within playcanvas but also a potential to use straight up magically coding within JS to deal with it somehow too.

I’m also just curious if you guys are working on making something like this for the editor! Either way thanks for the help

-AJ

Hi @Robotpencil,

You can definitely do so with a custom shader and a mix/smoothstep method. This requires some knowledge of GLSL.

For example I’ve been doing this for rendering splatmaps on terrains:

There is a new detail map channel that has been recently added to the engine. Not yet available in editor, but it’s the closest thing you can use to blend two textures together without writing custom shaders:

AMAZING! Thanks for this!

For the terrain mix shader check this tweet on how the code is structured:

1 Like

If I want to combine 6 or more different PNGs (with alpha) into one diffuse texture for a material, would this be the recommended workflow?