Hi there.
Is there an easy way to display the background image when view (camera) is above the ground and disable the image when the view is under the ground. Maybe replace it with just a gray color ?
// Scene
const scene = new THREE.Scene();
scene.fog = new THREE.Fog( 0xa0a0a0, 10, 50 );
//scene.background = new THREE.Color( 0xa0a0a0 );
const canvas = document.querySelector('#c');
//Load background texture
const backgroundloader = new THREE.TextureLoader();
backgroundloader.load('https://images.pexels.com/photos/1205301/pexels-photo-1205301.jpeg' , function(texture)
{
scene.background = texture;
});
// Ground
const ground = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 100, 100 ), new THREE.MeshPhongMaterial( { color: 0xeeeeee, shininess: 1, depthWrite: false } ) );
ground.rotation.x = - Math.PI / 2;
ground.receiveShadow = true;
ground.material.transparent = false;
ground.position.y = -0;
scene.add( ground );
const grid = new THREE.GridHelper( 1000, 1000, 0x000000, 0x000000 );
grid.material.opacity = 0.2;
grid.receiveShadow = false;
grid.material.transparent = true;
grid.position.y = -0.01;
scene.add( grid );