Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

64
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda