mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
100.42k stars 35.21k forks source link

Particle vs. ParticleSystem #1430

Closed renegademaster88 closed 12 years ago

renegademaster88 commented 12 years ago

Now i have tried using both of these, i wrote some particles using a Particle system myself and recently have been using Sparks.

Particle systems can assign vertex colours and images to each particle, but not change the size of an individual particle (since they all share the same material).

Where as Particles have their own material and can change size. However when i tried using ParticleBasicMaterial and assigned it a map and a colour, the colour didnt show through when setting

particle.target.material.color (from Sparks)

var material = new THREE.ParticleBasicMaterial( { size: 85, map: sprite, vertexColors: true } );

http://www.nickfallon.net/3D/Attractors_sprite.html

Here you see the colour code working but using a ParticleCanvasMaterial

var material = new THREE.ParticleCanvasMaterial( { program: SPARKS.CanvasShadersUtils.circles, blending:THREE.AdditiveBlending } );

http://www.nickfallon.net/3D/Attractors.html

Is there a way to get the best of both worlds, a texture map, that can change colour and size?

mrdoob commented 12 years ago

Have you seen these examples? http://mrdoob.github.com/three.js/examples/webgl_custom_attributes_particles.html http://mrdoob.github.com/three.js/examples/webgl_custom_attributes_particles2.html

renegademaster88 commented 12 years ago

Ok so after much fiddling, i have realised that Particles only work in a 2D Context, where as ParticleSytems only work in a 3D Context. At the moment there is nothing to tell you they don' twork. Shouldn't they give an error message or default to a Sprite or rendering using another method? at least rename them CanvasParticle ....

mrdoob commented 12 years ago

Yeah, it's on out to-do list.

renegademaster88 commented 12 years ago

by that do you mean that Particles might work in a 3D context later? That would be very cool, and help allot with the Sparks code im working on!

mrdoob commented 12 years ago

The other way around. Particle will be renamed to Sprite for CanvasRenderer.

v3ss0n commented 11 years ago

The Current sprite implementation is so slow. just 50000 of them crippled while 1mil of particlesystem particles runs like a champ! anyway to make Sprite fast because that is only thing that similar to particles that work under webgl and raycastor works on them. Or , is there Particle implemenation that fast like those inside ParticleSystem coming? :)