Wednesday, May 20, 2009

The architecture of mental ray

Figure 1 shows the standard mental ray architecture.
Figure 1 standard mental ray architecture.


F1: Application scene file: Application proper file. For example, .max (3dsmax), .ma or .mb (Maya), .scn (XSI).

F2: .mi file: mental ray scene description file. If the DCC software has mental ray plugin, or integrates mental ray, they usually support .mi file export. (A2)

1. Application: DCC (Digital contents creation) software. For example, Maya, 3DSMax, XSI, CAD program, and so on.

2. mental ray core: mental ray core program. There are library version mental ray and stand alone mental ray. The library version mental ray is usually invoked by a DCC application via translator module of the application. A translator is a module of a DCC application which translate the DCC application's internal data structure to the mental ray data structure. The stand alone version mental ray reads a .mi file and performs the rendering. If you have only mental ray core, mental ray does not work. mental ray always needs shaders. It might be easier to understand that if you realize the shaders are plugin software.

3. mental ray base shader: mental ray supports these shaders as default. There are basic light sources and basic materials. For example, one of the simplest shader is the Lambert shader.

4. Application shaders: Each DCC application or CAD software has own proper shaders. For example, 3dsMax has 3dmaxshaders, Maya has mayabase shader package.

5. Custom shaders: User defined shaders or special shaders from mental ray (for example, mia_material. In 3dsMax language, it is Design and Architectural shader).

Although this structure is a standard, some application does not tightly communicate with mental ray and uses .mi files.

The important thing of this figure is that mental ray core itself does not work without (either default or special) shaders. Shaders have an impornat role in the standalone mental ray or an integrated mental ray in DCC application. Actually, mental ray can not generate meaningfull images without shaders. (mental ray core still can generate a black image without shaders.)

Thursday, May 14, 2009

Using stand alone mental ray

If you render a scene using Maya, 3dsMax, XSI, and so on, you can skip this part of article. If you have your own shaders or you are managing a render firm, then this might help you a bit.

References of mental ray

The following mental ray references are the important ones.

  • Thomas Driemeyer, Rendering with mental ray, 3nd Ed. (Mental Ray Handbooks 1), ISBN-13: 978-3211228753
  • Thomas Driemeyer and Rolf Herken, Programming mental ray, (Mental Ray Handbooks 2), ISBN-13: 978-3211838518
  • Andy Kopra, Writing Mental Ray Shaders: A Perceptual Introduction (Mental Ray Handbooks 3), ISBN-13: 978-3211489642

These are advanced documentation and there are some more introductory documents around. Among these three books, I think Andy Korpa's book is easier to read. There is also a support page of the book http://www.writingshaders.com/.


Getting mental ray

In my case, I use mental ray at my company. Therefore, I have no problem to get mental ray. However, if you want to have mental ray in private, buying Maya, 3dsMax, XSI, and so on is the simplest way. I heard one license of stand alone mental ray costs 1000 dollar. But I am not sure about this.

If you just want to get a license of stand alone ray, getting the Andy Kopra's book seems most simple. The CD-ROM of this book contains almost full version of mental ray 3.6+. When I check the book on Amazon.com (2009-5-14(Thu)), the price is 157 dollar. This mental ray is a full version except parallel rendering functions. It means this one can generate the same image as the regular version except network rendering and multi-thread rendering. This one only use one core of your computer. However, 160\$ is a reasonable price.

Wednesday, May 13, 2009

What is mental ray shader?

mental ray shader is C/C++ code that is invoked by the mental ray core when a ray hits an object. The name ``shader'' is used by hysterical reason, I think ``Plugin'' is much better word nowadays. mental ray shader gives us a lot of freedom for users, but, I think we do not need to write a custom shader in most of the cases.

The meaning of 'gives us a lot of freedom' is when a ray hit an object, a user could almost everything by a shader. For example, when a ray hit an object, mental ray can send an email from the shader. (I believe that mental ray designer does not recommended this kind of side effect usage, but, a shader is just a plugin and it should be possible.) You can do anything means also it is difficult to handle the shaders. mental ray was developed for a long time and takes care of backward compatibility, this contributed for its complexity.