Shadows
There are a number of options and properties that need to be configured correctly in order for shadows to render appropriately in r3f. Here is a list of what is needed:
shadows
needs to be added to theCanvas
elementcastShadow
needs to be added to any shadow-casting lightscastShadow
needs to be added to any meshes you want to cast shadowsreceiveShadow
needs to be added to any meshes you want to receive shadows (along with making sure the material is capable of rendering shadows, mostly meaning nomeshBasicMaterial
s)shadow-camera-near
andshadow-camera-far
need to be set to reasonable distances,shadow-camera-near
defaults to .5 and-far
defaults to 50shadow-mapSize-height
and-width
need to be set to set to a size that is a power of 2. Both default to 512, which should usually be a pretty decent value
In order to get shadows to work in 8th Wall, you need to make sure that the renderer's shadowMap.enabled
is set to true
.
xrScene.renderer.shadowMap.enabled = true
Last updated