Hey everyone, welcome back to “Introduction to Bifrost Visual Programming”.
In the previous tutorial, we created bonfires using aero simulation.
Today, we are going to use an alternative way to source air properties with the recently
released Bifrost 2.4.
This new version allows us to use fields to specify properties for aero simulations,
and we can now plug fields directly into influence nodes, which we’ll learn in this tutorial.
Bifrost 2.4 also introduces Bifrost-USD and includes various other improvements.
You can upgrade to 2.4 if you’re using Maya 2020 or above.
There’s a link to the download page in the description.
Without further due, let’s get started.
Last time we used the “vary_source_property” node to introduce variations in fog density and
temperature. This time let’s see how to use fields to drive the changes in air properties.
Delete the “vary_source_property” nodes and "animate_source_geo" compound.
Connect the mesh spheres to “source_air”,
and change the geo volume mode to “shell” so that only the surface of the mesh will be
voxelized, which will speed up the simulation.
Let’s get a “fractal_noise_field”.
As we learned in the last tutorial, we can use a scalar field to provide the time.
To control how fast the noise animates, we multiply the frame with a value,
and then connect it to the scalar field.
The range of the noise is from -1 to 1, and we can use an “fcurve_field” to modify the range.
For example, if we want the temperature to fluctuate between 180 and 250 Celsius,
we set the lowest position to be -1, and assign 180 to its value,
set the highest position to be 1, and enter 250 for the value.
Click this “Frame All” button to reframe the modified curve.
Connect the "out_field" to temperature.
This diagram shows how an fcurve field changes the range of a noise field.
Similarly, we can modify the range and apply it to the fog density.
Copy and paste the "fcurve_field",
set the value of the lowest position to be 0.1,
and the value of the highest position to be 0.25,
connect it to “fog_density”.
This set up, compared to the “vary_source_property” node,
allows more control over the details of how a property varies,
and it also makes for a simpler graph.
For example, we can adjust the frequency of the noise,
the seed,
as well as the shape of the fcurve to modify how the air properties change over space.
To better visualize the variations driven by fields, we can use the node
“scalar_field_scope” or “vector_field_scope”, depending on the type of the field.
I’ll do a quick demonstration here.
Let’s copy the nodes that we used for setting up the field animation.
Paste them in a new graph.
Drag “bifrostGraph1” into this new graph.
And let’s copy this “translate_points” as well,
connect “mesh_fire” to “points”, and this gives us the same mesh spheres as those in the
other graph.
Turn off the fire graph for now,
and let’s get a “scalar_field_scope”
and a terminal.
Connect "out_field" to “scalar_field”,
and the mesh spheres to “probe_geometry”.
Let’s decrease the point size,
and now we see the noise pattern.
We can adjust the color remap curve here to modify the colors.
The range that we set up for the fog density is between 0.1 and 0.25,
so let’s enter 0.1 for the first point, and 0.25 for the second point.
Now the range of the field values at the sampled positions is aligned with the default
color range.
We can modify the RGB curves to adjust the colors.
If we change the frequency of the noise, the seed, or the fcurve, we see the corresponding
changes in the color pattern.
If we animate it, we see this continuous change over time,
we can adjust the multiplier here to modify the rate of the change.
Now let’s hide this graph and go back to the fire.
Run the simulation, and the evolving values will trigger a continuous variation in both the
temperature and fog density, and we see the variations in both time and space.
Here’s a rendered animation of the scene.
This setup also allows us to quickly alter the look of the object to test different design ideas.
For example, we can convert the bonfires into fire balls as shown in this picture in just a few
steps.
Here the hollowed part is where the fog density equals zero.
The fog density range that we have right now is from 0.1 to 0.25.
To convert it into a discrete set of 0s and positive numbers, we can first change the value
of the lowest position of the fcurve to be a negative number, say, -0.25,
and then use the node “mask_field”, which returns 1 where the input scalar field is positive
and 0 everywhere else.
If we multiply it with a scalar field of 0.1, the fog density will be either 0 or 0.1,
depending on the location.
Let’s go to the “aero_solver_settings”, change the buoyancy to 0.
Move the mesh spheres up
and decrease this number to slow down the animation of the “fractal_noise_field”.
Run the simulation, and we get the fire balls.
In Bifrost 2.4, we can also plug fields into influence nodes.
For instance, if we add a turbulence influence, we can plug a field directly into this “turbulence”
port.
Let's try “fractal_turbulence_field”.
Copy and paste the scalar so that we have separate control of the animation speed for this
"fractal_turbulence_field".
Connect the "scalar_field" to time, and we’ll have an evolving turbulence influence driven
by the animated fractal turbulence field.
To visualize the animation of the fractal turbulence field, we can use a
“vector_field_scope”.
Let’s copy these nodes into the visualization graph that we created earlier.
Get a “vector_field_scope”.
Similar to the set up for visualizing a scalar field, we connect the field to “vector_field”,
and the mesh spheres to “probe_geometry”.
Connect the “diagnostic_geo” to the terminal.
We can adjust the length and the width of the vectors,
and the base brightness.
If we change, say, the frequency and the magnitude of the “fractal_turbulence_field”,
we’ll see the changes in the vectors and their colors.
And we can adjust the position values of the color remap curve as well.
Run the animation, and we see the motion of the vectors.
Now let’s go back,
increase the frequency and the magnitude of the "fractal_turbulence_field".
Run the simulation, and the result is a different pattern from the one we had earlier.
To increase the negative space, we can simply adjust the "fcurve_field" by decreasing the
value of the lowest position so that we have more negative values in the field.
Now we have completed the scene of our landscape.
I hope this tutorial series helps you get started in Bifrost visual programming.
We’ll have more Bifrost tutorials coming in the near future.
Comment below if you have any question and let us know what you would like to learn.
Thanks for watching, stay tuned and we’ll see you soon.