ryvo Posted December 28, 2015 Share Posted December 28, 2015 Hi, I'm new to BabylonJS and I need an advice concerning shadows. In the attached project I tried to make a little dungeon. There's a torch mounted on one wall with. The torch is the only source of the light in the cave. Walls behind the wall the torch is mounted on should be in the shadow but they are lit. I don't know why the shadow doesn't work. Please advise.Thanks in advance. Vojtech.dungeon.zip Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 29, 2015 Share Posted December 29, 2015 Hello, Welcome I looked at your code, and I didn't see any problems linked to your game.I understood the issue you are trying to solve, and I reproduced it in a playground : http://www.babylonjs-playground.com/#1AUY9H#1 The question is: why is the second wall lighten ? Quote Link to comment Share on other sites More sharing options...
ryvo Posted December 29, 2015 Author Share Posted December 29, 2015 Hello Temechon, thank you for your efforts. Yes, the question is why the wall behind is lighten. Your code is working. I'v changed it a bit so that it does exactly what my dungeon code does. I made original meshes invisible and created their visible instances. See http://www.babylonjs-playground.com/#1AUY9H#2 Each changed line is preceded by comment "// RYVO". The result doesn't look correct. Is there a bug in Babylonjs? Another example showing that instances of meshes do not drop shaddow is here http://babylonjs-playground.com/#1HRVL5#0 I create mesh instances not to load a mesh n-times for each wall. Quote Link to comment Share on other sites More sharing options...
chg Posted December 29, 2015 Share Posted December 29, 2015 In Temechon's PG try:shadowGenerator.setDarkness(0.0);ie. It's lit because of the limitations of lighting and shadows - if the shadow is not complete blackness then the effects of lighting are not completely cancelled out (in real life shadows are an absence of of light, in realtime graphics they are a tint draw over the scene after it has been lit/shaded) Quote Link to comment Share on other sites More sharing options...
ryvo Posted December 29, 2015 Author Share Posted December 29, 2015 Thank you chg. I set shadowGenerator.setDarkness(0.0); In the code here: http://babylonjs-playground.com/#1HRVL5#1I understand that if the shaddow darkness is > 0 then the shaddow won't be completely dark. But there's no shadow at all. Quote Link to comment Share on other sites More sharing options...
chg Posted December 29, 2015 Share Posted December 29, 2015 Thank you Advanced Member. I set shadowGenerator.setDarkness(0.0); In the code here: http://babylonjs-playground.com/#1HRVL5#1I understand that if the shaddow darkness is > 0 then the shaddow won't be completely dark. But there's no shadow at all.Oh, I'm not that kind of advanced member, I don't even use Babylon... so I won't even try and figure out why you're not getting a shadow there (ok, I tried a little but it wasn't anything that jumps out to a non-babylon user such as myself)Note: to Babylon people - you're wiki here: https://github.com/BabylonJS/Babylon.js/wiki/15-Shadows suggests only directional lights can cast shadows, I'm assuming that needs to be updated and is outdated info... NB: Seems to work if the instance of frontBox (frontBoxInstance) doesn't cast the shadow http://babylonjs-playground.com/#1HRVL5#2 shows are meant to be supported on instances I'm sure so that's odd ryvo 1 Quote Link to comment Share on other sites More sharing options...
ryvo Posted December 29, 2015 Author Share Posted December 29, 2015 Thank you chg. I'll create a new thread and report it as a bug. 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.