Jump to content

Transparent object shadows


kotegaeshi
 Share

Recommended Posts

Hello.

Is there any possibility to have nice shadow of a transparent object? With .setTransparencyShadow(true) the shadow of a transparent mesh is just as "dark" as for a non transparent mesh.

We tried to make 2 lights and 2 shadowgenerators, one for transparent meshes and an other for the non transparent meshes, setting the transparent generator to show lighter shadow (by setDarkness(0.5), or with light.intensity = 0.5), but the result is not good, because the 2 shadows are added together at the intersection.

Is there any possibility to show not added shadows at the intersections? The non transparent darkness (full dark) should not be even more darker with a lighter shadow on it.

https://www.babylonjs-playground.com/#WTHS5J#1

Link to comment
Share on other sites

Well this is because shadows are computed as light removal. They remove light intensity where they are applied. So where the 2 shadows combine you receive no light at all hence the dark

Your best option would be to use the ShadowOnlyMaterial: https://github.com/BabylonJS/Babylon.js/blob/master/materialsLibrary/src/shadowOnly/babylon.shadowOnlyMaterial.ts and probably update the shader to add color instead of blocking light

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