Search code examples
three.jstexture-mapping

Using imageData for texture in ThreeJS


I try to load a imageData to create texture in threeJS. I try like this, but it does not work.

pMaterial =
new THREE.ParticleBasicMaterial({
    color: 0xFFFFFF,
    size: 20,
    map: THREE.DataTexture(
        myimageData
        ),
    blending: THREE.AdditiveBlending,
    transparent: true
});

Thanks for your help.


Solution

  • It works with the following code.

    var texture = new THREE.Texture(myImageData);
    texture.needsUpdate = true;
    
    particles = new THREE.Geometry(),
    pMaterial =
    new THREE.ParticleBasicMaterial({
        size: 20,
        map: texture,
        blending: THREE.AdditiveBlending,
        transparent: true
    });