Blender 3D: Noob to Pro/Realistic Water using Fluid Sim and Yafray

From Wikibooks, open books for an open world
< Blender 3D: Noob to Pro
Jump to: navigation, search

(This was written using Blender v2.43)

Using the Fluid Simulator and Yafray to create realistic looking water[edit]

This tutorial will (hopefully) successfully walk you through creating semi-realistic looking water using the Fluid Simulator in Blender, then rendering in Yafray.

Getting Started[edit]

When you first open blender there will be nothing but a blank cube.

  1. Make sure you are in object mode, and scale the cube up to about 5. Do this by pressing S in the 3d view and holding ctrl, move your mouse until the numbers in the bottom left of the screen are 5. Or select the object and press S then 5.

Where the 5's should appear

  1. Next, in the viewport shading box select wireframe. This lets you see through the cube.

Where the wireframe box is (ignore red and blue thing)

  1. We are now going to enable the cube for Fluid Simulation. With the cube still selected in object mode, press F7 (object button) and then press the "Physics Button".

Where the fluid sim tab is

  1. You should see a tab labeled "Fluid Simulation" press Enable and then Domain. After pressing Domain several buttons will pop up, these will be used later.

The fluid sim tab

  1. Make sure you are in top view now, if not just press NUMPAD7. Next press space>Add>Mesh>Cylinder. 32 vertices is ok.
  2. Now middle click and drag in the 3d view to see the cylinder inside your beautiful box. (yay!) What's going to happen is the cylinder is going to be turned into liquid, and the big box is where the liquid can flow about. (it is the "invisible wall")
  3. Move the cylinder to a corner of the cube, you can give it some height if you like. Now with the cylinder still selected press Shift-D to duplicate it. Move the new cylinder to the opposite corner.

What you should have now

  1. On both of the cylinders go the fluid sim. tab and press Enable then Fluid. This tells blender that these cylinders are fluid.
  2. IMPORTANT!!! After this, you MUST subsurf both of the cylinders, but don't apply it. Instead, when the cylinder shows a preview of the subsurf, click the "X" in the top-right of the subsurf preferences.

(noobie note: I don't know what the above step is for, adding the subsurf then click "X" removed it.)

  1. Switch to Object Mode then Right click on the big box (the domain) and press the big BAKE button. A little box will pop up and just click on the top option.
  2. Now you should see a blob looking thing appear in the cylinders, and it will fall to the ground and splash around. Your computer is "baking" the liquid. (Calculating where it should go)

What you should have now

  1. As you see now, the liquid isn't very realistic looking. If you do a render, you will see. You would also see that the cylinders are appearing in the image. This is not wanted, so with both of the cylinders selected, press M then click on one of the little boxes that isn't already pressed. This moves them to another layer.
  2. Now we are going to move the camera to a different position for a better view. Move the viewport around until it's where you think will give you the best view and press SHIFT-NUM0 to make the camera match your current view.
  3. Drag the newly placed camera back a bit, so the when NUMPAD0 is pressed most of the scene is in view. You should now have something that looks similar to this:

What you should have now

  1. Now we are going to rebake the water at a higher resolution for a more detailed result. Select the goo looking mesh, (both blobs should turn purple if either is clicked) and go the fluid simulation tab again. Turn the resolution up to about 100 (or whatever you want) this rebakes the fluid for more detail. If you turn preview mesh up too, you will see it more detailed before rendering. Baking now may take a while.
  2. After its done baking, you are ready to change the material of the water to something better looking.
  3. First change the renderer to YafRay. Press F10 then under the big Render button select YafRay. Make sure Yafray is installed first, the option still appears if you don't.
  4. Change the background white by pressing F5 then click on the box that has world buttons appear when the cursor is hovered over it.
  5. You will see HoR, HoG, and HoB. Turn these all the way over to one. The preview should turn white.
  6. Now go to the material buttons (red sphere) and make everything look like the following: (I think I circled all the changed options, but maybe not.)

What your material should look like

  1. After this is completed look through the frames by pressing right arrow, find one that looks cool then press render and you may get something like this:

Does it look like yours?

Hopefully you got something like that :)
(that's all folks...)

If the render does not look smooth, apply a subsurf.

Extra Practice[edit]

This YouTube tutorial on fluids might also help: Link and this Realistic Water Texture

Video tutorial showing fluid simulator objects in Blender 2.49b: http://www.youtube.com/watch?v=wX5w1Kmsv_A



User Question: When I click Bake there is no box that shows up, I cannot get it to bake my fluids at all, all it does is add a bunch of files to my hard drive and take a long time, What should I do?

Answer: Be sure to set the directory that you would like the files to be saved to, the option to do so is in the area where you changed the box to a domain very bottom there is a folder. Chose a directory and all will be good.

User question: When i click the bake button it says there can't be more than one domain object. I did everything you said to do but i don't understand why it says that.

Answer: The only solution I have found around that is to go to the top header and where it says "SR:2-Model" change that to actor and select the different objects until you find something that doesn't highlight. Delete those. I found that occasionally a domain "disappears" and when you make a new one causes this problem. I have also found it better to set up the domain last around your scene to prevent this annoyance as well.

Note: The domain object does NOT disappear - the Domain object IS the object on your screen which represents the fluid itself.