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

65
Vistas
Positioning particles three.js

So I Have some old particle code that i am using they work fine enough as I’ve used them before but in my recent project i can’t seem for the life of me to be able to position them can someone point me in the right direction of how to position them properly i'm guessing they are behind the camera?

CodePen: https://codepen.io/uiunicorn/pen/xxrpYPP

Code:

 var geometryParticle = new THREE.BufferGeometry();

                var vertices = [];

                var textureLoader = new THREE.TextureLoader();

                var sprite1 = textureLoader.load("particl.png");
                partcount = 250;
                for (var i = 0; i < partcount; i++) {
                 var x = Math.random() * 500 - 250;
                    var y = Math.random() * 500 - 250;
                    var z = Math.random() * 500 - 250;

                    vertices.push(x, y, z);
                }

                geometryParticle.setAttribute("position", new THREE.Float32BufferAttribute(vertices, 3));

                parameters = [
                    [[0.8, 0, 0.5], sprite1, 5],
                    [[0.8, 0, 0.5], sprite1, 2],
                    [[0.8, 0, 0.5], sprite1, 4],
                    [[0.8, 0, 0.5], sprite1, 2],
                    [[0.8, 0, 0.5], sprite1, 3],
                ];

                for (var i = 0; i < parameters.length; i++) {
                    var color = parameters[i][0];
                    var sprite = parameters[i][1];
                    var size = parameters[i][2];

                    materials[i] = new THREE.PointsMaterial({ size: size, map: sprite, blending: THREE.AdditiveBlending, depthTest: false, transparent: true });
                    materials[i].color.setHSL(color[0], color[1], color[2]);

                    var particles = new THREE.Points(geometryParticle, materials[i]);

                    particles.rotation.x = Math.random() * 6;
                    particles.rotation.y = Math.random() * 6;
                    particles.rotation.z = Math.random() * 6;
                    particles.position.z = Math.random() * 6;

                    scene.add(particles);
                }

                var params = {
                    texture: true,
                };

Best i've done so far as you can see the particles are way to close to the camera and most of them aren't showing in the scene

thanks in advance!

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