Jump to content

Shadows of the missing character if buildings shadows


Dad72
 Share

Recommended Posts

Hello,

When I cast shadows to my character the shadows are perfect. But now if I add shadows to all my buildings, the shadows of the buildings are perfect, but the shadow of the character become horrible without my understanding why.

For precision: my scene contains a lot of objects instance and in total almost 300 objects. So I have in 3ds max group in "containers" the elements of the same type of ways to have a more organized hierarchy. I do not know if this can cause the problem, I do not think it's binding. I absolutely need to group models by type in 3ds max otherwise it's a mess.

Containers give this in my hierarchy :

606261875_2018-07-0712_32_05-Greenshot.jpg.50a80e19a9f28d83bc1165238f718b4d.jpg I add them like this: 1078337450_2018-07-0712_33_06-Greenshot.jpg.970b5b3e2253d741a5adc866cde0777b.jpg

And I see that they are exporting with the Babylon exporter, but that should not be a problem I think, they are not dealing like meshes.

That's what it gives in pictures:

Here just the shadows of my character, it's perfect:

204818213_2018-07-0712_14_02-Greenshot.thumb.jpg.054b462262677e2add3145c6e9cf97b2.jpg

Now, if I also add the shadows of my buildings, the shadow of the character is bad. (The settings are the same as before.)

 

1148377579_2018-07-0712_12_58-Greenshot.thumb.jpg.7115894822a0c1d2d2cc1a9e5975599e.jpg

Shadows of buildings are always perfect, whether with the shadows of the characters or not. but if the buildings are add, the character always project a bad shadows.

Does not that come from making it an animating object, I do not know, I do not find what can cause that.

Thank you in advance.

Link to comment
Share on other sites

What I'm starting to understand is that when building shadows are generated, it calculates in relation to the size of buildings that are larger than the character and small objects of the scene. so the shadow of the character and other small objects become very pixelated.

So I was wondering if I should not create a shadow map for large objects and another for small objects to get the desired result? If I have to do that it's annoying because I have to use 2 identical directional lights.

So maybe this is not a bug, but maybe it has one because it's an unexpected behavior.

Link to comment
Share on other sites

You got it. The light will evaluate the best position to capture all the shadow casters in the shadow map.

Which will force it to move farther and then reduce the precision of tiny objects.

I will highly recommend to create at least two lights (with inclusion lists so you can affect them to the objects you want):

- One for the building

- One for the tiny objects

 

This will help you keep a good definition for everyone.

 

Btw this is how it works in almost all engines (when they don't support cascading shadow maps). 

Link to comment
Share on other sites

It does not work DK. With two shadows, even if I include or exclude models of light for a shadow map, it creates problems.

Let's say that for a light I include a building and for the other light I only include the character.

I would have a shadow on the building but not on the character.

In addition, I used a directional light and a hemispherical to avoid having a black direction. But with this hemispherical light I have no shadow at all using two shadows.

I'm completely dump

I will try to make a PG

Link to comment
Share on other sites

Thank you Deltakosh. I managed to have the best on my scene, but it remains a weird problem when I add a third light.

In this image, I have two directional lights placed in the same place so that the shadow of my character and buildings go in the same direction. until then it's okay. But if we look, the shading is very dark, see black:

 

101311632_2018-07-1000_40_35-Greenshot.thumb.jpg.99bfb54ef70aed1a11b5ee67ece84b49.jpg

 

So, I tell myself that I will add a hemispherical light to avoid this by adjusting its intensity to 0.1 or 0.2. But that's what happens:

1707748577_2018-07-1000_39_38-Greenshot.thumb.jpg.b3547fbc0186ce8d7d07fdfe1d6cfe58.jpg

 

I have more shade, finally if I have on the ground so above the sidewalk of the roads as can be seen in the following picture which has the hemispherical light in addition:

114858452_2018-07-1000_38_08-Greenshot.thumb.jpg.1bbb3560cb7c7767c58842649168c033.jpg

So I do not understand that when I add the hemispherical light or another, the shadows pass below my sidewalk and road. (below the mesh in fact.

Maybe you have a track of what can cause this annoyance (not to call it a bug, lol)

Thanks again DK

Link to comment
Share on other sites

Ok, I was tired yesterday. I just understand why.

Before I used 2 lights and I imported my scene like this:

BABYLON.SceneLoader.Append("data/scenes/"+sceneName+"/", sceneName+".babylon?"+Date.now(), this.scene, (newScene) => {                 

    newScene.lights[2].dispose();

    ...

});

But now that I have two shadow generator, so I add a light, I have 3.

When exporting with 3ds max a hemispherical light is automatically added, and in my code above, I did not remove the good light.

I simply correct by doing:

newScene.lights[3].dispose();

It works better. I still wonder how I could not see him yesterday. :)

Thank you for everything Deltakosh

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