Jump to content

Shadow bugs.


Istran
 Share

Recommended Posts

The object is added to the list to create a shadow (.renderList.push (obj)). To display the shadow on the object itself from other elements - (.receiveShadows = true). As a result, the object creates a shadow on itself. How to fix it?

example https://playground.babylonjs.com/#D516RY

Also, if there is a surface between the light source and the object, then there is a shadow on it. How to solve this problem?

example: https://playground.babylonjs.com/#1RVN7H

PS: I'm sorry, if you already have a theme. I find it difficult to focus on foreign language resource.

Link to comment
Share on other sites

Hello!

Self shadowing is a pain in the heck :) Here is a complete doc on all techniques we have in babylon.js so far: http://doc.babylonjs.com/babylon101/shadows#troubleshooting

The best idea is to avoid selfshadowing by having multiple light and multiple shadow generators (if it works for you). Lights have a list of included/excluded meshes so you can easily control which light affects which mesh

Link to comment
Share on other sites

21 hours ago, Deltakosh said:

Hello!

Self shadowing is a pain in the heck :) Here is a complete doc on all techniques we have in babylon.js so far: http://doc.babylonjs.com/babylon101/shadows#troubleshooting

The best idea is to avoid selfshadowing by having multiple light and multiple shadow generators (if it works for you). Lights have a list of included/excluded meshes so you can easily control which light affects which mesh

Hello! Thanks for the answer! In my project, the earth is generated as blocks. It turns out that I should create a personal "ShadowGenerator" for each block and exclude this block in it? On the screenshot 10x10 blocks. I want to make up to 100x100. Is there a function to merge meshes into one? 

image.png.d3dd8371602172bcdc83b1b1f3a4955b.png

Link to comment
Share on other sites

2 hours ago, Deltakosh said:

Yes definitely: Mesh.MergeMeshes() :)

http://doc.babylonjs.com/how_to/how_to_merge_meshes

Thanks, I solved the main problem. In the process, I discovered one more unpleasant effect. From the point light there are such shadows (screenshot after).

image.thumb.png.fef48a068cfab8a019e486fcd09be9f9.png

To eliminate the effect, I tried to increase light.shadowMaxZ and shadowGenerator.bias, but then the shadow gets worse and lumens appear through the mesh.

image.png.a2ca384ced7fd3be6ca150d60a0baef4.png

 

Link to comment
Share on other sites

17 minutes ago, Deltakosh said:

Can you use spot instead of point light? (point light is expensive as it generate a cubemap)

As far as I understand, SpotLight has the shape of a cone and simulates a searchlight (flashlight, car headlight). I need lighting in all directions at low altitude (torch, fire).

Link to comment
Share on other sites

8 hours ago, Deltakosh said:

You are correct. 

If you need a PointLight, you can't use Blurred shadows unfortunately. Can you repro the issue you have on the PG?

Yes. https://playground.babylonjs.com/#XIAGN4

I tried different kinds of shadows. Without blurring, the black bars on the four sides become even more prominent. Shadow settings at the very bottom. Balls in the scene are dragged.

Link to comment
Share on other sites

Well as I mentioned earlier, the point light cannot be blurred.

And as you are dealing with self shadow issue, I would recommend to try to use a directional light (even for the torch)

Link to comment
Share on other sites

5 hours ago, Deltakosh said:

Well as I mentioned earlier, the point light cannot be blurred.

And as you are dealing with self shadow issue, I would recommend to try to use a directional light (even for the torch)

How can you apply directional light so that it does not look like a spotlight?

Link to comment
Share on other sites

well it will look like a directional light for sure :D

Point light work well when the source on this demo: https://www.babylonjs-playground.com/#4MC650#0 but as you can see we avoid the self shadow problem as it implies too much precision for a webgl demo

 

Do you think you could separate ground and walls perhaps? So ground cast on no one, walls cast on ground and there is no self shadowing questions

Link to comment
Share on other sites

On 7/25/2018 at 7:31 PM, Deltakosh said:

well it will look like a directional light for sure :D

Point light work well when the source on this demo: https://www.babylonjs-playground.com/#4MC650#0 but as you can see we avoid the self shadow problem as it implies too much precision for a webgl demo

Do you think you could separate ground and walls perhaps? So ground cast on no one, walls cast on ground and there is no self shadowing questions

Are you talking about horizontal and vertical polygons? In theory, this can be done, but shadows on vertical surfaces should also receive a shadow from other vertical polygons.

Link to comment
Share on other sites

yes, but you are in a real complex case and I'm not sure there is a good solution

Other idea: have 4 directional lights oriented north, south, west and east

Link to comment
Share on other sites

4 hours ago, Deltakosh said:

yes, but you are in a real complex case and I'm not sure there is a good solution

Other idea: have 4 directional lights oriented north, south, west and east

I immediately thought about it. Worth a try. Later I will show that it was working.

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