2012-11-22 47 views
0

我嘗試加載imageData以在三維中創建紋理。 我嘗試這樣,但它不起作用。在ThreeJS中使用imageData紋理

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

感謝您的幫助。

+3

請定義「不起作用」的意思...... –

回答

1

它適用於下面的代碼。

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 
}); 
+0

重要的部分是'texture.needsUpdate = true;'。沒有它,紋理就會變成黑色。 – Kyopaxa