Welcome to the fluid tutorial series for 3ds Max 2018 Update 3.
In this series, we'll be diving into a range of use cases to help you get up and running, or more appropriately, swimming with fluids in Max.
We'll begin with a basic fluid setup starting with an empty scene.
Now, before we take the plunge, there are a few points to keep in mind to increase your productivity with fluids in Max.
First off, the fluid solver in Max is the same Bifrost Fluid solver you'll find in Maya.
Once you get familiar with Max's interface, the same concepts can apply from existing fluid tutorials for Maya.
Second, a few hardware notes - the fluid solver is CPU bound, so the turnaround time of your simulations 
will depend on both the speed and number of CPU cores in your machine.
Having a lot of RAM will also benefit your simulations and your viewport playback.
Finally, we recommend a lot of storage space since every simulated frame will be cached to disk.
Large, high-resolution simulations can quickly fill low capacity drives.
Alright, with these points in mind, let's get started.
Make sure you have 3ds Max 2018 Update 3 installed, then open a new scene.
By default, the fluid's caching mechanism is sensitive to the scene's filename, so save your scene as basic-setup.max.
Make a flat box, and add a sphere on top of it.
Go to the create tab, and select Fluids > MaxLiquid.
Click and drag in the viewport to create the fluid icon.
Let's place it above the sphere - I like to use the quick align tool with the Shift+A shortcut.
For basic setups, you can emit the liquid directly from the icon's position.
The Icon Type is set to "Sphere" with a radius of 5.0.
This radius controls the size of the emitting sphere, while the Icon Size affects the size of the pickable icon helper.
You can dismiss the icon helper by disabling the following checkbox. We'll get back to the Show Voxel Grid checkbox in a bit.
Click on the Simulation View button to open the main Fluid dialog. This is where you'll manipulate all your fluid settings.
We could dock this view, but I prefer to float it outside the main window.
Under the Colliders section, use the pick button to add the sphere and the box.
Then press the Solve button
The solver will make use of all the CPU cores available, and it doesn't block Max.
Which means that you're free to scrub the timeline to check the progress of your fluid while it's solving.
At this point, the viewport preview looks a little blocky, but we can change that under the Display Settings tab.
Change the liquid's Display Type to Plane to get a better sense of how it's behaving.
You can also change the size of the planes to suit your preference. I like mine a little smaller.
With our current setup, the simulation will take an increasing amount of time to solve as the fluid continues to fall below the box.
It's important to manage your fluid based on the shot you want to render. Here, we'll use a kill plane to make our setup more efficient.
Particles that cross the kill plane will be removed from the simulation.
Stop the solver, then create a plane in the scene.
To avoid rendering the kill plane, disable the renderable attribute, and enable Display as Box.
This way, the kill plane doesn't occlude the scene and we still get a sense of its size.
Next, add the kill plane to the Liquid Attributes tab.
When we press solve, we get a dialog asking us if we want to resume the simulation from where we left off, or if we want to restart.
Since we've changed our setup by adding the kill plane, we'll choose to restart.
With the kill plane now part of the simulation, we get a more consistent solve time as the particles are destroyed instead of dropping down indefinitely.
Now, if you've been following along on your own machine, you might have noticed that these simulations take a while to solve.
The biggest contributor to the solve time is the master voxel size.
To access it, go to the Solver Parameters tab and select Simulation Parameters.
The default master voxel size is set to 0.5 units, which produces a high resolution fluid.
The fluid solver works by simulating particles through an adaptive grid of voxels.
If you aren't familiar with voxels, you can imagine them as the 3D equivalent of 2D pixels.
Images that contain a lot of detail tend to have a higher pixel density
In the same way, if you're aiming to have a highly detailed fluid, you'll need smaller voxels to capture all that detail.
The Show Voxel Grid checkbox gives you a sense of how dense your voxels will be.
If you zoom in on the little box next to the icon, you'll see a preview of the fluid's voxel density.
Increasing the master voxel size will make your simulation coarser, meaning that it will solve faster but with less accuracy.
To compare the effect of the master voxel size, right click on Solver01 and press "Clone".
Then left-click on the new solver to select it, and right-click to rename it to "Solver_voxel_size_2".
The UI can be a bit tricky here, so make sure you left-click on the new solver to set it as the liquid's "active" solver 
before you set its master voxel size to 2.
Otherwise, you might be accidentally modifying the initial solver's parameters.
When you run the new solver, you'll notice how much faster it simulates each frame.
When you flip between both solvers, you'll also notice a big difference in detail, and you'll notice that the overall shape of the fluid has changed.
The point to make here is that larger voxel sizes can lead to different results, 
and it's not always a matter of decreasing your master voxel size for your final beauty shot.
An efficent way to guide your progress is to clone your solvers and to compare your changes.
You should also keep a detailed log of the parameters you modified along the way.
So the next thing you might be wondering about is where all this sim data is being stored.
For that, we'll look in the Caching tab.
By default, Max will create a "SimCache" directory inside your project folder.
If you haven't modified any project settings, this folder will usually be under the current user's Documents/3dsMax directory.
Alternatively, you can choose to store the simulation data in a common folder, either on your local machine or on a network drive.
To do that, disable the "Use Project Folder" checkbox and specify your path as the Root Simulation Directory.
If you're rendering your scene on multiple machines, you'll likely want to define a commonly accessible network drive there.
The structure of your cache directory is defined by the "Cache Output File Pattern".
The angle-bracketed items in this path are tokens you can add using the Token drop-down list.
The default pattern starts with the SimCache directory, followed by the scene name, the object name, and the solver name.
If you ever rename your scene, your liquid object, or your solver, the caching system might lose track of existing data.
You can fix that by renaming the folders in your cache directory accordingly.
Once you do that, the solver data should be picked up automatically.
If you want to use fluid data with other systems that support the PRT format, enable the "Export PRT Files" checkbox.
The resulting files will appear under the PRT folder for that solver.
That covers the basics of caching, now let's switch gears and talk about rendering.
In this scene, we're aiming to render a detailed flow of water, so let's resume the high-resolution solve and let it run to completion.
In the interest of your own time, you can choose to follow the rest of these steps on your machine with the coarser simulation.
Once you're satisfied with the overall flow of your particles, toggle the liquid solver off and activate the mesh generator.
When you press the Solve button now, the liquid will be surfaced as a renderable mesh without the need re-simulate the whole liquid.
In case you were curious, the middle button enables the foam solver, which adds extra particles to accentuate splashes and and churning liquid.
You could always enable the mesh generator at the same time as your liquid solve,
however the mesh generator can consume a lot of processing time, which would be wasted if you're looking to iterate on your fluid quickly.
The cached mesh also occupies space on disk, so if you get into the habit of
cloning your solvers while the mesh generator is active, you'll be consuming more storage space than you really need.
To see the mesh in the viewport, open the Display Settings tab and set the Display Type to "Bifrost Cache Mesh".
Any changes you make to these Mesh settings will be applied the next time you run the mesh generator.
You can set the Display Type to "Bifrost Dynamic Mesh" if you want to experiment with any parameters before
you transfer them over to the cache mesh settings.
For example, increasing the Resolution Factor to 2 will yield a much more detailed mesh, at the expense of computation time.
For now, we'll display the cache mesh and let the generator finish its work.
We'll be using Arnold to render our fluid.
In the Simulation View, go to the Render Settings tab and set the Foam's "Render As" option to None.
Currently, if you try to render foam that hasn't been solved, you'll get a blank result in your frame buffer.
This is a known limitation that we'll be addressing in the next update.
Press F10 to open the Render Setup dialog and set the Renderer to Arnold.
We haven't assigned a material yet, so the fluid will be rendered with its current object color.
Press the render button. You should see what looks like splashing paint appear in the frame buffer.
Let's use a material to give it some transparency.
Press "M" to open the Material Editor.
Since we're working with Arnold, some of the material types might not be supported within the material editor.
You can safely dismiss those messages.
Create a Physical Material, and set its Material Mode to Advanced.
Set the Base Color to 0, and the IOR to 1.33 to emulate the index of refraction of water.
Set the transparency to 1, and the transparency color to a very light blue.
Set the transparency depth to 5.
Create an Arnold "Physical Sky" map. Then press "8" to assign it to the environment map.
Add a large ground plane and set its render scale to 1000 to extend it to the horizon.
When we render, our result might appear dimmer than we expected, so let's increase the Physical Sky's intensity to 4.
Much better, now all we need is to increase our sample settings.
I hope you enjoyed this overview of fluids in Max.
There are a ton of settings we haven't touched on yet, and we'll be getting to those in the following videos in this series.
Thanks for watching!
