2

I want to create brown smoke blowing up in the sky.

How can I create this?

Ramón Wilhelm
  • 967
  • 2
  • 18
  • 39

1 Answers1

7

The ShaderParticleEngine received a rewrite for three.js-r72 with heavy API changes, so I am updating this answer. See this Answers history for a comparison and/or settings for ShaderParticleEngine 0.8 / three.js-r71.


It now allows the user to fine tune even more parameters, so you could create this beautiful twisted smoke:

smoke blowing from crash site

Example Settings for the Emitter in the Screenshot:

var loader = new THREE.TextureLoader();
var url = 'assets/images/particles/cloudSml.png';
var texture = loader.load( url );

var particleGroupCrash = new SPE.Group({
    texture: {
        value: texture
    },
    blending: THREE.NormalBlending
});

var crashemitter = new SPE.Emitter({

    maxAge: { value: 12 },
    position: { 
        value: new THREE.Vector3( 0, 0, 0 ),
        spread: new THREE.Vector3( 1, 0.5, 2 ),
    },
    size: {
        value: [ 2, 8 ],
        spread: [ 0, 1, 2 ]
    },
    acceleration: {
        value: new THREE.Vector3( 0, 0, 0 ),
    },
    rotation: {
        axis: new THREE.Vector3( 0, 1, 0 ),
        spread: new THREE.Vector3( 0, 20, 0 ),
        angle: 100 * Math.PI / 180,
    },
    velocity: {
        value: new THREE.Vector3( 0, 1, -0.5 ),
        spread: new THREE.Vector3( 0.25, 0.1, 0.25 )
    },
    opacity: {
        value: [ 0.2, 0.5, 0 ]
    },
    color: {
        value: [ new THREE.Color( 0x333333 ), new THREE.Color( 0x111111 ) ],
        spread: [ new THREE.Vector3( 0.2, 0.1, 0.1 ), new THREE.Vector3( 0, 0, 0 ) ]
    },
    particleCount: 600,
});

Three.js r73

Falk Thiele
  • 4,424
  • 2
  • 17
  • 44
  • 2
    one point for the pic :) r72 also has a particle engine http://threejs.org/examples/#webgl_gpu_particle_system – Mouloud85 Sep 30 '15 at 07:43
  • Haha thanks! The new particle plugin also looks nice, but its missing a good [documentation](https://github.com/mrdoob/three.js/pull/6942#issue-98658102) and examples so far :-( – Falk Thiele Sep 30 '15 at 09:11
  • how do I now add this smoke to the scene? Do I do scene.add(crashemitter) ? – Suisse Jan 03 '22 at 16:21
  • ah like this: scene.add( particleGroupCrash.mesh ); – Suisse Jan 03 '22 at 18:07