0

I create a particle system in Three.js scene. Here is my code.

function createParticleSystem() {
    var sphere = new THREE.SphereGeometry(20, 50, 50); 

    var particleMaterial = new THREE.PointsMaterial({
                color: 0xffffff,
                size: 0.5,
                map: THREE.ImageUtils.loadTexture("images/particle.png"),
                blending: THREE.AdditiveBlending, 
                transparent: true,
                opacity:1 
            });

    particleSystem = new THREE.Points(sphere, particleMaterial);

    return particleSystem;
}

add particleSystem to scene

particleSystem = createParticleSystem();

scene.add(particleSystem);

I wonder how could I change the opacity of vertices that vertices.y > 0 ?

for (var i; i<particleSystem.geometry.vertices.length; i++){
        if(particleSystem.geometry.vertices[i].y > 0){

        //
        // I don't know how set the opacity of those vertices 
        //

        }
    }
Kevin Hsiao
  • 2,281
  • 2
  • 10
  • 18
  • See http://stackoverflow.com/questions/12337660/three-js-adjusting-opacity-of-individual-particles/12344288#12344288 – WestLangley Aug 19 '16 at 13:43
  • @WestLangley Thank you so much!!!!!!!! It does work!!!!! Now I want to map texture on all of the vertices. Do you have some examples about changing color or texture on the vertices? Because vertex shaders and fragment shaders are new to me, I think I need some examples to learn how to code. – Kevin Hsiao Aug 19 '16 at 17:48

0 Answers0