Jump to content

Problem with layerMask and shadow


snot224
 Share

Recommended Posts

Hi all, and Happy New Year !!!!! ;)

I come with an over problem.

I've got a ground, and some meshes on it (this is a strategy game). I've got 2 viewports, 1 for the game, and 1 for minmap to have a global view.

I would like to show or not some meshes on the minmap viewport (like skydome, building to replace it with sprite, etc etc ...), I read about the layermask, it is working fine until I put shadow on my scene .... If I hide meshes on minmap, shadow disapear in the over viewport ...

 

Here the playground exemple :

 

You just have to switch between line 36 and 37 with comment to saw what I mean.

 

http://www.babylonjs-playground.com/#1WELNV#1

 

 

Some good idea ?

 

Link to comment
Share on other sites

I did not solve this yet, but I have a similar problem (I am using two cameras, one is an overview, one is for close view. The overview uses a simple object, the close view uses a detailed object).

 

I swapped the order of cameras in your scene, and now only the shadow remains.

 

It is maybe better if you replace the object with some sprite, it still has the shadow.

http://www.babylonjs-playground.com/#1WELNV#2

 

The shadowGenerator, and the rendertarget in it, uses the first active camera I think.

 

In /src/Lights/babylon.directionalLight:
 

DirectionalLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {            var activeCamera = this.getScene().activeCamera; 

So I don't know the solution yet, but we have a similar problem.

 

 

 

Link to comment
Share on other sites

 

I did not solve this yet, but I have a similar problem (I am using two cameras, one is an overview, one is for close view. The overview uses a simple object, the close view uses a detailed object).

 

I swapped the order of cameras in your scene, and now only the shadow remains.

 

It is maybe better if you replace the object with some sprite, it still has the shadow.

http://www.babylonjs-playground.com/#1WELNV#2

 

The shadowGenerator, and the rendertarget in it, uses the first active camera I think.

 

In /src/Lights/babylon.directionalLight:

 

DirectionalLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {            var activeCamera = this.getScene().activeCamera; 

So I don't know the solution yet, but we have a similar problem.

 

 

 

 

 

Thanks for you answer, I'm glad to see that I'm not the only one that catch this problem. I will check around this function but I think I will just create a 2D pictures and will interpolate coordinate to match wil real map, because it sound like easiest way.

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