Jump to content

Dynamic textures - transparence


Recommended Posts



I'm new in babylonjs and i develop a game viewer with server (with socket.io). But for few days, i have a problem. I use dynamic textures for my textures because i want to modify textures without recreating them.

I can't use playground because my code depend of a server and nothing will appear in playground without the server. I will take screen and i have a little idea of the source of problem.

When i use texture.clear(), i have the texture that i want but with a black background (i want a transparent background).

When i don't use texture.clear, the background is transparent but the image is not perfect.


Thank's for your attention


Ps: Sorry for language mistakes, i'm french.


with clear.PNG

without clear.PNG


Link to comment
Share on other sites

Hello and welcome!!

you can use texture.getContext().clearRect directly to fill your texture with alpha=0 values which will probably fix your issue :)

Link to comment
Share on other sites

16 hours ago, Deltakosh said:

If this is not what you want please provide a repro in the playground, I'll make it work for you



I write the code on playground but i can't upload the img src so i give you them separately.

img.src didn't work with external image hoster because it's unsecure. I give you the playground and the image.

Playground URL : https://www.babylonjs-playground.com/#WRNZ81#4

img URL : https://image.ibb.co/nr4VMo/10.png



Thank's for your time.




Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...