Part 1: Making a Simple Glass
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p1.png
Step 1) In the following we will model a very simple glass (more
of a mug, actually) by using one of the cool new modifiers.
We'll start with this standard box you get in the beginning.
Start off by saving the file with some reasonable name
like "tut2.blend".
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p2.png
Step 2) Switch to front view (NUMPAD1), enter edit mode (TAB) and rename
the object to "Glass".
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p3.png
Step 3) Switch of the visible selection mode and select the upper row
of vertices with the BKEY. Rotate the view a bit to get a better view
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p4.png
Step 4) Extrude the upper face by pressing the EKEY, select region and
immediatly press enter to place the new face at the same position
as the old one. Now with the new face selected press the SKEY
and scale the new face inwards a bit.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p5.png
Step 5) Press EKEY again, again with region, to extrude the face again,
and move it downwards a bit.
Switch to side view and move the new face down until you have
an even distance on all sides of the cube.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p6.png
Step 6) Leave edit mode with TAB, you should now have a nice hollow cube.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p7.png
Step 7) In the modifiers panel, add a subsurf modifier.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p8.png
Step 8) Increase the Levels setting to 2, and the Render Levels to 4.
Also set the face display mode to Smooth. This has to do
as a glass, it would surely fall over in reality, but you can
definitely fill in something.
Part 2: Setting up the Fluid Simulation
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2p9.png
Step 9) Enable the fluid simulation obstacle setting for the
glass and add a plane mesh below the glass object (best do this
in top mode NUMPAD7 to have it aligned correctly). Dont forget to
put the red-white marker in the correct place to simplify things,
and name it e.g. "Floor".
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pa.png
Step 10) Switch of the shaded mode with the ZKEY, and add a cube
around the center of the glass. Scale it up to be four units
on each side. In side view align the bottom of the cube
with the floor plane, and name it "Domain". Finally
enable fluid simulation and make the cube a domain,
and set it to Smooth shading in the Editing buttons
right away. (Note that the domain box is cubic in this case,
but in general it doesn't have to be.)
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pb.png
Step 11) In top view add a sphere in the lower left corner
of the domain object. Enable the object transform properties (NKEY)
and scale it to something between 0.4 and 0.5 in each dimension.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pc.png
Step 12) Name the sphere "Drop" and make it fluid in the fluid sim
settings tab. The drop should end up in the glass,
let's try an initial velocity around 0.1 for X and Y (not Z, it
will fall down due to gravity anyway).
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pd.png
Step 13) Now we're ready to start simulating:
first reduce the number of frames to e.g. 50.
Then select the domain object again, and
just hit bake for a low-res test simulation
to check if the drop really hits the glass the
way we want. Playback the animation (ALT-AKEY)
and view it from different angles.
It's probably a bit to slow - I ended up
with a initial velocity for the drop of (0.2, 0.15, 0).
Change and re-simulate until you think it's good.
You might also want to reduce the simulation
end time to 0.2.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pe.png
Step 14) Once it's ok, increase the simulation =Resolution=
to 128 (this will need around 300MB of main memory), and
perhaps also the =Preview Resolution= to 30 or 35
to get a more detailed preview. Now the simulation
will take significantly more time (several minutes
probably).
Playback the animation again.
Switch to shaded view again (ZKEY), and
go to some frame inbetween, e.g. 20, by pressing
the RIGHTARROW. Switch the GUI Display setting
of the domain object to "Final" to check how it
will look while rendering. Make sure smooth shading is switched on for the fluid
domain object in the Editing buttons.
Check some other frames, then set the mode to "Preview" again. If you dont
like the result, better reduce the resolution again,
e.g. change the form of the drop and its initial
velocity, and do some more test simulations until
you happy with the result. (Don't worry
about the original drop mesh that's still visible
in this picture - it won't be visible in the end anyway.)
Part 3: Materials Setup
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pf.png
Step 16) For the following, leave the =Frame= setting
somewhere in the middle to see both the fluid
and the glass (e.g. 20).
If you rendered the scene now, it would all look pretty grey and boring. Select the floor,
go to the Shading buttons (F5), click on add new
material, and change the diffuse color to (0.8, 0.4, 0).
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pg.png
Step 17) Let's make the background brighter by
changing to the world buttons, and changing the
background color to (0.4, 0.7, 1.0).
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2ph.png
Step 18) Now select the glass object, switch back to
material buttons and rename its material to "Glass".
Activate Ray Mirror , set the Ray Mir value to 0.15 and
increase the Depth to 7. Then activate Ray Transp
set the IOR to 1.5 (this is the correct physical value for
normal glass) and set the Alpha slider to 0.
Btw. - comparing the pictures you'll see that I forgot to switch
the domain object GUI display to preview before this one.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pi.png
Step 19) For the fluid it's almost the same - create
a new material named "Water", and set the same values
as for the glass, except for IOR, which is 1.3 this
time, and you could set Ray Mir to 0.1 instead.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pj.png
Step 20) From top view, duplicate the light two times (SHIFT-DKEY),
rotate the view a bit, and distribute them around the glass
as shown in the picture. Then enable Ray Shado for each
one in the Lamp buttons.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pk.png
Step 21) Select the camera with the NUMPAD0 key,
and right click the black border to select the camera.
Zoom in on the glass by setting the Lens
value to 90 in the Editing buttons (shift click
the field to enter a numerical value), and use GKEY to move
the camera until you have a good view of the glass,
and the original drop mesh isnt visible anymore.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pl.png
Step 22) Finally ready to render! Just press F12 to render
or switch to the Render buttons, adjust the anti-aliasing
and resolution as you like and click the RENDER button.
If you like the result, use Save Image... (or F3) to
save the rendered picture. With the ANIM button
there you could also render the whole animation
(for this you might want to reduce the rendering resolution).
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pl2.png
Step 22b) Optional - to enhance realism a bit, you can
change the point lamps to area lights. Aim them at
the glass by rotating them, increase the size
to 1 or 2, and decrease the engergy
until the scene is properly lit (check this by doing
low-res test renderings, the GUI display will not
correctly show the scene brightness). Finally
increase the number of samples for each light, to
create nice soft shadow edges. Now rendering takes
much longer of course :) ...
Part 4: Changing the Simulation Settings
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pm.png
Step 23) Let's say you decided at some point, that a
square glass and mud are more interesting than this
standard glass of water. To do this, first
select the glass and disable the subsurf modifier
for realtime and rendering display.
Also switch back to solid instead of smooth shading.
Now the
original square shape is visible. If you play
the animation again it will look strange, as
the fluid does ignore the changed shape until you
bake it again.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pn.png
Step 24) To keep the original water-like fluid,
a new surface data set will be created for the mud.
Select the fluid domain object, and click on the BakeDir
button. Select the directory to put the surface meshes,
and enter "tut2mud" in the filename field, then press ENTER
or click Select Directory.
Now change the viscosity to the honey preset,
and click BAKE. The prefix "tut2mud" will now
be used for the simulation meshes, and the old ones
will not be overwritten.
Note - it might be a good idea to create a directory for
fluid simulation data somewhere near your .blend
files.
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2po.png
Step 26) To make the fluid look muddy, change to the
Material settings, create a new "Mud" material
using the drop down menu, and give it some
mud color. Make sure to switch off alpha, ray
mirror and ray transparence in case they're still
on. You can also set the shaders as shown in the picture
to create a dull brown.
Now you could render the animation again...
It should like roughly like this:
[2](DivX).
http://www10.informatik.uni-erlangen.de/~sinithue/blendfs_tut2/tut2pp.png
Step 27) If you wanted to change to the old
water sim at some point, simply select the fluid domain
object, click the Bake Dir button and select any of
the original surface or preview meshes. These are probably
named such as "tut2.blend_OBCube_surface_...bobj.gz",
or "tut2.blend_OBCube_preview_...bobj.gz". Selecting
any of these will extract the correct prefix from the
filename, and after clicking Select Directory the original
simulation result should be visible
again. To make it look as it should, you of course have to
enable the subsurf modifier for the glass again.
Part 5: Where to go from here...
- An important effect that's missing are visible caustics. If you have a working Yafray installation, you can add photon light sources to generate caustics.
- Yafray also has more realistic surface reflection settings, in combination with interesting backgrounds scenes or HDR images this gives a nice appearance.
- Try setups with more complex obstacle and fluid geometry - the maximum simulation resolution is currently limited to prevent crashes due to high memory usage, but with the highest setting fairly complex simulations are possible.
- Set the drop object to Inflow instead of Fluid a run the simulation again (maybe you have to scale down the drop a bit to prevent the domain from overflowing).
|