Way to put shadow internaly in GroundedSkybox?



didisoftwares.ddns.net

Based on this example
https://threejs.org/examples/?q=gro#webgl_materials_envmaps_groundprojected

Does anyone have any idea why GroundedSkybox doesn’t receive shadows?

Consider placing a plane with ShadowMaterial at the same location (just slightly higher) as the skybox.

GroundedSkybox object uses MeshBasicMaterial because (a) you don’t want skybox to be shaded in any way, you want to to be flat-colored and unaffected any other effects, (b) skybox doesn’t have reasonable normals.

If for some reason you really don’t want to use ShadowMaterial - you can try replacing MeshBasicaMaterial with something else, ex.:

skybox.material = new Three.MeshLambertMaterial({
  map: skybox.material.map,
  depthWrite: true,
});
skybox.castShadow = false;

But this may start causing artefacts or add unnecessary complexity (and as above, skybox geometry does not calculate normals, just squashes vertex positions. So you’d also need to add proper vertex calculations so that shadows can only be cast on the lower, horizontal part of the skybox.)