Answer the question
In order to leave comments, you need to log in
How to draw an image on top of everything in Three.js?
How to draw an image on top of the entire scene in threejs so that it does not react to the camera position and always remains in place?
Answer the question
In order to leave comments, you need to log in
To do this, we need to create another camera that we will not move:
otherCamera = new THREE.PerspectiveCamera( fov, width / height, near, far );
it must be directed directly at the object. enderer.clear(); // отчищаем все буферы
renderer.render(mainScene, camera); // рендерим главную сцену
renderer.clear(false, true, false); // отчищаем только буфер глубины
renderer.render(otherScene, otherCamera);// рендерим статичную сцену
All! var texture = new THREE.ImageUtils.loadTexture( 'images/pic.jpg' );
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set( 0.5, 0.5 );
var spriteMaterial = new THREE.SpriteMaterial( {map: texture, useScreenCoordinates: true, alignment: THREE.SpriteAlignment.topLeft } );
sprite = new THREE.Sprite( spriteMaterial );
sprite.scale.set(100,100,1.0);
sprite.position.set( 0, 0, -1 );
mainScene.add( sprite );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question