我有一个工作在其中颗粒通过帆布使用程序功能上呈现到一个球形物体,这样threejs例如创建用于webgl的渲染器的球形颗粒基本材料:在threejs
var material = new THREE.ParticleCanvasMaterial({
color: 0xffffff,
program: function (context) {
context.beginPath();
context.arc(0, 0, 1, 0, PI2, true);
context.closePath();
context.fill();
}
});
for (var i = 0; i < 1000; i ++) {
particle = new THREE.Particle(material);
particle.position.x = Math.random() * 2 - 1;
particle.position.y = Math.random() * 2 - 1;
particle.position.z = Math.random() * 2 - 1;
particle.position.normalize();
particle.position.multiplyScalar(Math.random() * 10 + 600);
initParticle(particle, i * 10);
scene.add(particle);
}
然而,我我想切换到webGL渲染器,以便运行速度更快,但它没有程序选项。似乎也许我需要使用地图,但我不知道如何。任何人都有关于如何调整此代码以完成与webGL渲染器相同的任何想法。
相关:http://stackoverflow.com/questions/13860166/procedurally-generated-texture-for-particle-with-three-js – WestLangley