Hello, I’m using “createDefaultEnvironment” so to be able to have nice reflections on the ground, but the ground does not react to any light.
I’ve looked in the properties of “createDefaultEnvironment”, and I can change ground color, texture, opacity, but can’t tell him to receive light, like any mesh.
I could use a regular plane, but in this way I could not use “enableGroundMirror”, and “groundMirrorFallOffDistance” properties…
How to do that?
Here’s my demo https://www.babylonjs-playground.com/#VWI383#3
Thank-you labris,
but this is not what I need.
I would need to see the spotlight on the ground, just like on the cube, somethink like this picture:
I suspect that it’s a matter of the ground shader, that is something like “unlit”…
Is it possible to change the ground material with a standard one, that can react to the lights, and at the same time keep the nice reflections that fade on the distance (thanks to the “groundMirrorFallOffDistance” property") ?
You can also call it from the code: scene.debugLayer.show()
As for your need to have reflections and lighting simultaneously - you may try to use (instead of ground mirror) reflection probes - Reflections and Refractions | Babylon.js Documentation
I’m looking at “MirrorTexture”, but as sebavan told there’s no falloff.
But, since there’s a depth pass, could not be used to blur/fade the reflection on the distance (even if I don’t know how) ?
More or less
Usually the reflections decay on the distance from the object (mostly due to the rougness of the floor surface), this give them a more realistic look.
Look this example picture
It seem that in Babylon this “reflection decay effect” can be achieved only with a “BackgroundPlane”, with a “BackgroundMaterial”, but this shader does not react to lighting.
Anyway, I’m trying to put a regular plane with a standard material under the backgroundPlane, and tweaking the color and the alpha mode of the backgroundMaterial.
It’s not perfect but it’s better
Ok, moving the regular plane a bit under the groundPlane and changing the groundPlane color to black it seem that I can achieve something more what I want,
But the reflection is very jaggy, how can I increase the resolution of the mirror texture of the groundPlane (in the Inspector is named “BackgroundPlaneMirrorTexture”) ?
P.S. I don’t want to blur the reflection with kernel value, just to have an higher resolution reflection texture
Here’s my demo https://www.babylonjs-playground.com/#VWI383#4
Many thanks!
You can pass groundMirrorSizeRatio to the default env creator. This will use the size of the rendering context (your canvas) and will calculate the max POT size for your texture.
I removed your blur and have increased the size of the canvas (using hardware scaling) just to explain what is possible: