Browse Source

Fix clipping in webgl2_materials_texture3d (#22649)

* Fix clipping in webgl2_materials_texture3d

The camera position was too close to the 3D texture, causing clipping
from certain angles.

* Adjust frustrum and camera position

Move the object to the middle of the frustrum and make the depth of the
frustrum bigger.

* Disable pan and adjust camera

Disable pan, move camera to -64, -64, 128 and restore original frustum.
Rodrigo Schuller 3 years ago
parent
commit
be3e3d200a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      examples/webgl2_materials_texture3d.html

+ 2 - 1
examples/webgl2_materials_texture3d.html

@@ -52,7 +52,7 @@
 			const h = 512; // frustum height
 			const aspect = window.innerWidth / window.innerHeight;
 			camera = new THREE.OrthographicCamera( - h * aspect / 2, h * aspect / 2, h / 2, - h / 2, 1, 1000 );
-			camera.position.set( 0, 0, 128 );
+			camera.position.set( - 64, - 64, 128 );
 			camera.up.set( 0, 0, 1 ); // In our data, z is up
 
 			// Create controls
@@ -61,6 +61,7 @@
 			controls.target.set( 64, 64, 128 );
 			controls.minZoom = 0.5;
 			controls.maxZoom = 4;
+			controls.enablePan = false;
 			controls.update();
 
 			// scene.add( new AxesHelper( 128 ) );