Jump to content

Question about soft shadow


BlackMojito
 Share

Recommended Posts

How can I achieve the shadow effect like in the attached screenshot? 

I tried to use a directional light with the direction (0, -1, 0) and then played around with different kinds of blur parameters, but haven't successfully produced such effect. I supposed that it is possible by blurring the shadow texture right? Can someone point me out how to adjust the parameters? 5ab1090e831eb_AutodeskViewerFreeOnlineFileViewer-GoogleChrome.jpg.7ad7150d90ec168e0f13b0ca39b3f89f.jpg

Link to comment
Share on other sites

8 hours ago, Deltakosh said:

You  may also want to consider blurred shadows: http://doc.babylonjs.com/babylon101/shadows#soft-shadows

 

Thanks @Deltakosh, the soft shadow was what I tried first. Please look at the code snippet below. Basically I got two issues. The first one was that the blurred shadow was not "large" enough so we see very little shadow. The second one is I got some banding issues like the second screenshot shows. 

 

PS: I do not really want the shadow that big like the one in the initial post. I just want something a little bit larger so that we can see it. ;)

Any suggestion, big boss ?

this._shadowGenerator = new BABYLON.ShadowGenerator(512, <BABYLON.IShadowLight>(this._lights.getValue(RenderScene._shadowLightName)));
this._shadowGenerator.useBlurExponentialShadowMap = true;
this._shadowGenerator.useKernelBlur = true;
this._shadowGenerator.blurKernel = 32;
this._shadowGenerator.bias = 0.01;
this._shadowGenerator.setDarkness(0.25);

 

softshadow.jpg

softshadow2.jpg

Link to comment
Share on other sites

Just move your light farther or closer to your building and you can control the size and the precision of the shadow

If you can provide a playground we could update it together

Link to comment
Share on other sites

9 hours ago, Deltakosh said:

Just move your light farther or closer to your building and you can control the size and the precision of the shadow

If you can provide a playground we could update it together

OK. So I might need to replace my directional light by a spot light?

Link to comment
Share on other sites

9 hours ago, Deltakosh said:

Just move your light farther or closer to your building and you can control the size and the precision of the shadow

If you can provide a playground we could update it together

thanks boss, by using a spot light. I can get what I want now. Directional light use orthographic projection so that the distance does not affect anything, right?

image.png

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