Jump to content

Shadows in my dungeon don't work


ryvo
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

Thank you Advanced Member. I set shadowGenerator.setDarkness(0.0); In the code here:  http://babylonjs-playground.com/#1HRVL5#1

I 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

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