New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shadow maps - Casting shadows on transparent plane #1791
Comments
OK tried workaround did not work as I cannot get any shadow casted on a transparent texture mapped plane... |
I don't think that's possible. |
I'm not sure I understand the question but shadows should get casted on transparent materials. What shouldn't work is light shining through the transparent materials. That is, everything is either full opaque or fully transparent for shadows, there no in between, independent of material transparency. See also discussion in #1509 |
Yeah, I think that's what he means. |
For reference, if anyone needs it http://pastie.org/5088640 |
@skrat Thanks a million for that shader. Works perfectly for a shadow catcher! |
@etx uh, what does that shader do? :U |
It just gives me the shadow w/ alpha and the rest of the object with that shader is invisible. It's similar to a shadow catcher in CGI software. I'm using threejs to render a product over a photograph, so this is very useful. |
Oh right. So it gives you black texture with the visibility stored in the alpha channel. Correct? |
Yep! |
@etx How can you accomplish this using the shader above? what I get is just a black plane...... |
I have been looking for a way to get his effect, however, using the snippet above I'm getting a |
@skrat any chance you can re-upload that shader? the pastie link doesn't work anymore and I have encountered the exact same prob..thanks in advance! |
@etx @skrat could you please please reupload an updated shader? The one you posted doesn't seem to work anymore, like @JosephClay I get the "shader couldn't compile" error... |
Try |
@WestLangley do you think we should promote |
@WestLangley thanks a lot - that solved it. @mrdoob I think it's a super useful feature which many know from GCI so it might be a good promotion for core |
I do not have a strong feeling one way or the other... If I am not mistaken, it suffers the same defficiency as |
Yeah, it's a mask. Basically how the old shadows used to be. |
Hi, ShadowMaterial sounds like exactly what I need and I am so happy that you've implemented it - but I can't work out what version of three.js I need to download/link to to get it to work. Can you point me in the right direction? |
|
Thank you! I still get THREE.ShadowMaterial is not a constructor though. |
Is not included in the build yet, it's in the examples folder. You need to include it separately: <script src="js/materials/ShadowMaterial.js"></script> |
would promote it to core as well, it's 4kb |
Perfect, thank you! I looked for the shadowMaterial file before and couldn't find it. |
As of |
@mrdoob great move thanks |
Thanks. |
Hi,
I need to cast shadows on a transparent plane in order to get only the shadow shown and not the material applied to the plane (I want it fully transparent). Is this possible in three.js? I am using
THREE.SpotLight
as light source.As a workaround solution I think I could apply a fully transparent texture map as a material and see if works as expected but was wondering if I could manage to get this effect just tweaking standard material properties.
Thanks
The text was updated successfully, but these errors were encountered: