Pyro - disturbance on smooth density only

   3277   7   1
User Avatar
Member
59 posts
Joined: Nov. 2017
Offline
Hi guys,

Basic explosion setup, we use disturbance to add high freq detail. The problem is that it's hard to dial it well when it's a single number - you want a lot of it in the start when things are too smooth, but very little of it afterwards. That leads to putting a lot of time in animating it, exposing multiple disturbances, etc.

Is there a way to drive it with the smoothness of the density field? I've tried (a while back admittedly) to make that work by computing curvature and using it as a control field, but it wasn't really working. Any better ideas?

Thanks
User Avatar
Member
8538 posts
Joined: July 2007
Online
you can try using pressure field or speed field as a control filed
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
59 posts
Joined: Nov. 2017
Offline
About speed - I guess you mean that the disturbed parts become slower? I think I've tried that without much success, there were disturbed areas that are still not much slower than the rest.
Haven't tried the pressure field yet though. That might be a good idea, thanks!
User Avatar
Member
236 posts
Joined: March 2013
Offline
Pressure is a great method to use. It's created already, and you can visualize it using the density visualizer to find
useful ranges of pressure to use as your mask/mult.


L
I'm not lying, I'm writing fiction with my mouth.
User Avatar
Member
21 posts
Joined: Dec. 2008
Offline
Hey Hristo,

not sure if that answers your question but you could try applying disturbance only on the outside of the smoke.
I find it easier to control that in a wrangle:

pseudo-code:
-keep voxels outside the smoke
-keep voxels that move fast enough
-create 1D noise (with divscale), if above thresold: create 3D noise
-add to vel

if(f@density<chf("density_threshold")){
    float speed = length(v@vel);
    if(speed>chf("speed_threshold")){
        // 1D noise
        vector hvec = (v@P +  chf("divscale"))/chf("divscale");
        float r1 = float(random(hvec+@Frame+chf("seed")));
        if(r1>chf("noise_threshold")){
            // 3D noise
            vector hvec2 = (v@P +  chf("divscale"))/chf("divscale");
            vector r3 = (random(hvec2+@Frame+123+chf("seed")))*vector(2)-1;
            v@vel += r3 * speed * chf("disturbance_amount");
        }
    }
}

The noises are really basic and quick to compute, just cubes, no smoothing...
Also that way, I'm only adding noise to some percentage of the voxels
eg: if noise_threshold=0.99, only add noise to 1% of the voxels.
it looks a lot more natural, not just adding noise everywhere
... and you can adapt the code to use any mask easily too!
example attached, hope that helps
Edited by bunker__ - May 6, 2022 00:48:36

Attachments:
vex_disturb_01.hipnc (1.3 MB)

User Avatar
Member
59 posts
Joined: Nov. 2017
Offline
Cool idea too, thanks! Will be trying these out and get back to you guys.
User Avatar
Member
59 posts
Joined: Nov. 2017
Offline
Early tests with pressure are quite promising, thanks!
User Avatar
Member
59 posts
Joined: Nov. 2017
Offline
@bunker
bunker__
Hey Hristo,

not sure if that answers your question but you could try applying disturbance only on the outside of the smoke.
I find it easier to control that in a wrangle:

pseudo-code:
-keep voxels outside the smoke
-keep voxels that move fast enough
-create 1D noise (with divscale), if above thresold: create 3D noise
-add to vel

if(f@density<chf("density_threshold")){
    float speed = length(v@vel);
    if(speed>chf("speed_threshold")){
        // 1D noise
        vector hvec = (v@P +  chf("divscale"))/chf("divscale");
        float r1 = float(random(hvec+@Frame+chf("seed")));
        if(r1>chf("noise_threshold")){
            // 3D noise
            vector hvec2 = (v@P +  chf("divscale"))/chf("divscale");
            vector r3 = (random(hvec2+@Frame+123+chf("seed")))*vector(2)-1;
            v@vel += r3 * speed * chf("disturbance_amount");
        }
    }
}

The noises are really basic and quick to compute, just cubes, no smoothing...
Also that way, I'm only adding noise to some percentage of the voxels
eg: if noise_threshold=0.99, only add noise to 1% of the voxels.
it looks a lot more natural, not just adding noise everywhere
... and you can adapt the code to use any mask easily too!
example attached, hope that helps

I started implementing this, in the most basic way first, and it worked immediately - just a random, adding to v multiplied by the random mask for voxel distribution you suggested, amount, and speed. It is extremely simple, looks great and seems robust at different speeds. Doesn't need control fields etc

Vex is super simple:
vector disturb = random_brj(@P,int(@Frame)+12312);
disturb = fit(disturb,{0,0,0},{1,1,1},{-1,-1,-1},{1,1,1});
float distrib = random_brj(@P,int(@Frame)+14545);
distrib = chramp('distrib',distrib);
float mask = length(@vel)*distrib*ch('disturb');
@vel+=disturb*mask;

Attaching a preview gif.
Edited by HristoVelev - June 10, 2022 20:03:29

Attachments:
preview3.gif (4.1 MB)

  • Quick Links