2012. 3. 29. 18:15

Facing Ratio

In computer graphics, raycasting is a technique used as part of raytracing. We shoot rays out from our camera and into the scene, and these rays must hit an object. When this hit occurs, the computer knows that it must paint that part of an object. If there is no hit, then the computer doesn’t need to paint it at all. It’s like using a bow and arrow in the dark. If you shoot an arrow and you don’t hear a sound, you know that nothing’s there. But if you shoot the arrow and you hear a high-pitched scream, you know that something’s there.

But a computer needs to launch more than one or two arrows. It needs to launch an arrow for each pixel on your screen to determine whether it needs to draw something in it or not. (If you think I should put a diagram here to clarify things, add a comment to this page. :))

The Sampler Info node holds information about an object, hit by this ray, in each pixel and can report information such as the camera’s X Y Z value at a point, the object’s X Y Z value, the normal of the object at the point, and the facing ratio of the object at a point.

Facing ratio first takes the point of the object and reports back its normal vector. Then it’ll take the dot product of this and the camera’s normal vector and return the absolute value of it all.

For example, the camera above shoots a ray at the ball straight-on and we find that the normals are parallel. The dot product of two parallel vectors is 1.0.

The normal at the top of the ball is perpendicular to that of the camera, so the dot product is 0.0. Facing Ratio returns this value.

Qualitatively, if it’s straight-on, Facing Ratio will give you a value of 1. As a surface becomes more and more slanted, the Facing Ratio will become 0. For example, I connected Facing Ratio to the Incandescence channel of the objects’ materials here. Notice how it’s white in places that are facing me, while it becomes darker towards the sides of the objects.

In this example, I’ve connected the Facing Ratio to the material’s transparency. You can see through the objects whenever it faces us, but as it comes towards the sides, it gets more opaque. Can you think of places where you’ve seen a similar effect in real life?

In physics, the index of reflectivity is stronger if you’re viewing an object towards an angle, rather than straight-on. If you look at a glass straight-on, you don’t see much of a reflection. But if you look at it from an angle, there’s more of a reflection. In Maya, you can also connect Facing Ratio to the reflectivity of an object, thus controlling how reflective it is. I believe this is called the fresnel effect.


source : http://www.stevenchan.us/facing_ratio_shader_node_in_maya

'CGI > Basic' 카테고리의 다른 글

Three-Point Lighting for 3D Renderings  (0) 2012.10.08
Normal  (0) 2012.05.14
Polygon, Nurbs, Primitive  (0) 2012.05.14
Polygon이란?  (0) 2012.01.01
벡터와 스칼라  (0) 2011.12.04
Posted by innie