How to convert base64 image data into Texture in the babylonjs engine,

When I was loading textures for babylonjs, my colleague gave me textures that were not in the usual network address, but in the already parsed PNG or JPG base64 data format. If I reference the default material, there is no problem, but if I want to implement referencing in shadeMaterial, I will encounter the problem of not being able to load it, and I can only regenerate the texture. However, it seems that I cannot find a method to create textures using the base64 format in the documentation. Is there a way to achieve this situation

Have you tried CreateFromBase64String()?

Edit: or from the constructor as in this playground

2 Likes

The first sentence in the docs for the Texture class:

https://doc.babylonjs.com/typedoc/classes/BABYLON.Texture

It’s often darkest under the lamp. :wink:

2 Likes