Jump to content

Shadow-Only Material


Sophie C
 Share

Recommended Posts

This may be a dumb typo error, but I'm asking just in case it's something truly weird.

I want to utilize the Shadow-Only material, but it's not showing its effects. To clarify, using a default sphere and a directional light, I'm casting shadows on a plane. The shadows show on a non-Shadow-Only material, but once Shadow-Only is activated, the shadows disappear. (as exemplified by "testscene.js")

(Efforts to work from the sample playground have been weird. While I got the sample to work by downloading it, it will no longer load my obj files. Either problem is fine, I just want to know what I'm doing wrong, or what's happening. (as exemplified by "index.html"))

EDIT: I realised it has something to do with my hemispheric light, but I don't know why that is. I'd really quite prefer if I kept it, so if there are any explanations I'd be happy to hear it!

index.html

testscene.js

Link to comment
Share on other sites

Shadows only work with directional lights, I believe.  I have a scene using this material.  I did not want the light to be used for anything but the shadows.  I set the intensity, which is what is used to light meshes, to 0.  Shadows do not use this.  So keep your hemi, add a directional light for shadows with 0 intensity.  There is another way to isolate which meshes are lit by which lights, Layermasks, but this is more work.

Link to comment
Share on other sites

Thank you so much for the reply! 

Let me elaborate: I have been using directional lights to create shadows; the problem is that the mere presence of the hemilight is completely messing up the shadow-only material. When the hemi is there, shadows don't show up. The presence of the hemi is not affecting the shadow generator's ability to create shadows, however, because shadows still occur on the regular materials. 

Cute scene, nevertheless!

Link to comment
Share on other sites

What version of BJS / shadow material are you using?  There was a topic in Bugs with shadow problems related to skeletons and 3.1.

Also, another test might be to switch to a point for the semi.  Maybe hemi was added as shadow capable.  Hard to keep up.  I was using a point light attached to the camera for my scene lighting.

Link to comment
Share on other sites

I'm using the alpha, and the shadow-only is the add-on. At least, just adding a hemi to the sample in playground will cause the shadow-only material to completely fail. 

Here's a playground (if I'm doing this correctly): http://www.babylonjs-playground.com/#1KF7V1#1

The hemilight I was using to sub in for an ambient light, which I don't think exists in Babylon? I guess it's not as necessary because there's an ambient color for the scene but I'm just curious what's happening.

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