Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
How can I take a screenshot of scene with childrens in a particular camera positions even after moving the scene of HTML page in Three.js?

In an HTML page using Three.js, I developed a scene of a product which contains multiple GLTFLoader childrens. The product parts can be updated. How can I take a screenshot of a product in a particular camera position even after it moved or rotated?

The screenshot should contain the product maximum size.

function toDataURL(strMime){
    let curVector = camera.position.clone();
    // camera.up - test
    // let worldDir = camera.getWorldDirection();
    // var vector = new THREE.Vector3( 0, 0, -1 );
    // vector.applyQuaternion( camera.quaternion );
    // let camTarget = camera.target.position.clone();
    // let curMatrix = camera.matrix.clone();
    let vector = new THREE.Vector3( 0, 0, - 1 );
    console.log('curVector',camera.clone());
    vector.applyQuaternion( camera.clone().quaternion );
    camera.position.set( - 2.8, 1.0, - 3.7 );
    camera.lookAt(0,0,0);
    render();
    let imgData = renderer.domElement.toDataURL(strMime);
    camera.position.set( curVector.x, curVector.y, curVector.z );
    camera.lookAt(0,0,0);
    render();
    console.log('after camera', camera)
    return imgData;
}

the image taken not viable because the distance of the scene is too far from from camera or the scene is too small, the distance of the scene is too short or the scene is too large, how can set camera such that image of the scene in the canvas and not too small but inside the canvas, also camera take square image?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda