Monday, November 12, 2007

Hollow Sphere in Blender

For a scene in one of my books (a public bath on the TAURUS), I need a ball of water suspended around the center of a large sphere. The sphere outside is the "ground" (you can walk around in it; it's like the Hollow Earth theory but my version is just the product of careful alien design using magic a.k.a hi-tech to control gravity). I decided to render this in Blender to get a feeling how such a thing might look. What would my character actually see when they step into the bath?

Boolean operators are traditionally a weak spot of Blender (they are a major strength of POV-Ray, if you like text-file driven modeling). I had some trouble to get it to work and if you want to achieve a similar effect, here is how I pulled it off.

Inside

First add the inner object (this makes selecting more simple). In my case that would be an Icosphere (Press "Space", Select "Add" -> "Mesh" -> "Icosphere") with 3 subdivisions (to make it appear somewhat round even at the edges) and a radius of "4.000". This should look roughly like this:

Since this is supposed to be the inner volume of the object, there is a problem: Blender thinks it defines the outside. The key information are the "face normals". Open the mesh tools (Press "F9") and select "Draw Normals" on the far right (in the "Mesh Tools1" tab; use the middle mouse button to drag the tab into view if you have to - it's on the far right). Now the sphere sprouts little cyan pimples. Zoom in and rotate the sphere and you'll see that they start on the center of each face and extend outwards. This is how Blender knows "outside" from "inside": The direction in which the face normals point is "outside".

To turn this into the inner volume, all you have to do is to click on "Flip Normals" ("Mesh Tools" Tab, third line, last button). If you have "Solid" rendering active, the face normals will become tiny dots because the triangle faces now hide the rest of them. The object will still look the same but now, you're "inside" of it. Since all objects in Blender are hollow, it doesn't mean much ... for now.

I want a ball of water and water doesn't have edges, so I also smooth the surface ("Set Smooth" at the bottom in the "Link and Materials" tab). This doesn't change the actual geometry; it just draws the object smoothly. In my version of Blender, the object suddenly went all black at this point. Probably because I haven't assigned a material, yet. Selecting "Solid" rendering helps.

Connecting Hole

I needed a connection between the two sides (there is a "hole" in the hollow water ball where you can swim from one side to the other if you don't want to dive through it or use the walking spires or elevators in the restaurants), so I cut a hole in the inner sphere by selecting one vertice and deleting it (press "X" and select "Vertices"). In the image, you can see the lighter inside of the sphere shine through the hole:

Outside

Before I can create the outside, I must make sure that nothing is selected (or Blender would add the new points to the active object): Enter "Object Mode" ("Tab") and select nothing (Press "A" until nothing is highlighted anymore).

For the outside, I create another sphere. Make sure the cursor hasn't moved, so the centers of both objects are the same. If it isn't, select the sphere, press "Shift+S" (Snap) and then "Cursor -> Selection". When everything is ready, add the second icosphere: "Space" -> Add -> Mesh -> Icosphere, 3 subdivisions, Size "5.00". I also make that smooth but I leave the face normals alone (this is the outside after all).

Again, I delete the face where the connecting hole is supposed to be: Select a point (in "Edit Mode") and press "X" -> "Vertices". Now, you might face two problems: a) the hole in the inner sphere is somewhere else and b) the hole might be below the one you just cut but it's not perfectly aligned. If that is the case, you were in the wrong view.

When creating an icosphere (a sphere made of triangles instead of rectangles), the triangles don't have all the same size. If you rotate the sphere, you can see that they are uneven somewhat. I found that the triangles touching the horizontal axis are very even. The solution: Create the spheres in one view (for example YZ) and cut the holes in another (for example XZ). So after doing everything again and cutting in the right views, it should look like this:

As you can see, I did erase the vertice on the Y axis. Next, shift select both objects (use the outliner if you have problems with the inner sphere) and join the objects (use the menu or "Ctrl+J").

Smoothing Out the Wrinkles

After joining, it's simple to close the whole: Switch to "Edit Mode", select all vertices (six on the inner sphere, six on the outer, sequence doesn't matter) and "fill" them with faces (in the menu Edit -> Faces -> Fill or Shift+F). If you rotate the scene, you'll see that new triangles have been created but they look ugly in the otherwise smooth surface of the ball. Even using "Set Smooth" doesn't help; the angles between the hole and the rest of the surface is just too big (mostly perpendicular). To fix this, use "Subdivide" ("Mesh Tools" tab) and "Smooth" (same tab). This halves the selected faces, creating new ones and the smooth step evens the angles. For me, it now looked like this:

Holy ugly! What's wrong? I've left a hint ... can you find it?

It's the face normals again. For some reason, they point into the wrong direction around the hole. After a few undo steps (press "U"), I'm back at the point where the faces have just been created (before the smooth/subdivide steps). One "Flip Normals" later, the color transitions around the hole look much smoother. Back to another round of subdividing and smoothing. After the hole was as I wanted it, I noticed that the "horizon" of the ball still looked rough, so I selected all vertices, did another subdivide and several smooth to end with this result:

Pretty smooth, eh?

Rendering ... With POV-Ray

After fumbling with water that looks at least a bit realistic, I created the same scene with KPovModeler (with water but without the hole *sigh*) to give you an idea what someone, standing on the "ground" would see:

Each piece of the red-white checker pattern on the walking spires is 10x10m, the ball hovers 1250m above the observer, has a diameter of 500m and the water is 50m thick/deep. The two blue cubes are both 100m big, one is standing on the opposite side on the "ground", the other floats on the water. Anyone wants to add the water-slides, diving platforms (1250m jump!), etc.? With that much water and these dimensions, we'll probably also have clouds, too. The spires don't hold the water there, by the way, they are just a means of transport (if you don't want to jump or use the slides).

2 comments:

"the Dude" said...

Hi, i just stumbled here, found it interesting. I do some studies on geodesics, surface tension etc. I'm not good at 3D modeling though.

At my coffee blender blog, I've got a post on how water behaves in microgravity, and when water drops are inside a gas CO2 bubble inside a water ball.

See the water balls and bubbles post if interested.

Aaron Digulla said...

I'm taking the liberty to copy the links from your blog since it has been hacked with IFRAMEs that install trojans on anyone's computer who visits it.

Drinking tea with chopsticks on ISS

Wave in water bubble, recursive water bubbles

These are rather nice. In my case, I don't have microgravity but these videos give a great idea how the bath ball might look.