Tokkno Posted July 11, 2018 Share Posted July 11, 2018 Hello, 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. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 11, 2018 Share Posted July 11, 2018 Hello and welcome!! you can use texture.getContext().clearRect directly to fill your texture with alpha=0 values which will probably fix your issue Quote Link to comment Share on other sites More sharing options...
Tokkno Posted July 12, 2018 Author Share Posted July 12, 2018 Hello, Thank's for the answer, i tried it but my problem still there. I want the alpha around the circle but i still have the complete circle... Have you a solution ? Thank's Quote Link to comment Share on other sites More sharing options...
MarianG Posted July 12, 2018 Share Posted July 12, 2018 Hi. You can simply apply a blur as filter. Like here: http://www.babylonjs-playground.com/#9U086#208 Arte 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted July 12, 2018 Share Posted July 12, 2018 If this is not what you want please provide a repro in the playground, I'll make it work for you Tokkno 1 Quote Link to comment Share on other sites More sharing options...
Tokkno Posted July 13, 2018 Author Share Posted July 13, 2018 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 Thank's 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. index.html Quote Link to comment Share on other sites More sharing options...
Tokkno Posted July 13, 2018 Author Share Posted July 13, 2018 20 hours ago, MarianG said: Hi. You can simply apply a blur as filter. Like here: http://www.babylonjs-playground.com/#9U086#208 Thank's but i want something more generic. I dont understand why the texture is perfect with a black background and wrong with a transparent background. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2018 Share Posted July 13, 2018 Ok now I understand the issue. The diffuseTexture can only do alpha testing. You want alpha blending so you have to use the opacityTexture: https://www.babylonjs-playground.com/#WRNZ81#5 Quote Link to comment Share on other sites More sharing options...
Tokkno Posted July 25, 2018 Author Share Posted July 25, 2018 I still have a problem with opacity texture, if some are at the same position, the texture blinks. But also i tried to put the texture on differents position and it's now ok. Thank you for all ! :p GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.