Jump to content

Light from under the ground


mirco
 Share

Recommended Posts

Hi, i have a litte problem (hopefully). 

I try to implement a basic day-night lighting, including a small visualizing of it, to see whats going on. 

Now there is the problem that the light is under the ground, but the objects get the light through the ground.

For the Light I use a "DirectionalLight" with the current position of  x:4.33, y:-1.61, z:1.92 ( ground is at y:0 )

The direction of the light is set this way: light.setDirectionToTarget( new BABYLON.Vector3(0,0,0) );

 

I don't no if it matter but I have already deactivate "backFaceCulling = false" for the ground

Maybe someone can give me a hint how to solve my issue.

 

Attached i have a picture with my lightning issue.

The yellow point is the light.

Bildschirmfoto 2017-03-22 um 10.54.31.png

Link to comment
Share on other sites

V!nc3r Thanks, you are right, i only gave the tree the option to produce shadow, but not "receiveShadows"  :)

@jerome because I don't now when the light is under the ground. Here in this example the ground is plane, but later it will be a HeightMap or something like that.

Link to comment
Share on other sites

sorry I have a next problem, I have activate receiveShadows on the tree to remove the lightings from under the ground now I have a black tree all the time instead of the pink one. 

Maybe its related to my other problem, but I have tried it already without "flat shadings", but no better result.

 

without receiveShadows

Bildschirmfoto 2017-03-22 um 17.01.24.png

 

with receiveShadows

Bildschirmfoto 2017-03-22 um 17.01.44.png

Link to comment
Share on other sites

so useBlurVarianceShadowMap currently doesn't work with mesh`s that generate and receive shadows at the same time?

I tested the other options for the ShadowGenerator, but first I think its only the "quality" of the borders of the shadow, but I see that changing the option also reduce the realistic shadows.

 

shadowGenerator.useBlurVarianceShadowMap = true;

Bildschirmfoto 2017-03-23 um 00.00.03.png

shadowGenerator.useBlurVarianceShadowMap = false;

Bildschirmfoto 2017-03-22 um 23.59.49.png

Link to comment
Share on other sites

Ok, so I played around with Bias and disabled Blur but i don't find a good value for multiple different meshes and I don't can fix the problem with the light through the ground.

Maybe some other ideas to work around this problem? Or do you think its possible to fix this problem ?

Link to comment
Share on other sites

For the lights under the ground, I put the intensity 0

for to whether the light is under the ground, you know that the + is above the ground and the  in - is under the ground

if light.position.y > 0 // day

light.position < 0 // night

Link to comment
Share on other sites

yes, this works easy if you have a plane ground. But maybe not if I have a "sphere" world

A other problem when I don't activate receive shadows on objects, how can i handle a "cameras" moves inside a house. All Items inside the house will get light through the walls but it should be dark in there?

Link to comment
Share on other sites

  • 3 months later...
On 23.3.2017 at 0:03 AM, mirco said:

so useBlurVarianceShadowMap currently doesn't work with mesh`s that generate and receive shadows at the same time?

I tested the other options for the ShadowGenerator, but first I think its only the "quality" of the borders of the shadow, but I see that changing the option also reduce the realistic shadows.

 

shadowGenerator.useBlurVarianceShadowMap = true;

Bildschirmfoto 2017-03-23 um 00.00.03.png

shadowGenerator.useBlurVarianceShadowMap = false;

Bildschirmfoto 2017-03-22 um 23.59.49.png

Hi,

is there something new in Babylon.js 3.0 that help me fixing this problem? I read the changelog but doesn't find something that can help me here?

Mirco

Link to comment
Share on other sites

I tried to play with my playground, but it look like I don't get the shadows work at all. Not on the ground and not on the object. 

Some other playgrounds don't show shadows too. https://www.babylonjs-playground.com/#IIZ9UU found in the shadow tutorial ( http://doc.babylonjs.com/tutorials/shadows ).

The Playground 2.5 is broken. https://cdn.babylonjs.com/babylon.2.5.js returns with 404

Sorry for my questions about the shadows but I don't get it work, i like this framework and would love to build my project with Babylon. Thanks for your help. 

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