Skip to main content

iray 4: iray in standalone mental ray

As an example in here, I create one teapot in 3dsmax and assign a mia_material (Arch&Design).

Since 3dsmax exports an mi file with 3dsmax shader dependency, mental ray standalone could have a problem to render that mi file. mental ray standalone usually doesn't have 3dsmax shaders. The main advantage of the standalone mental ray is parallel rendering on a render farm. I couldn't tell the legal license of the 3dsmax shaders. For the safe side, if we have no dependency to the 3dsmax shaders, it shouldn't have a problem. (Or you can also install 3dsmax to all the render farm machine, though it doesn't make much sense.)

If I just render the mi file from the 3dsmax without modifying, I see the following error.

---
> ray -x on -v 5 00teapot_ex00.mi
...
LINK 0.0  error  191007: cannot load 3dsmaxhair.dll, The specified module could not be found.
...
LINK 0.0  error  191007: cannot load mayabase.dll, The specified module could not be found.
...
LINK 0.0  error  191007: cannot load adskshaders.dll, The specified module could not be found.
...
---

They are 3dsmax shaders. If your machine has 3dsmax installed, then you can solve this problem by adding the following shader paths to your rayrc file.

    3dsmax_installed_directory\3ds Max 2010\mentalray\shaders_standard\shaders

However, a usecase of iray, we only need the base shader and the architectual shader. Therefore, we could comment out the following link statements.

link "contour.dll"
link "physics.dll"
link "lume.dll"
link "subsurface.dll"
link "3dsmaxshaders.dll"
link "3dsmaxhair.dll"
link "paint.dll"
link "production.dll"
link "mayabase.dll"
link "adskshaders.dll"
link "mr_prebuilt.dll"

---

First, let's update the camera parameter. You will see the following camera section in the exported mi file.

---
camera "Viewport|Viewport"
    output "+rgba_16" = "ImageCollector|Effect"
    environment = "Environment|Shader"
    lens = "GBuffer_Lens|Shader"
    focal 1.710860
    aperture 1.417323
    aspect 1.333333
    resolution 320 240
    window 0 0 319 239
    offset 0.000000 0.000000
    clip 0.100000 1000000015047466200000000000000.000000
    frame 0 0.000000
end camera
----

We could remove the environment shader and lens shader (until we really needed).  Also this output statement is obsolete at mental ray 3.6. Update it to the framebuffer statement.

---
camera "Viewport|Viewport"
    # output "+rgba_16" = "ImageCollector|Effect"
    # environment = "Environment|Shader"
    # lens = "GBuffer_Lens|Shader"
        framebuffer "main" datatype "rgba" filetype "png" filename "out.png"
    focal 1.710860
    aperture 1.417323
    aspect 1.333333
    resolution 320 240
    window 0 0 319 239
    offset 0.000000 0.000000
    clip 0.100000 1000000015047466200000000000000.000000
    frame 0 0.000000
end camera
----

Then, run the ray again. We will see the following errors still.

----
API  0.0  warn   302004: 00teapot_ex00.mi, line 125: while defining declaration "max_DefaultLight": declaring nonexisting function max_DefaultLight
API  0.0  warn   302004: 00teapot_ex00.mi, line 1926: while defining declaration "max_mia_material_renderelements": declaring nonexisting function max_mia_material_renderelements
API  0.0  warn   302004: 00teapot_ex00.mi, line 2008: while defining declaration "max_NodeVisibility": declaring nonexisting function max_NodeVisibility
API  0.0  warn   302004: 00teapot_ex00.mi, line 2119: while defining declaration "max_base_ImageCollector": declaring nonexisting function max_base_ImageCollector
API  0.0  warn   302004: 00teapot_ex00.mi, line 2133: while defining declaration "max_Environment":declaring nonexisting function max_Environment
API  0.0  warn   302004: 00teapot_ex00.mi, line 2150: while defining declaration "max_base_GBuffer_lens": declaring nonexisting function max_base_GBuffer_lens
PHEN 0.2  error  051011: shader "max_DefaultLight" not found
PHEN 0.2  error  051011: shader "max_NodeVisibility" not found
PHEN 0.2  error  051011: shader "max_mia_material_renderelements" not found
PHEN 0.2  error  051011: shader "max_base_ImageCollector" not found
PHEN 0.2  error  051011: shader "max_Environment" not found
PHEN 0.2  error  051011: shader "max_base_GBuffer_lens" not found
PHEN 0.2  error  051011: shader "max_DefaultLight" not found
PHEN 0.2  error  051011: shader "max_NodeVisibility" not found
PHEN 0.2  error  051011: shader "max_mia_material_renderelements" not found
PHEN 0.2  error  051011: shader "max_base_ImageCollector" not found
PHEN 0.2  error  051011: shader "max_Environment" not found
PHEN 0.2  error  051011: shader "max_base_GBuffer_lens" not found

