Saturday, December 17, 2011

How hard can it be? Extruded, beveled text in Houdini.

Nadya asked me to create a simple 3D model to help her practice texturing. Specifically, she asked me for the letters "N & S", big and white, like the Hollywood letters on their mountain.

At first, I was a bit disappointed. Extruded letters? That's it? Seems like a waste of my talent. Might as well ask a Photoshop user if she knows how to create a lens flare effect! In fact, extruding text is such a common task that the Extrude operator's icon is an extruded "T".
  1. Lay down a Font operator, changing the text for "S & N".
  2. Lay down an Extrude operator, reducing the depth if necessary.
  3. There is no step three!
3D modelling is rarely that easy.


That was easy, but Nadya was not happy with the result. The edges are way too sharp! Real-world 90 degree angles don't look like that.

This is the sharpest-looking corner in the room.
Can you spot the bevel?


If real-world objects had true 90 degree angles, their corners would be dangerously sharp. So while the faces of the table above are at 90 degrees from one another, they do not actually meet at 90 degrees. In fact, the faces themselves do not meet. There is a very thin 45 degrees rectangle beween them, and a tiny triangle at the corner, joining the thin rectangles formed by the three edges. This is a very common setup, called a "bevel".

The bevel should be much easier to spot this time.


By increasing the size of the bevel and adding more intermediate angles than just 45°, corners can be made to look very smooth. Let's add some bevel to our extruded text.

Something doesn't feel right about this bevel.


Yikes, spikes! As you can see, laying down a Bevel operator is not enough. The operator handled the S just fine, but something about the ampersand geometry is messing things up. What is it?

Who put these inner edges on my ampersand?


One of the problems is that the ampersand has holes. Representing an area with holes requires more than one curve: one for the area's perimeter, and one for each of the holes. In a node-based modeller like Houdini, however, this representation has the disadvantage that each operation needs to take the possibility of holes into account. For this reason (or maybe for historical reasons), Houdini uses a simpler representation which assumes that faces never have holes, and can thus always be represented using a single curve.

Faces which do have holes need to be cut in a special way, so that they don't really have holes, yet look like they do.

A convoluted perimeter, yes, but no holes.


This representation is usually adequate. Most operators preserve the shape of the face, so even after many transformations, the fake hole usually continues to look real. There is one operator, however, which does not preserve the shape of the face. This operator is none other than our spike-producing friend, the Bevel operator!

What you want (left) is not always what you get (right).

This is an "inset", the first step towards a bevel.
Houdini doesn't have an Inset operator, but you can easily
make one by playing with the parameters of the Extrude operator.


Now that we understand the cause of the problem, how do we fix it?

I still hope there is a better way, but the solution I found was to make two copies of the ampersand. The inner edges can be moved elsewhere along the face without compromising the look of the hole, so I can place the inner edges at different places on each copy. This way, the bad parts of the beveled ampersand will look fine on the other copy.

I was planning to use a Knife operator to slice away the bad parts of each copy. While playing with the Knife operator, I discovered that slicing a fake hole has the nice side-effect of replacing the fake hole's inner edge with the knifed-in edge. Convenient!

The Knife operator adds, but also replaces inner edges.


Now that we have an easy way to move inner edges around, we are ready to complete the ampersand bevel.

A mother ampersand splits into two baby half-ampersands,
who in turn grow and become 3D half-ampersands. They then
find a mate of the opposite half, with whom they live in symbiosis,
forming another mother ampersand. Thus completing the circle of life.


The result looks good this time. To make it look even better, we can increased the number of points each letter uses to approximate its font curves. Unfortunately, this leads to more problems!

The acute angle at the bottom-right of the ampersand has an artifact which only shows up with the increased point density. Fortunately, this corner is made of straight edges, so we don't actually need the increased point density. Using the multi-purposed Facet operator, we can clean up the polygon so that straight edges don't use so many points, thereby getting rid of the artifact.

Extra divisions are useful to make curved segments smoother.
Extra divisions in the straight segments, on the other hand,
are worse than useless: they can actually produce artifacts!


One last Facet operator to ensure the front faces are completely flat, and voilĂ ! We're ready for a nice, extruded, beveled, boring piece of rendered 3D text.

I guess I should mention somewhere that
"S & N" stands for "Samuel and Nadya".
Yup, that's us!


I wonder what Nadya is going to create using this? To find out, stay tuned!

4 comments:

  1. Aaaaaaaah, I LOVE your article!!!! So funny!!!

    ReplyDelete
  2. Lovely tutorial. Having this problem right now but larger text. Any new solution for this? :-)

    ReplyDelete
    Replies
    1. No, but that sounds like an interesting challenge! I'll let you know here if I come up with something.

      Delete
    2. I have published a new post detailing my solution to your problem. I hope it's not coming too late! I found the solution early on, but it took forever to explain the technique in a sufficiently detailed way.

      Delete