pichou Posted July 19, 2018 Share Posted July 19, 2018 Hi everybody, I have a plane with material and diffuseTexture. The image used for the texture is a png with transparent background. In order to keep the transparent background in babylon, I set useAlphaFromDiffuseTexture = true; on the material. But now I want to see the shadow of the image. But I cant because of the useAlphaFromDiffuseTexture parameter. So my question is : Is there a way to have the shadow of my png image following the transparent and not transparent part? Thanks for your help! Pichou Quote Link to comment Share on other sites More sharing options...
Guest Posted July 19, 2018 Share Posted July 19, 2018 Do you need pure blending or just alpha testing? From what I understand you may only need alpha testing that you can achieve with useAlphaFromDiffuseTexture = false and matherial.diffuseTexture.hasAlpha = true Then shadows will work directly Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 19, 2018 Share Posted July 19, 2018 @pichou How many bits is your PNG image file including the alpha channel? This may not be contributing to the issue, but good info to know. DB Quote Link to comment Share on other sites More sharing options...
pichou Posted July 19, 2018 Author Share Posted July 19, 2018 Oh yes @Deltakosh hasAlpha is working perfectly! The result is awesome! Thanks! Quote Link to comment Share on other sites More sharing options...
pichou Posted July 21, 2018 Author Share Posted July 21, 2018 Ha, I know why I haven't used the hasAlpha property before. It is because I also play with the visibility of the mesh. And with hasAlpha, when you change the visibility different to 1, the transparent background becomes black. But with the useAlphaFromDiffuseTexture property, the visibility is change correctly and the background stays transparent. So I am stuck with using the useAlphaFromDiffuseTexture to have the correct visibility and transparent background or with using hasAlpha to have the correct shadow. Is there a way to have both? Thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted July 23, 2018 Share Posted July 23, 2018 Unfortunately the shadow can't let the light goes through a transparent surface (I mean progressively). Either the surface blocks the light or either it lets it go. Can you create a PG with your black transparent background issue? I can have a look to see if we can improve it 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.