----

But, we don't use these shaders. Then, we could do the following changes in the mi file:
  • replace max_DefaultLight with mental ray's mib_light_point.
  • replace max_mia_material_renderelements with mia_material.
  • Remove following four shaders (max_NodeVisibility, max_base_ImageCollector, max_Environment, max_base_GBuffer_lens).   Comment out the mia_material's Cutout parameter, since currently we didn't use it.
You can find the result files at
http://code.google.com/p/shitohichi-tools/source/browse/#hg/mentalray/export_mi

The following Figure has mental ray rendering result of Top: 3dsmax, Bottom: standalone. The results are identical.

Comments

Popular posts from this blog

What is shader?

Shader is one of the important component of mental ray. Let me tell about it a bit. A shader is a program code fragment that computes how light interacts with objects. This was the original concept of shader in early computer graphics time and nowadays the role of shader and its meaning are expanded. In one of the common scenario in computer graphics, objects are usually represented as polygons. First, the intensity of each vertex is computed, then inside the polygon is filled by an interpolation method. This becomes more complex as the computer graphics technology developed. There were two shader development directions. One is a hardware rendering that concentrates rendering speed and interactivity. The other is a software rendering that concentrates the image quality. Nowadays graphics hardware is called GPU (Graphics Processing Unit). The early stage GPU has fixed functionalities. Because fixed functionality can be achieved more performance in practice. The implementation was based ...

A note of mental ray/iray camera terminology.

The original mental ray camera is a pinhole camera. Therefore, some of the terminology differs with a normal camera. I will write them down here. aperture: This is the film width size. This has no relationship with lens aperture/opening. mental ray's camera was a pinhole camera, there is no lens aperture. focal: This is the distance from lens to the film (sensor). Pinhole camera always focused, so there is no focal length meaning. But using parameters aperture and focal length, we can compute the horizontal field of view. I think these two parameters exist for this purpose. aspect ratio: This is film(sensor)'s aspect ratio. There is no relationship with pixel resolution and camera geometry.  aspect ratio = film width/film height. Note: If we use aperture, focal, and aspect ratio, we can compute the vertical field of view. mental ray/iray camera model (pinhole camera) without lens shader Current mental ray/iray can have depth of field effect, etc., this termino...

mental ray license bug is fixed on an Intel Core i7 machine

There was a critical license related bug in mental ray 3.7 on Intel Core i7 and the fixed version seems to be distributed now. http://forum.mentalimages.com/showthread.php?t=5511 The fixed mental ray (SPM) version (might depends on OEM) is the following. mental ray 3.7: 3.7.1.31 (2009 September 16) or higher mental ray 3.7+: 3.7.53.6 (2009 October 22) or higher The detail of this problem is: When you want to run mental ray on Intel Core i7 machine, you will get the following error message: Sorry, no license available and can not run mental ray even you have enough licenses left. It seems recent Intel's CPU becomes complex to count the number of cores. This bug seems related with this. http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/ Personally, I don't like the license that limits the number of cores. Because the new machines has more cores, but we can not use these cores because of license shortage. If I buy a new machine...