The Pixel Crush

-------------------------------------------|Digital Animation & Game Criticism|-------------------------------------------

Wednesday, 30 May 2012

A Linear Lighting Workflow Based Around Mental Ray's Final Gather

A Linear Lighting Workflow Based Around Mental Ray's Final Gather

I'm hoping this will become part of a collective of innovations projects if people decide to upload or post theirs too, so I'll link to them at the bottom of the post and update the it as they become available. I was specifically interested in expanding my understanding of bounce cards and indirect lighting techniques inside of Mental Ray so I created a step by step as I lit a scene using this method almost exclusively. Here it is for your perusal:

First I set up a simple scene with some props inside it and created a camera. In order for 32bit rendering to be enabled in Maya you first must go to the display tab of an open render window, and set Maya to 32bit, restarting the program if necessary. Now you need to go to the mental ray tab on the camera's attributes and create an exposure node to give you control over the exposure of the scene. Create this node by clicking the checkerboard next to the lens shader box.
The lens shader you want to use is the mia_exposure_simple. For what we're doing it has plenty of control and nothing that you can't add in post later if you need it.

The important part here is to setup the way your scene is being displayed, so that it is correct within the linear workflow we are using, some people like to gamma correct each shader individually but this a much quicker and more efficient way if perhaps less physically correct.
Go to the gamma attribute of the lens shader and set it to 0.455. This will ensure that your scene is being displayed in a way that matches the sRGB output of a computer monitor.
You can leave the rest as default for now though we may (will) need to tweak them later.
Now to ensure that Maya is not applying the gamma correction twice when displaying the image you need to go to the render view and under the display tab at the top choose colour management. 
This will bring up the the colour management settings in the attribute editor. You need to set the top on to “Linear sRGB”.
Final gather has a sneaky and powerful feature where you can use the colour of a camera's environment to effect the final gather, to simulate say the colour of the sky, casting light where the sun doesn't shine. Here I've set it to grey just to give the final gather a bit of a boost in the areas the light isn't going to reach.
A little about render settings before anything else is done. In order for the 32bit renders to display without noise you need to set the framebuffer to RGBA 32bit at the bottom of the quality tab in the render settings, a format like OpenEXR can handle this fine but tiffs also work. Make sure Mental Ray is the selected renderer and that final gather is turned on, either in the features tab or the indirect lighting tab, the result is the same.

Before Final Gather

After Final Gather
So the plan is to try and light this scene using everything I know about final gather and as few real lights as possible, the whole scene could be lit by final gather alone but as I want a quite direct light source coming from about it wouldn't like right without the correct shadowing if we didn't throw in some raytracing, and what better way to do that than an area light?
Area lights are slightly tricky and there are some sampling things you need to straighten out that for the shadows to look smooth, its also easy with an area light to increase render time radically without actually increasing image quality. Before any of that is approached set the falloff to quadratic and assign a portal light shader in the light shader box under the mental ray tab of the light's attributes.
For the portal light shader to work the light needs set to use the light shape in the mental ray section and have the “visible” box checked on. The great thing about the portal light shader, and its relevance to a final gather pipeline, is that it draws in light from the exterior environment colour and pumps it through the hole you put it in, meaning that final gather quality is greatly increased on interior lighting without having to massively turn up any settings. Its intensity acts independently of the light's intensity so you can tweak the multiplier attribute and ignore the original light intensity.
The Portal Light
I then experimented with turning the final gather falloff right down to only between 50 and 75 world units of distance. This meant that anything further than that was illuminated by the environment colour so the entirety of the room was now lit as it exceeded these measurements, therefore drawing on the environment colour rather than remaining in darkness. It looks nice but was not the effect I was going for.

Tighter Final Gather Falloff
Hole In The Roof
I made a box in order for the light to function properly as a portal and create darkness around the the rest of the scene, here is the hole itself.
That's the one light setup (subject to further tweaking), next Ill explain how virtual lights work and how to set them up. In lighting for cinema or photography bounce cards are often used to spread light around in a soft way that requires no extra lights, just large white surfaces. In mental ray you can achieve the same effect without even needing the light to bounce in the first place, just the card. First a polygon plane is created (or any shape, depending on how you want the light to be emitted), then a surface shader is assigned to it. But changing the out colour of the surface shader to a white it will emit light when final gather is turned on. The softness of that light is controlled by the size of the plane, the direction by the angle, and the intensity by the value of the out colour. If you open the colour watch for the out colour you can type values higher than one into the value box to create brighter virtual lights of any colour.
Virtual Lights
This is what it should look like in scene when you've set a few up in strategic positions. This was my initial set up but I ended up placing one under Leonard's chin to bounce light up into his face, and one to the left of the books to brighten their profile from the side. One important thing to remember is to go into the render stats in the attribute editor of each plane and turn everything off, unless you want reflections for the virtual light. Then in the mental ray section below render stats turn of everything else except cast final gather: that's the bit that will be doing the actual illuminating.
If you don't turn them off you get a render that looks like this:
Oops, forgot to hide them in the render stats...
Something to make the scene a little easier to navigate now that there are giant cards hovering in the air blocking the view is to group them and under the display tab of the attributes for the group are the drawing overrides. After enabling them, you can set the “level of detail” dropdown to “bounding box”. This means that only outer edges are represented by a wireframe cuboid. They render exactly the same and are still selectable, its merely a visual tool to allow the scene to run smoother and be easier to see what's going on.
Drawing Overrides
I planned to fill the suitcase with Kernels so I created a hemispherical virtual light to place over the
them and give them a knowledgous glow. Playing with sizes, angles, and intensities was important to get the tops of them glowing but also have them receive enough light from the environment to make them sit properly amongst the other props.
After a quick render it looking like this:
The Glow of Knowledge
I really liked this look but the overall look was too dark and contrasting. Perhaps more realistic, but I want more of the environment detail to be visible, as well as Leonard's facial features. Without touching the portal light itself, which I had increased the intensity on in the previous render, I turned the environment colour on the camera from a dark grey to white. It changed the overall luminosity dramatically. From here it was just a question of evening it out a bit which can be done easily using the lens shader.
Over Exposed
When there's this much contrast the bounce light is literally the only thing lighting up areas untouched by direct light, this gives it a really organic colourful look which I love and is particularly noticeable on some of the books and the undersides of Leonard's limbs. The light I mentioned earlier to brighten Leonard's features was placed like this:
After some minor tweaks to various brightnesses and things I adjusted the lens shader, using its compression attribute to narrow the high dynamic range of the exposure, bringing the blackest blacks and the whitest whites closer to the visible spectrum, and equalise the mid tones for an image that probably closer resembles what I eyeball sees rather than what a camera would see.
I set the compression attribute to 5, the gain up to 2 (brightening the whole image), and kept the knee at 0.500 in order to stop the highlights from blowing out too much.
And here is the final render:
King Kernel
Any questions?

