Adverti horiz upsell
Faking micro-bevel with mentalRay
Faking micro-bevel with mentalRay
hbahnassi, added 2005-10-19 12:23:32 UTC 39,223 views  Rating:
(2 ratings)
Page 1 of 2

It is very rare to find perfect hard edges in the real world even on the hardest surfaces around. Actually it is something not desirable (imagine a building with a corner as sharp as a blade� yikes!).
However, most 3D images are made of discrete polygons that have no sense of humor. They�re just that! Polygons made of very sharp and clear edges. This usually contributes to a mysterious unnatural feeling about the final rendered image (ever wondered why a perfectly-rendered architectural 3D shot still looks CG?).

This problem is exaggerated more and more with materials that have a specular term added to their definition, making rendered objects look way too CG (if you know what I mean).

Micro-beveling in action

Manually fixing this issue is a very time-consuming process in most cases (find the edges, add more polygons there, adjust the normals�etc).

click for larger version
The cost of hand-made beveling

A more efficient method for achieving this is to fake it using shaders (mentalRay, or better yet, in real-time). So, we are now looking at a �render-time� solution to the problem.

This tutorial will be divided to two parts. The first one (this one) will cover doing this effect using mentalRay. The other part will achieve the same effect but in real-time (by using the new version of DSK|Shaderbass). So let�s waste no more time�

Skill Requirements

  • Good background in the mentalRay rendering system
  • Good understanding of the XSI render tree or any other equivalent system that supports mentalRay and shaders assembly
A Normal Story
Before we get our hands dirty with shader work, we�ll first take a brief look at the main concept behind this effect. It is fairly simple; it depends on modifying the lighting interaction between the object�s surface and light sources for each sample. As we all know, the surface normal is the component that controls this kind of interaction. We can experience this very easily in XSI with the normal editing add-on.

Tweaking normals

So, first turn on �Normal Viewing� from the camera display options and take your time to play around with your object�s normals either using the normal editing add-on or by modifying the hardedges and smoothing angles.

Note how as you change the surface normal direction, the affected surface�s interaction to light changes also.

Now we will depend on this fact to customize the surface normals around the object�s hard edges to give them a beveled look.

We will implement this in XSI without writing any line of code actually (most of us aren�t so much of programming techies).

Did you use the �vector state� shader node before? This magical mentalRay shader node will be of great help to us. This shader node returns a wide variety of states about the currently rendered sample in mentalRay.
So in XSI, if we grab an instance of this node and open its property editor, we�ll see how we can specify which of the available vector states to return, so we use them in our assembled render network.

Obtaining a vector state node

Amongst the available states, we are most interested in two of them. These are the �Geometry Normal Vector� and the �Normal VectorNormal Vector� states.

Each one of these two states returns the surface normal at each sample mentalRay is rendering. But they differ in that the �Geometry Normal Vector� returns the unsmoothed surface normal (called face normal too) without taking into account the actual surface normals while the �Normal Vector� simply returns the actual normal for each sample.

Face normals and smoothed normals

Now what we need to do with these states is simple.

We�ll use them to render the unsmoothed normals (Geometry Normal Vector) all over the object and mask the smoothed normals (Normal Vector) only around the edges, and that�s our next step in this tutorial.