Jump to content

Does a light need to be a parent to its proxy for shadows to work well?


ctarrington
 Share

Recommended Posts

Hi all

I am experimenting with lights and shadows in Babylon JS and really liking it!

I did stumble onto one thing that confuses me. Initially I was using an invisible box that I would use as a parent for a light source, a visible proxy for the light source, etc. Animate the invisible box and everything else follows nicely. This works fine for illumination. When I added shadows to the scene things broke down a little bit. If an object both receives and casts shadows then it fails to be illuminated.

Reversing the parent relationship fixes things - if the light source is the parent then illumination, shadows and animation all work smoothly.

Here are some playgrounds to show the different scenarios. I left out the animation as it doesn't seem relevant.

Light as parent to the proxy - Everything works
http://www.babylonjs-playground.com/#25VTCJ#0

Proxy as parent to the light - casting shadows works but receiving shadows causes the blue box to lose illumination 
http://www.babylonjs-playground.com/#25VTCJ#2

Proxy as parent to the light (receive only)  - casting shadows works, removed receive so that illumination works
http://www.babylonjs-playground.com/#25VTCJ#3

So, am I missing something? Or is having the light as the parent just the way to go?

Thanks
 - CT

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