Jump to content

Shadows and mirroring


matdav
 Share

Recommended Posts

Hi everybody,
I'm looking for a way to get a ground in my scene with the same exact color of the background (scene.clearColor), that reflects the meshes above it and that displays shadows casted by a light on receiving objects.

I tried to use EnvironmentHelper to get this result but I always have a halo on the ground, see the following playground:

https://www.babylonjs-playground.com/#10D6YT#122

Is there a way to avoid that halo so that the color of the ground is the same as the background? I don't want the user see the ground at all, I only want shadows and mirroring.

I tried also to use the BackgroundMaterial directly but without success (see playground)

https://www.babylonjs-playground.com/#G3HSAW#15

I tried then to create the ground and the materials by hand but as in the following playground, but I have a problem to show shadows and reflections at the same time. 
Also, to get the same color of the background I set gammaSpace to true on the MirrorTexture but I get a reflection too dark (and no shadows).

https://playground.babylonjs.com/#QUXPMR

I saw that exists ShadowOnly material that shows only shadows. Is there a similar material with mirroring too?

Any suggestions are welcome,
thanks,
Matteo

Link to comment
Share on other sites

Hi Matdav !

One solution could be to use 2 different meshes as ground :
-> 1 to display shadow only, using the shadowOnlyMaterial.
-> 1 to display reflection only, using a material with mirrorTexture and without diffuse or specular attributes

You can see a PB of this solution here https://www.babylonjs-playground.com/#QHN8ZT

Of course, there may be a more efficient way, perhaps by using a single one couple mesh and material... 

Have fun !

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