Jump to content

Directional Light Behaviour


Recommended Posts

The BJS functionality for the Directional Light in scenes exported from Blender behaves in a way that is different from what I expect. An issue that I ran into a number of weeks back and brought back to me a few days ago by a post on JCPalmer's thread :


Tower of Baylon Released


I posted some examples of the behaviour on that thread as well as an image of how Directional Lights function in Unity 3D (scroll down).


In particular, this example of a row of blocks with the Directional Light placed in front of the blocks and close to them:


Example 3


Result: Some shadows missing and those that are produced are at an angle (normally, rays of light are parallel with a Directional Light)


This is another example (image below). In Blender I have placed the Directional Light behind a row of blocks with the light pointing away from the blocks(A). The image also includes a render of the scene in Blender( B) - note shadows are parallel and the direction follows light direction.. Blender is not worried about the position of the light, just the direction(rotation).


However, this is what the same scene looks like when loaded as a BJS scene:


Example 4


Again we get the black notch and no shadows at all. However, the correct block faces are illuminated correctly.


No idea why I am seeing these behaviours.


cheers, gryff :)






Link to comment
Share on other sites

They are not really directional shadows.



That is the conclusion I came to - kind of a best attempt at true Directional Light.


I guess when using Directional Light to get reasonable results,  it is best to remember to not put the light too close to objects in the scene.


cheers, gryff :)

Link to comment
Share on other sites

But I'm thinking also about adding support for shadows for point light and for true directional in a new version


DK: That would be good if it is doable without a serious hit on performance :)


Funny you should mention the Point Light as looking at Example 3 above, that looked to me more like shadows were created with a Point Light - rays of light coming from from a sphere and perpendicular to the sphere surface, as opposed to rays of light parallel to each other. I even wondered what it would take to make Point Lights cast shadows ? B)


But in the meantime people, be careful with the placement of Directional Lights


cheers, gryff :)

Link to comment
Share on other sites

I am totally for a better shadow system in general. Right now, I can't add shadows in my projects at all, because I work with big structures (big buildings for example, or even a city) .

Maybe I'm missing something, but I always have some kind of weird shadow 'cut' because my shadow map is not big enough.


Shadows for spotlights could be cool too!

Link to comment
Share on other sites

  • 1 year later...

Oh I thought you talked about light positioning (which is no more required for directional)


As we do not have cascading shadow maps, yes the distance is still a problem (you can increase shadow maps size)


I can't really increase the map size enough... I am trying to run it on mobile... so I  hit the performance limit pretty fast. :(

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...