I'm trying to set a blurry shadow on my box. This is what I got so far.
The documentation on shadowRadius says.
SceneKit produces soft-edged shadows by rendering the silhouettes of geometry into a 2D shadow map and then using several weighted samples from the shadow map to determine the strength of the shadow at each pixel in the rendered scene. This property controls the radius of shadow map sampling. Lower numbers result in shadows with sharply defined, pixelated edges; higher numbers result in blurry shadows.
this is my shadow setup code
func setupShadow(){
spotLight.castsShadow = true
spotLight.shadowRadius = 30000
spotLight.shadowBias = 1
spotLight.shadowColor = UIColor.blackColor()
}
As you can see, the shadow radius is set to a huge number but the shadow remains edgy. In fact, blurriness does not even change if shadowRadius changes. What am I doing wrong?
You probably want a smaller radius (like [1; 3]).
Then on iOS you also need to specify the number of sample using shadowSampleCount (because the default is only 1 sample on iOS which implies no blur). Beware that increasing the number of samples will improve the quality but it has a significant impact on performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With