How do i make the shadow stronger?

Hello i have a scene with a shadow generator and a directional light at default intensity. I can see the shadow of a cube but its barely visible. How do i make stronger?

Hi and welcome to the Community,
It all depends on the type of shadow you are using. I.E. whether you are using contact hardening shadow or just exponential. The shadow from a directional light can be made stronger by increasing the distance/target where the shadow is casted. If your ground is at zero, instead of casting the light to -1, you can cast it on -100. This will create a stronger shadow at -1. Another thing with shadows is that light/shadow uses the emissive (better said, the emissive can influence the shadow as it emits against the shadow). Using a rather dark emissive will make your shadow stronger.
For shadows casted from smaller items, using contact hardening shadows works best. In this case, you will choose the minimal and maximal distance of the light/shadow hitting the object. You will want to make sure that the limits include the size of your object.
Of course, the strength and the angle of the light will also have an influence. Not to mention if you have more than 1 light (since light only adds to light - and removes from shadows).
It’s actually really hard to tell just like that. There are just so many parameters. Best is if you could set-up a PG reproducing your use case?
Meanwhile, again, welcome to the Community and have a great day :sunglasses:

Edit: Here a simple PG you can play with to experience how the emissive, light intensity, direction and position all can influence the strength of the shadow.

1 Like

Hey mawa thanks for the detailed reply! I managed to find the problem. it was the material i had for the ground which was pbr. for some reason shadows on pbr materials are very weak. changing it to standard worked but i have another question. I have fog on my scene but it also hides the skybox. Is there a way to make the fog render only above the meshes?

This is the skybox code

      const texture = new BABYLON.CubeTexture('environment.env')
      const skybox = scene.createDefaultSkybox(texture, true, 10000, 0)

I see. I didn’t mention PBR at this stage (not knowing of your project and skills with material and lights).
The problem with PBR is (as it name suggest) is receiving light from the environment. This only adds to the light/shadow you can cast with a light/shadow caster. In general, setting the emissive to black and in case of a texture adding a fairly dark emissiveTexture to the material really helps. You can also lower the level of the environment on this material (i.e. ground), eventually compensating by making a brighter texture for the albedo or pushing the level of the albedoTexture above 1.

As for your question about the fog, the fog (default) in BJS is quite basic and I don’t use it. It has only very few settings and no, you cannot have it only over meshes. The fog has a distance parameter but it only increases fog in the distance. So your skybox will always be affected. Not sure if through render passes you could make it so that your skybox is not affected by the fog layer. May be. I’m gonna have to ask the expert @Evgeni_Popov

1 Like

If you are using the default fog, you can try to set skybox.applyFog to false to keep the skybox away from fog.

1 Like