An Issue with MixMaterial and TerrainMaterial functionality

I’m trying to create a story/game that involves a textured terrain, so to avoid jagged faces between different textures, I turned to the creation of a MixMaterial. See a PG here. It works just fine :slight_smile:

However, when I try to run it locally with BJS 4.1 using the same script as the PG, I get this error at :

TypeError: BABYLON.MixMaterial is not a constructor

Anyone know why? Do I need to get an “addon” script for BJS 4.1 for this functionality?

I also tried TerrainMaterial and get the same error.

cheers, gryff :slight_smile:

Are you including @babylonjs/materials?

Stackblitz seems to work, but I have all the dependencies installed.

@Devin_Wright : I’m not a typescript user Devin. I just model then add javascripts to my projects using babylon4.1.js in the script list on my index.html page.

That is why I asked if there was an “addon” script of some kind.

cheers, gryff :slight_smile:

Ahh I see. Where exactly are you getting babylon4.1.js? Are you by chance grabbing it from here?

I think you also will need to include <script src=""></script> in your html maybe.


@Devin_Wright : Ok, I seem to have it working now. So TY for your ideas and pointers. Only issue seems to be a little more laggy initially - but then I have no idea of the complexities of what is going on.

Now to test with a more complex terrain.

So TY again - a big help :slight_smile:

cheers, gryff :slight_smile: