Sophie C Posted August 21, 2017 Share Posted August 21, 2017 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 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 21, 2017 Share Posted August 21, 2017 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. Quote Link to comment Share on other sites More sharing options...
Sophie C Posted August 21, 2017 Author Share Posted August 21, 2017 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! JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 22, 2017 Share Posted August 22, 2017 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. Quote Link to comment Share on other sites More sharing options...
Sophie C Posted August 22, 2017 Author Share Posted August 22, 2017 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 22, 2017 Share Posted August 22, 2017 Hello that's a constraint of the Shadow only material, it will always take the first light affecting the mesh: https://www.babylonjs-playground.com/#1KF7V1#2 So just invert declaration order of lights. I will add a light property to the shadowonly mat to let you define which light to use Sophie C 1 Quote Link to comment Share on other sites More sharing options...
Sophie C Posted August 22, 2017 Author Share Posted August 22, 2017 Oh my goodness that's dumb of me! Well, I'm glad that it was just a simple error on my part, that's a lot more fixable. Thank you for the quick reply, I think this post is solved! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 23, 2017 Share Posted August 23, 2017 My pleasure! 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.