Friday, 25 March 2011

Maya Tasks Week 23 - Dynamics and Mental Ray

Here are the latest Maya tutorials. They will be the last for a little while. You will be seeing some Transcription project stuff soon.


This weeks dynamic tutorials further expanded upon particle instances.

The first example are instanced Gold Fish. The new thing we've learnt is how to apply animation to instances, that can be offset amongst the individual particles. This way, they don't move at exactly the same time. This technique involved duplicating a copy of the goldfish for every frame of the animation. All the geometry is played back in sequence in the particle instancer.

The second example shows robots all walking on the ground. The same technique was used to offset all the walk animations. The addition of a script was used to make the feet stick to the floor better.

The last example shows spider crawling along a surface. The fact that the surface is not flat was the challenge in this exercise.

Here is a video of the above effects.

Displacement Maps

You can use displacement maps as a way to add more sculpted detail to geometry. With bump and normal maps which can add surface detail, displacement maps actually deform the geometry.

The software renderer can use displacement maps but its functionality is limited.

(Click to enlarge) Figures 1-4

Here a flat plane is used, to demonstrate what can be done in the software renderer. Fig 1

After applying the displacement map image, this is what the default settings give. Fig 2

After upping the samples of displacement you can see what its supposed to look like, but there are a few little mistakes left to fix. Fig 3

After a bit of tweaking I got this result. Fig 4


Continuing from the last example, we then learnt about how displacement maps should always both extrude inwards and outwards, so that the object being displaced doesn't appear to explode only outwards. To do this, means telling Maya where mid grey is. This can be done by adjusting the Alpha Gain and Alpha Offset attributes in the image file node. The rule is that Alpha Offset is always minus a half of the Alpha gain.

Here are a selection of images demonstrating the effect the attributes have on the displacement.

Alpha gain 1
Alpha Offset -0.5

Alpha gain 2
Alpha Offset -1

Alpha gain 3
Alpha Offset -1.5

Alpha gain 4
Alpha Offset -2

If you open all the images and flick though them you can see exactly what's happening.

It is interesting to note that when comparing these images that the words and board punch out the most, while the the noisy area stays more less in the same place. This is because the words and boarder are white in the displacement image, and the middle bit is grey with noise, ie the mid point.

In the next example we look at refining the displacement results using the Mental Ray renderer, which has some extra options for creating good displacement.
The way to achieve those kind of results is with what's known as the Approximation editor.


Mental Ray Approximation editor

In this example the letter M is used. The white area is what's being displaced.

No Displacement map.

Default Settings. (as usual is a mess)

Changed to Alpha Gain 0.1
Alpha Offset -0.05

Tweaked with approximation editor.


Dice Example

(Click to enlarge)

Figure 1 shows a die with no displacement.

Fig 2 shows what default displacement gives us. Its exploded!

In Fig 3 the approximation editor is set to the polygons or Sub Divisions setting.
this is the result. But it seems we've lost most of the displacement now.

After adjusting a few settings we get the spots indenting. Fig 4

Upping the Max subdivisions fixes the stepping effect as shown in the image below.


Nurbs Tube example

The last example is with a nurbs tube.

The approximation editor has a specific section just for Nurbs objects.
This is what we get.

After some tweaking we get clean results.


Indirect Lighting

Now onto Final Gather

With final gather you can light a scene without using any actual lights. In the example we used the environment colour to light the scene.
What it does is it shoots final gather rays from the camera and bounces them around the scene, and where ever they bounce they add light. So naturally, places that would be in shadow will end up being darker than areas fully exposed.
Because the rays bounce around the scene, it is being lit indirectly.

Final Gather has render diagnostics.
The green areas represent the tighter areas of calculations, where the light bounces the most.

The dots can even be viewed in 3D.

After tweaking some settings a result like this was achieved.

Now on to Global Illumination in Mental Ray.

Where Final gather deals with bouncing light, Global Illumination will colour the scene based on the other colours around it. Photons are emitted and bounce around to colour the scene.

After a little bit of setup and switching on global Illumination a test render will result in something way over exposed! The white spots are photons.

Using Final Gather in conjunction with Global Illumination will help to smooth out the render as you can see.

After adjusting some other attributes in Global Illumination you can achieve a result like this.

You can view photon dots in the same way as Final Gather.

So this is the beginning of how to render scenes with realistic lighting effects.
I'm sure there's still plenty more to learn.

A Flock of Pixels

No comments:

Post a Comment