gShaders Tutorial

This document will guide you through the process of rendering with gShaders. For this tutorial you will need one HDR Image for the environment.
Create the Material
First, let's create a gMaterial. The gShaders Package is made of 3 shaders : gMaterial, gLens, gEnvironment. The gMaterial controls the shading of your objects. To create a gMaterial, click on the gMaterial icon in the mentalray material list of the hypershade.


Assign the Material
Next, create a polygon sphere and assign the newly created gMaterial.

Create the Environment
The gLens controls the quality and gEnvironment controls the environment of the scene. When using the gShaders, you have to create these two shaders and connect them to the camera. You can create them and connect normally using the hypershade, but there is another tool called "gShaders Globals" that will set everything for you. Let's use it to create the lens and environment and also to set all the rendering parameters. "gShaders Globals" is located in the gShaders menu in the menubar.

Select it and it will open the "gShaders Globals" window.

First create a gEnvironment, in the "gEnvironment & Lens Settings", click on "Create gEnvironment".

You should now see gEnvironment1 in the list, and also that a mentalrayIblShape has appeared in the viewport. This IBL is disabled during rendering but is used for previewing in Maya. Its imagename and rotation are connected to the gEnvironment, so changing the IBL will affect the gEnvironment automatically. Put your HDR Image in the imagename of the IBL. And then let's rescale the ibl node for better visibility. This environment will be used by gShader for the rendering.

Create the Lens
Next, create the gLens which will control all the ray parameters.
1) click on "Create gLens"
2) you should now see gLens1 in the list

Connect the gLens and gEnvironment to the camera
You have to connect these two shaders to the rendering camera in order for them to be effective. In the left column of the Environment & Lens Relation Editor, select both gLens1 and gEnvironment1 From the right column, select the camera you will be using (you can do a multiple selection pressing Ctrl) Let's choose the persp camera this time.

Set all the rendering parameters
Before rendering you have to set mentalray parameters in order for the gShaders to work. gShaders Globals can do this for you.
Just click on the top 3 buttons.

If you don't do this your rendering may be very slow or incorrect. If you are not sure or have changed rendering parameters, please rerun the optimization before each rendering.

Everything is set, now just render! Place your camera and sphere, and hit the render button.

Nice render! Now let's play with the material parameters.

Rendering Quality Settings
Before changing the sphere material, let's change the raytrace and antialiasing quality. In the gShaders Globals, "Render Settings for gShader" left click on the preset button.

In the menu, select "Medium quality"

Change the appearence of the sphere
By default the reflection is a little weak, let's boost it to 0.9

Next, to get a little white let's boost the diffuse to 0.5

It does not change very much. This is because the gMaterial tries to stay physically correct so that it won't reflect more light than it received. To see the diffuse contribution, you have to lower a little your reflection. this is the main difference compared to maya shaders.
Let's blur the reflelction a little more. The glossy is now set to 0.6

Now we have a very glossy sphere

Reduce the noise
The current result is not bad but you can still see a little grain on the sphere. To reduce this, use the gLens From the "gshader Globals" G-Environment & Lens Relation Editor, double click on gLens1, the attribute editor should open.

Set the sampling level to 4 The higher the sampling level, the lower the noise. This is basically the only quality settings in the gShaders (simple!) Let's render again.

No more noise!

Final Rendering
Let's change the render settings and do the final rendering From the gShaders Globals Render Settings for G-Shader right click on Presets.
This time choose Production Quality. The sample settings changed from 1 to 2 and the raytrace parameters doubled too. This will reduce noise like the sampling level in the lens Let's do the final render

That's it! You know now how to render with the gShaders For further information please check the manual, and if you need a sample of preset materials please download the sample scene on the main page.


Return to the Main Page