View RSS Feed

Tutorials and Games

Cuda! Not the fish!

Rate this Entry
What is Cuda?

Cuda is Compute Unified Device Architecture, or in layman's terms, a graphic card application that allows one that uses CPU intensive graphical programming with their GPU. It's something that was developed by NVIDIA for programs such as 3DS Max. If you run a program like 3DS Max without Cuda integration you'll find that your rendering tends to take quite a long time (sometimes up to 76 hours for a single render), and your GPU isn't even touched. So, you can see the benefits already of Cuda integration.

That's cool.. but why are you telling us this?

The 'object of my desire' so to speak over the last few weeks has been to integrate Cuda with Maya, for which it is -not- usually used. Though 3DS Max and Maya are by the same developer, Maya was never given an in-program GUI to use Cuda based rendering. However, unknown to most is a little Cuda application called iray that works with MENTAL RAY shaders. The fallback? You must have an NVIDIA 4xx or higher card to run this kind of application.

I have no idea what you just said.

So lets start with the basics. When you're using a 3D rendering program, how do you get realistic metals, glass, and reflections as well as shadows? For an advanced user, this is all done through a mental ray interface that allows the user to use a texture called MIA MATERIAL X which will take your settings and give the object in question a glossy finish. Most production companies use MIA MATERIAL X for their rendering as it's easy to use, and very polished in the ending result.

So take into account you've modeled a scene, it's lit and has shadows as well as glossy glass and transparencies. How long will that take? Depending on the size it can take up to two weeks to render a scene like that. However, with Cuda such a feat can be achieved in a number of minutes.

Alright, so how do I use iray in Maya?

Maya 2010 and up includes mental ray, which means that you can use iray right out of the box. Most developers use it as a stand-alone, but for some people who haven't purchased Mental Ray as a standalone application, this isn't possible. So, let's talk about how to get iray to work in Maya since it's so well hidden.

First question, do you know MEL coding? ...no? You're screwed.

Okay no, in all seriousness, this will walk even the most dense user into setting up iray in Maya. And yes, it works!

Copy the following 3 .dll files
cudart.dll
libiraymr.dll
libiray.dll
From: C:\Program Files\Autodesk\mrstand3.8.1-adsk2011\bin
To: C:\Program Files\Autodesk\Maya2011\bin

That's just step one. Here's where things get fun. Mel time!

Use your MEL overlay and type this in:

setAttr -type "string" miDefaultOptions.stringOptions[28].name "iray";
setAttr -type "string" miDefaultOptions.stringOptions[28].value "on";
setAttr -type "string" miDefaultOptions.stringOptions[28].type "boolean"

Activate the script.

But my renders are all grainy now!

We're not done! Now, you add this:


setAttr -type “string” miDefaultOptions.stringOptions[34].name “progressive”;
setAttr -type “string” miDefaultOptions.stringOptions[34].type “boolean”;
setAttr -type “string” miDefaultOptions.stringOptions[34].value “on”;

setAttr -type “string” miDefaultOptions.stringOptions[35].name “progressive subsampling size”;
setAttr -type “string” miDefaultOptions.stringOptions[35].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[35].value “1″;

setAttr -type “string” miDefaultOptions.stringOptions[36].name “progressive subsampling mode”;
setAttr -type “string” miDefaultOptions.stringOptions[36].type “string”;
setAttr -type “string” miDefaultOptions.stringOptions[36].value “sparse”;

setAttr -type “string” miDefaultOptions.stringOptions[37].name “progressive subsampling pattern”;
setAttr -type “string” miDefaultOptions.stringOptions[37].type “string”;
setAttr -type “string” miDefaultOptions.stringOptions[37].value “linear”;

setAttr -type “string” miDefaultOptions.stringOptions[38].name “progressive min samples”;
setAttr -type “string” miDefaultOptions.stringOptions[38].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[38].value “4″;

setAttr -type “string” miDefaultOptions.stringOptions[39].name “progressive max samples”;
setAttr -type “string” miDefaultOptions.stringOptions[39].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[39].value “100″;

setAttr -type “string” miDefaultOptions.stringOptions[40].name “progressive max time”;
setAttr -type “string” miDefaultOptions.stringOptions[40].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[40].value “0″;

setAttr -type “string” miDefaultOptions.stringOptions[44].name “progressive error threshold”;
setAttr -type “string” miDefaultOptions.stringOptions[41].type “float”;
setAttr -type “string” miDefaultOptions.stringOptions[41].value “0.0130″;

setAttr -type “string” miDefaultOptions.stringOptions[42].name “progressive occlusion cache points”;
setAttr -type “string” miDefaultOptions.stringOptions[42].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[42].value “0″;

setAttr -type “string” miDefaultOptions.stringOptions[43].name “progressive occlusion cache rays”;
setAttr -type “string” miDefaultOptions.stringOptions[43].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[43].value “128″;

setAttr -type “string” miDefaultOptions.stringOptions[44].name “progressive occlusion cache max frame”;
setAttr -type “string” miDefaultOptions.stringOptions[44].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[44].value “32″;

setAttr -type “string” miDefaultOptions.stringOptions[45].name “progressive occlusion cache exclude”;
setAttr -type “string” miDefaultOptions.stringOptions[45].type “integer”;
setAttr -type “string” miDefaultOptions.stringOptions[45].value “0″;

Now, all you have to do to change the quality is increase the render time. 300 usually works. Voila. Welcome to iray.

Oh! Don't forget to check your output window to make sure that iray is indeed working! You can do it people. If I can, anyone can.

Updated 08-09-2011 at 02:01 AM by Caius

Tags: couda, maya Add / Edit Tags
Categories
Tutorials

Comments