0
我在Three.js場景中創建了一個粒子系統。 這是我的代碼。如何更改three.js中的某些頂點不透明度?
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;
}
添加粒子系統場景
particleSystem = createParticleSystem();
scene.add(particleSystem);
我不知道如何可以改變這種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
//
}
}
)請參閱http://stackoverflow.com/questions/12337660/三個js調整不透明的個人粒子/ 12344288#12344288 – WestLangley
@WestLangley非常感謝你!!!!!!!!它確實有用!!!!! 現在我想映射所有頂點的紋理。 你有沒有關於改變頂點顏色或紋理的例子? 因爲頂點着色器和片段着色器對我來說是新的,所以我想我需要一些示例來學習如何編寫代碼。 –