Environment gets through walls, inside the room

I have a room with env enabled globally. Although it’s inside a cube, the floor reflects the outer sky. How do I prevent this? The ceiling and the walls shouldn’t block the env?

Nope, that’d require realtime ray sampling which is too expensive for webgl graphical capabilities (for non-webgl often as well.)

The only way to avoid this would be to use path tracing renderer (which is not realtime), some kind of custom probing, or baked light.

1 Like

You could add a different environment map to the floor, and any other materials you don’t want to use your global map.

See three.js docs

2 Likes

I would appreciate something close to like this.
I’m trying to find a simple hdr just to turn it off hmm

envmap intensity 0 gives this. complete dark. is this how it’s supposed to be?

export function WoodFloor() {
  const texturePaths = [
    '/textures/smoked-walnut-swing/PARKY_0005_SMOKED-WALNUT-SWING-06_AO_1K.jpg',
    '/textures/smoked-walnut-swing/PARKY_0005_SMOKED-WALNUT-SWING-06_COL_1K.jpg',
    '/textures/smoked-walnut-swing/PARKY_0005_SMOKED-WALNUT-SWING-06_DISP_1K.jpg',
    '/textures/smoked-walnut-swing/PARKY_0005_SMOKED-WALNUT-SWING-06_GLOSS_1K.jpg',
    '/textures/smoked-walnut-swing/PARKY_0005_SMOKED-WALNUT-SWING-06_NRM_1K.jpg',
    '/textures/smoked-walnut-swing/PARKY_0005_SMOKED-WALNUT-SWING-06_ROUGH_1K.jpg'
  ]
  const textures = useTexture(texturePaths)

  textures.forEach((texture) => {
    texture.repeat.set(5, 5)
    texture.wrapS = THREE.RepeatWrapping
    texture.wrapT = THREE.RepeatWrapping
  })

  const [aoMap, map, displacementMap, metalnessMap, normalMap, roughnessMap] =
    textures

  const dummyEnvMap = new THREE.TextureLoader().load('/textures/dummy-env.jpg')
  dummyEnvMap.mapping = THREE.EquirectangularReflectionMapping

  return (
    <Box args={[floorX, wallZ, floorZ]} castShadow receiveShadow>
      <meshPhysicalMaterial
        aoMap={aoMap}
        map={map}
        displacementMap={displacementMap}
        normalMap={normalMap}
        metalnessMap={metalnessMap}
        roughnessMap={roughnessMap}
        displacementScale={0}
        metalness={0}
        roughness={1}
        // envMap={dummyEnvMap}
        envMapIntensity={0}
      />
    </Box>
  )
}

and env also make my directional light’s shadow disappear but not point lights