Generating Smoke Effects with Three.js

I am looking to generate visually appealing brown smoke rising into the sky.

Any tips on how I can achieve this effect?

Answer №1

A major overhaul has been implemented in the ShaderParticleEngine for three.js-r72, featuring substantial API modifications. As a result, this answer is being updated to reflect these changes. For a detailed comparison and configuration settings of ShaderParticleEngine 0.8 / three.js-r71, refer to the Answers history.


Users can now customize a wider array of parameters, enabling the creation of intricate visual effects like the mesmerizing twisted smoke displayed below:

https://i.sstatic.net/BWXCI.png

Sample Settings for the Emitter shown 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,
});

Update on Three.js r73

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Assistance with selecting elements using jQuery

I'm facing a challenge with a code that I cannot change. My goal is to introduce a selector that can choose (upon clicking) all elements below it until the next occurrence of the main element. The catch is that they are not nested, just stacked on top ...

Difficulty encountered when positioning a container using BootStrap 4

As a newcomer to the world of web development, I encountered an issue while trying to align a container on my webpage. Despite my efforts to center the container using (line 30), the page seems to update but there is no visible change. Can anyone help me ...

Utilizing browser local storage in web development

Currently, I am in the midst of working on an e-commerce platform, a project that holds significant importance for me as it marks my debut into major projects. For the first time, I am delving into the realm of local storage to manage basket data such as q ...

MVC3: Easily browse through tables by accessing details directly from the details view, eliminating the need to click on

I am currently working on an Index view where a table displays a list of items, each with a link to show its details in another partialview loaded through Ajax. Users have expressed interest in being able to easily navigate between "Next Item" and "Previo ...

jQuery and Easy Dialog

My jQuery Model window has a form inside. Even though I have set autoOpen to false in my dialog, the fields are still visible when the page is created. All forms are contained within a div. This is what my dialog code looks like: $("#dialog-form").dial ...

Locating the Smallest Value in an Array of Objects

Looking at an object with keys containing arrays of objects that each have a price value. The goal is to find and return the lowest price value. In this scenario, aiming to return the value 8. Wondering if using the reduce method would be the best approach ...

Deciding whether an item qualifies as a Map in JavaScript

I have been working on developing a function that will return true if the argument provided to it is an instance of a JavaScript Map. When we use typeof new Map(), the returned value is object and there isn't a built-in Map.isMap method available. H ...

Proper Techniques for Parsing JSON Data

Currently, I am utilizing the PokeAPI. My approach involves making fetch requests to obtain JSON data from a specific endpoint, and then attempting to parse and return it. The function responsible for this task can be located below: function getPokemon(id) ...

What is the best way to start the server when the files are located in separate directories?

I have organized my project into two separate folders, one for the client and one for the server Is there a way to use npm start to simultaneously run both the frontend and backend scripts? Check out the screenshot below: View of Two Folders in my Projec ...

Guide on updating location and reloading page in AngularJS

I have a special function: $scope.insert = function(){ var info = { 'username' : $scope.username, 'password' : $scope.password, 'full_name' : $scope.full_name } $http({ method: &ap ...

Issues with OrbitControls in THREE.js are preventing proper functionality

After setting up my JavaScript code to utilize Three.js OrbitControls, I thought I had everything in place: <script>"OrbitControls.js"></script> As well as: var cameraControls; cameraControls = new THREE.OrbitControls(camera, renderer.dom ...

Is there a way to assign a numerical value to the data attribute of the "p" tag?

As beginners in coding, we are introduced to various value types such as strings ("Hello"), booleans (true), and numbers (1). I am curious, how can I assign a number value to a <p> tag instead of a string? Is there a specific number tag that should ...

Encountered an unexpected identifier error while executing a Nuxt.js project

I am utilizing the following technologies: Node.js version 6.14.2 NPM version 6.0.1 Ubuntu 16.04 Whenever I attempt to execute a project, I encounter the following error message: npm run dev node_modules/nuxt/lib/core/module.js:14 async ready( ...

Change the class of <body> when the button is clicked

One of my tasks involves adding a button that, when clicked, should give the body the class "open-menu". Implementing this using jQuery was quite straightforward - I just needed to add the following line of code: $('.burger').click(function() ...

Can the use of setTimeout alter global variables?

let currentVariable = 'ye'; setTimeout(()=>{ currentVariable = 'lin' },2000) Hey everyone, I have a question. Initially, I set a variable currentVariable to "ye", and then in a setTimeout function I change it to "lin" after 2 s ...

Encountering an issue: Module not found - 'cryptile' during express js installation

Just dipping my toes into the world of Node.js and I'm encountering some obstacles when trying to install Express.js. Seeking assistance in resolving this issue and successfully setting up Express.js. https://i.stack.imgur.com/PlHiB.png Interestingl ...

What is the best method for encoding non-ASCII characters in JSON.stringify as ASCII-safe escaped characters (uXXXX) without the need for additional post-processing?

In order to send characters like ü to the server as unicode characters but in an ASCII-safe string format, I need them to be represented as \u00fc with 6 characters, rather than displaying the character itself. However, no matter what I try, after us ...

I am attempting to send an array as parameters in an httpservice request, but the parameters are being evaluated as an empty array

Trying to upload multiple images involves converting the image into a base64 encoded string and storing its metadata with an array. The reference to the image path is stored in the database, so the functionality is written in the backend for insertion. Ho ...

When using Next JS with StoryBook, an error may occur if styles are written in a module.scss file

Every time I try to add some styles to my ButtonWidget.scss file, I encounter an error in the console when running the command yarn storybook Error Code: ERROR in ./src/components/ButtonWidget/ButtonWidget.module.scss 1:0 Module parse failed: Unexpected ...

Retrieve the original content of a file uploaded by a user in Node.js using Express

Can we extract the raw file contents from a user uploaded file using Node.js Express? app.post('/images', upload.single('image'), async (req, res) => { const file = req.file ... I have come to realize that the file variable in t ...