|
|
m e n t a l r a y u t i l i t i e sThis page shows the development of a series of utilities designed to make implementing various Mental Ray Shaders into your scene more user-friendly |
|
||
|
||
|
o v e r v i e w =====================================================
References:
LA Mental Ray User's Group : Perhaps the most comprehensive Mental Ray site I've found MEL User-Interface Documentation : Some useful information on creating UIs.
The previous pages show my initial attempts to create a small suite of utilities designed to simplify the creation of sub-surface scattering shaders. Though I changed the methodology a bit, the basis from the previous pages acted as a spring-board to get me to a useful utility.
One of the problems that arose was out of my misunderstanding of the way the Physical shader works. After considerable research and trial-and-error, I changed the way the physical shader is created.
Another consideration was to make this more dynamic, so the procedures could be run over and over.
I have now created a full interface that is still not completely functional, but does quite a bit to aid the user in creating these shaders.
Below is the utility window as it appears now.
Copy the text and save as a .mel file in your default scripts directory. In the script editor, type "mrUtils;" without the quotes and it should run. You can then select the command and middle click + drag it to a shelf for easy access.
s u b s u r f a c e s c a t t e r i n g u t i l i t i e s =====================================================
The first tab only relates to SSS shaders. As I learn how to create the other options available, I will add more shaders to this window. For now, I only have the two most common shaders I have used; misss_physical and misss_fast_simple.
//////////////////////////////////////
m i s s s p h y s i c a l =====================================================
As I mentioned before, this is one of the most physically accurate shaders available today.
To function, you must use photons from at least one light and activate caustics.
The procedures that the shaders all activate Mental Ray before running, but I have included an option in the menu bar to turn it on and off. There is also a button to activate caustics.
It is still up to the user to set their own render settings beyond that, but this at least insures that the shaders will render.
It is recommended that you link a specific light to the shader, but it is not completely necessary, since Maya will automatically link any lights in your scene to the MR shaders if there are none specified.
My first version created two lights and linked them to the shader. I intend to re-implement that, but once I decided to make the utility repeatable, I decided it would not be good to create a new set of lights over and over again. To re-implement this feature, the procedure will need to query the scene for a specific light and only create a new one if it does not exist. There is also the question of whether the user will want to link the same light to every shader. I haven't decided what the best path is for this, so for now, that step is left to the user. Perhaps I'll create a message bar that tells the user to set a light to emit photons and have caustics turned on.
/////////////////////////////////
For all the shaders, when you click the "Make Shader" button, a name requestor pops up asking for the name of the shader.
Type a name and hit OK.
At this point, it will create the shader with the name you gave it and plug in the basic values for Jade.
Mental Ray has provided a number of sample settings to simulate various materials. I have included the ability to set your Physical shader to these various presets. For this portion to work, the user must have the Physical Shader selected, then click the corresponding radio box for the desired material.
These options will set the scattering and absorption coefficients as well as the transmission color to something that will closely approximate the material. Again, this is all just .
Here are a few examples of some test renders with the various settings:
Most of these required some tweaking of the photons in the light and the shader. This utility is not intended to do all the work for the artist, but it does speed the process up.
This next link is a tutorial that I used to tweak the shaders above and get some decent results:
/////////////////////////////////////
f a s t s i m p l e =====================================================
Though the Fast Simple shader is easier to render and does not require caustics or photons. It is not physically accurate at all, but it can often be used quite effectively.
This shader creates a lightmap similar to the dMap feature to approximate the thickness of the object.
To make the shader, just click the "Make Shader" button and it will be all set up.
One note about the lightmap is that I started getting issues with placing it in the sourceimages folder. Maya is pretty unreliable about this particular issue, but if you put an absolute path for the lightmap it has no problems. The new utility places the lightmap on the root of C:. Not what I would prefer, but it does work.
This is what you get "out of the box" with this shader:
Not very interesting, but from here it is all tweaking colors, etc. Again, there are a number of useful tutorials to get you going pretty quickly.
/////////////////////////////////////
d g s b u m p m a p p i n g =====================================================
Creating a bump map for a Mental Ray shader is perhaps one of the most unintuitive processes I have ever undergone. This is something that seriously needs improvement in the core implementation.
Until then, I have created a utility to do all of the initial work for you.
Click over to the second tab and you have the bump map utility.
It creates a Mental Ray DGS shader and plugs the bump map network into it. The user can replace the DGS shader with any other Mental Ray Shader, including the SSS shaders created above. I may create more templates, but DGS is the most physically accurate of al the Mental Ray basic shaders, so I felt that would be the best option to work with. Besides, the real work is making the bump map portion.
After creating the shader, this is what you will get:
The user needs to input a file in the "bmpTxtrFile" node, but otherwise it should work right off the bat.
///////////////////////////////////// f i n a l t h o u g h t s =====================================================
These all need to be tested with multiple users so I can get responses as to usability, but I think they are well on their way to being very useful tools.
There are a number of minor issues that are gradually being addressed, but at least the primary functionality is relatively reliable .
One issue that keeps popping up is that it has a problem activating caustics without having first opened the render settings window. I found a solution for now that calls the render editor then closes it, thus forcing an update within the application that allows caustics to be activated. It works, but I feel this is an inelegant solution. I hope to some day find the root of this issue so I can correct it in a way that doesn't feel like a hack.
|
|
|
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||