Now I want to use canvas as the texture of the mesh. Using HtmlElementTexture and PBRMaterial can meet my requirements, but I am not sure if this is the best way. And I found that the fill color of canvas is black. If I want the fill color to be How should I do transparent color?Even though I used CreateFromBase64String, the effect is the same.Because I use an external library, I cannot provide a playground. The following is part of my code.I can provide this base64 if needed
const canvas1 = document.querySelector('.heatmap').children[0];
console.log(canvas1)
var texture = new BABYLON.HtmlElementTexture("", canvas1, {
scene
});
// const textureInBase64 = canvas1.toDataURL();
// console.log(textureInBase64);
// var texture = new BABYLON.Texture.CreateFromBase64String(
// textureInBase64,
// "theTexture",
// scene
// )
var material = new BABYLON.PBRMaterial("", scene);
material.unlit = true;
material.alpha = 1;
material.albedoTexture = texture;
// material.albedoColor = new BABYLON.Color3(1, 0, 0);
box.material = material;
This is the result of demo: