Make SceneKit light only cast shadows without lighting the scene

996 views Asked by At

I'm using physically based lighting to light my scene in ARKit, however, I also want to add shadows to make it more realistic. I tried adding a directional light and setting the intensity as low as possible but I still am not able to reach my desired effect. I basically want a light to only cast shadows and have no effect on the lighting in the scene. Is there any way I can achieve this effect?

1

There are 1 answers

3
Yevhen On

You should use correct SCNShadowMode property.

From the apple's documentation:

Each shadow mode may have a positive or negative effect on rendering performance, depending on the contents of the scene. Test your app to determine which shadow mode provides the best balance between performance and quality for the scenes you want to render.

case forward: SceneKit renders shadows during lighting computations.

case deferred: SceneKit renders shadows in a post-processing pass.

case modulated: SceneKit renders shadows by projecting the light’s gobo image. The light does not illuminate the scene.

So your desired option is should be modulated. I hope it helped!

P.S. If this answer is useful to you, don't forget to press up arrow and mark it as a correct. Best of luck!

Update.

Lights source:

Directional: - Intensity - 1000.
- Mode - dynamic.
- Color #000000 (rgb(0, 0, 0)).
- Shadow Mode: modulated.

enter image description here