Just confused with cubemap shadows


I’m trying to achieve near “photorealistic” rendering with full shadows. While spot lights work pretty fine with self-shadowing (see the image below), point light shadows looks not as good - it produces totally shaded objects (next one). Demo: https://playground.babylonjs.com/#U2F7P9#4

SpotLight shadows

PointLight shadows

Apparently, the omni-directional cubemap is used to produce shadows for point lights. I can substitute point light with eight spot lights (for testing only, 'cause I cant introduce additional seven lights) and receive suitable self-shadowing.
I assume there should not be difference in these images, because second example is actually one side of the cube map, which is lit by one ray of light, which is emmited from the same position. Generally speaking, I expect same shadows on both images. But they’re different. My question is - Why?
Or, may be different approach exists to get full shadows on the scene?


I would most of the time not recommend point light shadows as they can be pretty expensive (it is actually pretty similar in cost than 6 spot lights).

You can use the properties shadowAngle and direction of a point light to convert it to a spot light if you do not need the cast in every directions.

In the meantime I ll try to see if there is smthg obvious in the point light shadow code.

Thank you for your replay. Point light suits better for interior lighting and should provide more precise shadows than ~180 degree spots.

At this moment I’m trying said .shadow Angle with angle a bit less than 180 degree. But I cannot get rid of PCF bias artifacts when using reasonable texture size (less than 4096px). The scene is of complex geometry, which has a lot of polygons that are almost parallel to the light direction.
On the rendering below base cabinet doors are affected with PCF artifacts (2048 shadow map, PointLight with .shadowAngle, minZ/maxZ are both specified, .forceBackfacesOnly).
Note: “Insane” 8192 shadow map makes no artifacts (as expected).

Thanks for your time

There is a bug with point lights and shadows, I’m going to do a PR about it.

1 Like

Thank you for the information.



Thank you for fixing that! It’s a good improvement.