Jump to content

Shadow on PNG image


pichou
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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