Transparency with white background

I need to display textures with white backgrounds as transparent backgrounds.

I know I can edit the image and replace the white with transparent. But I need to use a lot of online sources like this and it would give me a lot of extra manual work without automation.

Here is an example with cube:

(Please note, I don’t need a cube, it is just an example. Example of any kind of shape would be helpful.)

Is there a chance to make the white bg color transparent?

Thanks a lot,
Michal.

You could use a custom shader?

1 Like

thanks Carol,

that sounds nice.
But do you know about nice example for beginning?
I found 2 here: Putting Shader Code Into Babylon.js | Babylon.js Documentation but both are not usable.

In first one, there’s no effect after code changes. The second one is almost empty, so no chance at all to train by changing something.

Thanks.

The node material editor is a easier method of creating custom shaders: The Node Material Editor | Babylon.js Documentation (babylonjs.com), in fact, it’s a pretty simple shader to do: Babylon.js Node Material Editor (babylonjs.com)

4 Likes

Thanks Carol,

this helped a lot!

So, the final solution is here: https://nme.babylonjs.com/#DT58R5#5

2 Likes