Innovations Collective:

Charlie Minnion: How to composite a polluted city.

[watch this space]

Monday, 28 May 2012


Lots to tell, lots to share.

New Life
Kernel. That film we were making. We finished it! We finished it in time, in style, and in a way that makes me very proud. It is an enormous achievement and I hope the final film reflects that, though I fear anyone outside of animation may not quite grasp the scale of the undertaking.

Unfortunately it won't be available online in the near future as we want to enter it to festivals, and festivals like exclusivity sometimes, so if its publicly available they get upset.
I can however send anyone who wants to see it a private link, so just send me an email or something.
Death Beckons
It wouldn't have felt right if it wasn't all right up to the wire, and so I was still compositing all through the night til 7am, and then again at 2pm, and then it was just a question of staying awake while the 8 DVDs worth of frames burnt. We even had an emergency render of a missing 8 frame stretch which Nigel had to plug. This wouldn't have been possible had we not discovered what was slowing down everyone's computers except mine, turns out, it was the hotfix. You can update Maya (and assume Mental Ray too) but downloading and installing hotfixes from the autodesk website, for both Nigel and Ryan this shortened their renders by 26 minutes per frame. Extraordinary. So, everyone go install the hotfixes right now, just in case.
Title Shot
A special thanks to Gabriel Nathan who recorded and mixed all the foley and sound effects for us, he not only did a great job at helping us tell the story and bring the world to a new level of believability, but also was in the studio with us right up til the last, syncing up the final bits and pieces.
The best a beards ever looked
More renders...
Rallying the plants.
We had a single celebratory drink in the stannery and then crashed. Thanks to everyone involved, really, you were amazing. Leonard is just relaxing now until the sequel, maybe it'll have backstory this time?
King Kernel
Also, for the press pack we recorded some bios and interview materials with the team, here it is edited down. Funny and informative ;)

Since then its been a little less full on but not a lot, if you are reading this via email or a feed reader you should go to The Pixel Crush proper and check out the fancy redesign, there's even a faux home page. Also I made business cards, and a showreel for the professional practice module:

The other part of the professional practice module was to research and write a presentation about a potential role in industry. I of course tried to find out more about the job of the lighting artist and started this thread in the hope that it'd get some answers. Amazingly it seems there are just professionals hovering around this site waiting to help out and converse with anyone, so I got some great answers from some fairly prestigious people.

The other project that needed doing was "innovations", which I'm going to save for another post, and maybe do something special involving some other people's innovations project.

Pixel Propaganda

Doublefine pulled off some amazing crowd funding showing that people will support games that they would love to see even before they've been made.

Some cool and hilariously detailed technology for creating the weave of a jersey out of geometry.

This was a film I saw at two separate animation events and it continues to be one of my favourite films of all time, I want everyone to see it its very beautiful and has a fascinating way of presenting life and its perception.

Some great lighting stuff on the HDR bubbles in speed racer, hard to summarise but from a shading and rendering stand point very worthwhile.

Far Cry 3 is a game that has looked progressively less interesting until now! An interview with one of the writers has some genuinely interesting things to say about the game which may just save some of the more questionable elements shown, though if they're just narrative justification for stupid gameplay I will not be happy.

Neil Gaimen had a great deal of quality advice to give to some new graduates, I wonder if we'll have someone fancy at ours? hahahahaha...

Monday, 7 May 2012

The Closest You're Getting To A Teaser Trailer


Pixel Propaganda

Some videogames saved some kids.

But videogames are stupid, why don't we expect more from them?

Especially when they can communicate amazing things.

Perhaps the way the are currently made is central to their perceived stupidity.

Yet people seem to care about even the stupidestest of them so damn much, which is stupid.


A precursor to Leonard?