GroundedSkybox missing height parameter causing NaNs in bounding sphere calculation...
In Env.js the construction of:
skybox = new GroundedSkybox( hdr );
skybox.scale.setScalar( 100 );
needs to pass the height, radius into the constructor... they don't have default values and are causing the SphereGeometry position attribute to contain NaN values.
causing this error when the background sphere is mouseovered:
error( 'BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this );
A fix could be:
let smoothHeight = .25;
skybox = new GroundedSkybox( hdr, smoothHeight , 1 );
skybox.position.y+=(height * smoothHeight);
Also the resolution parameter is 128 by default which is pretty high.. It looks like that environment sphere is also being hit by raycasting.. you might want to exclude it from raycast explicitly for performance when mousing around.
constructor( map, height, radius, resolution = 128 ) {
Maybe resolution = 64 ?
Or even not use GroundedSkybox and just generate the sphere inline ?
const resolution = 64;
const geometry = new SphereGeometry( 1, 2 * resolution, resolution );
const pos = geometry.getAttribute( 'position' );
const tmp = new Vector3();
for ( let i = 0; i < pos.count; ++ i ) {
tmp.fromBufferAttribute( pos, i );
if ( tmp.y < 0 ) {
tmp.y=0;
tmp.toArray( pos.array, 3 * i );
}
}
pos.needsUpdate = true;
let skydome = new Mesh(geometry, new MeshBasicMaterial( { map, depthWrite: false } ) );
geometry.computeVertexNormals();
skydome.layers.set(1); // Possibly put it in a different layer to avoid it being raycast by mouse ?