Saturday, July 24, 2010

iray 5: iray in standalone mental ray

So far, I told about exporting an mi file. Now here is the shader conversion for iray.

iray supports mia_material. To reuse current scenes, it is nice if I could convert the 3dsmax shaders to mia_material (Arch&Design) shader. I could imagine that some of other shaders will be supported also, but, iray is a CUDA program. CUDA has a divergence problem, it means, if many kind of shaders are in the scene, the performance becomes low. That's natural. A shader is a function and many different shaders are running on a CUDA device, I could see it will be slow. But, if the same function everywhere, then CUDA works well. (in theory. If function itself has a lot of branches, then there is a problem. Though many obstacles are there, but many kind of shaders seems to have not so chance. ) Also I imagine there is less trouble if I use the mental images native supported shaders since iray is a new renderer. In my personal opinion, I would convert the shaders.

You can find 3dsmax shaders to mia_material convert 3dsmax script here (https://code.google.com/p/shitohichi-tools/source/browse/#hg/mentalray/max2mia_material). This is based on Zap's VRay shader to mia_material converter (http://mentalraytips.blogspot.com/). Thank you, Zap. You can find two scripts. The main script is yh_max2mia_material.ms. Open this and evaluate, then the shaders in the scene will be converted. (yh_material_object_map.ms is a collection of subroutines. Therefore, this script is also needed.)

Of course, automatic conversion never be perfect. Some will fail. But, I think this is a good start point if there are many shaders in your scene.

From next week, SIGGRAPH starts. (I've never been SIGGRAPH.) I assume there is some iray demo there.

I concludes the shader conversion story here, at least this moment.

Wednesday, July 21, 2010

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.

Thursday, June 10, 2010

iray 3: iray in standalone mental ray

How to export mi file from 3dsmax.

1. Assign mental ray renderer as Production renderer

First open the Render Set Up dialog. Figure export_mi_1 show that opening
the rollout of assign renderer and then choosing the mental ray
renderer as Production renderer.

Figure export_mi_1


2. Export a mi file from 3dmax.

Choose Render Set Up --- Processing Tab.
First you need to choose a filename as in Figure export_mi_2. Without a file name, the checkbox of 'Export on Render' is disabled. This was difficult for me. I wanted to export a file, but Export on Render is disabled. I wish I could choose the Export on Render and then see a warning message, ''an export file name is not specified.''

Next, push the Render button, then a mi file is exported.

Figure export_mi_2


This is also difficult for me.

When you 'export' a file, push the 'render' button.

I wish it was like

  When you 'export' a file, push the 'export' button.

Wednesday, June 9, 2010

iray 2: iray in standalone mental ray

Even iray has no customized shaders, iray has a shader. It is mia_material (Arch&Design in 3dsmax) only. Actually, it is a shader that has mia_material interface and the implementation is different from mental ray (only for iray). mental images explains this is for the users who already know the mia_material. Such user doesn't need to learn the iray shader from the scratch. Therefore, some of the physically meaningless parameters of mia_material are disabled. They also said that they will support more physical shaders, like BRDF shaders. Someone  asked about volume shaders support at the confenence, but, unfortunately, iray version 1 doesn't support volume shaders and will be supported in the following versions sometime.

As for a DCC software user, the problem of iray is they can use it from 3dsmax/Maya/XSI or not. But NVidia's explanation is 'that is autodesk's decision.' Although, mental ray 3.8+ standalone or NVidia RealityServer support iray. (See mental images web, www.mentalimages.com)

But I found another possibility, Bunkspeed Shot: Bunkspeed iray demo. http://www.youtube.com/watch?v=t5cn4UNqBfY

In my case, it is possible to use mental ray standalone, I would like to use iray via mental ray 3.8+.

In this blog, I will explain how to use mental ray standalone from 3dsmax. (Maya is similar anyway.)

This is basically useful for render farm users (only). But, if iray did not supported by 3dsmax/Maya/XSI, it might be useful.

Thursday, May 27, 2010

iray 1: iray in standalone mental ray

* As far as I know, we can only run mental images' iray in NVidia's RealityServer. I hope Autodesk 3dsmax/maya/xsi supports iray soon.

mental images (a subsidiary company of NVidia) demonstrated iray renderer in GDC's keynote and SIGGRAPH ASIA 2009.

GDC NVidia iray demo (YouTube)
mental images iray page

mental ray or some other renderers can simulate indirect illumination in some extent, but the methods final gather or photon map are quite rough approximation. They have no guarantee to converge to the correct answer. Also there are many renderer parameters for performance optimisation. These parameters heavily depends on the scene. It is difficult to achieve high quality and faster rendering.

These methods are anyway time consuming, therefore, we sometimes put invisible light sources by hand, that simulates indirect lights. This iray is a brute force path tracer and there is no renderer parameter, but nowadays computer has not enough power to compute the light transport simulation in straightforward way. Then they use GPU. The demo shown in YouTube uses a GPU cluster. GDC demo shows interactive rendering with such a high quality. It is impressive. But you need 15 Tesla cards. (How much is it?) I heard Tokyo Institute of Technology has Tesla or Fermi cluster, does anybody know do they run iray on that? I am interested in that. SIGGRAPH ASIA 2009's demo showed five Quadro 5800 FX cards machine. (Still I can not afford it. But demo was nice I think.)

iray is a physically correct light transport simulator. At least it is based on more physics than mental ray. SIGGRAPH ASIA demo people explained that iray has only build-in shaders, actually only one build-in shader. Someone asked if he needs to use a custom shader, what iray can do. The answer was:

  1. iray only support this world physics. Unfortunately iray doesn't have a plan to support other physics.

  2. If you really want not non-physical stuffs, please use mental ray or ReallyServer's software renderers.

That's true, they said this is a physical light transport simulator and he asked how can he customize the physics. They also explain that the target customers are architect, car designer, industrial designer, and so on. So not oriented to the people in film production. Since artists rather cares good pictures than physically correctness. mental ray will continue and that's for the artists. After all, it seems

   1. to the people who wants physical simulation: iray
   2. to the people who wants customize the image: software renderer(e.g., mental ray) + MetaSL.

First time people saw iray, they were a bit confused. Why mental images will have two renderes? Because there are different customers and needs.

Tuesday, January 19, 2010

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, I expect that the software runs faster or more comfortable to use. On the other hand, there is no such limitation for GPU that has a lot of cores inside. NVidia/mental image's new renderer 'iray' seems no such limitation for number of cores. I don't know why CPU and GPU have different licensing method. It is just a historical reason, or they are promoting GPU. But, then, Intel or AMD might sue such a license. Fro the users, it is not so great to be suffered by such a strange licensing form.

I believe if you have a problem with mental ray on an Intel Core i7 machine, you could get the updated version when you asked to the support. But, if the support doesn't know this problem, I recommend to refer the above mental images official forum's link and request the fixed version of mental ray.