The Pixel Crush

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

Showing posts with label workflow. Show all posts
Showing posts with label workflow. Show all posts

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, 30 April 2012

Kernel Condensed

Lets try something new:

I'mwaytoobusytowriteablogpostsoinsteadImgoingtouploadallmytestrendersforyoutoenjoywithminimalprose

I'd somehow forgotten about my awesome lambert lighting workflow, its so fast, I love it!
Plus it looks so gorgeous its almost a shame that all that colour gets absorbed by the textures in the final render.




The beauty of final gather, in this sequence the use is minimal and its almost more of a glorified and accurate ambient light. But much slower. Though I have started playing with the min and max radius settings which control the area and therefore speed of the final gather. Above is before, below is after.
These renders are from ages ago. I couldn't figure out how to make this exterior shot look better and you know what always makes things better?...
...rim lights, they emphasise outline and form. and help Leonard stand out from the background, these are special rim lights that only effect Leonard and nothing else in the scene.

Even from a distance they work well. (Enlarge to see them working well).

After referencing in all the props and sets this scene still look worringly bare, so we got our trusty 2nd year Sebastian to jump on it and conjure up some details for the top of Leonard's skyscraper, with limited time he managed to generate some models, and faithful Ryan completed the task admirably with textures, prop placement and cleanup.
 Just when I thought I was done with the greenhouse...

Another sneaky trick in lighting is to create a light that only emits specular (shiny) light rather than diffuse (soft) light, and then attach it to only the eyes of a character. This allows you to create lots of tight highlights that bring out that glistening, alive look, in a character's eyes. As seen below (enlarge to see below).
I was being useless with my feedback for a particularly tricky shot to comp so I made this as a template for the city composites, to communicate the visual style I had in mind. It still amazes me what you can do to a plain render with compositing. God rays, lens smut, and lens flare save the day.
That post was not as succinct as I originally planned, but I think thats a good thing.

Pixel Propaganda

Richard Lemarchand, a great game designer whose words made into into my dissertation, recently left Naughty Dog after working on the Uncharted games. He's gone to teach, travel, and make experimental games. I want to go with him.

The guys at Digital Domain made a making of for real steel and the use of Vray renderer in it. Its really cool, some great breakdowns, and a lot of talk about the est features of Vray, makes me wish mental ray had them.


Creative director at Irrational Games, Ken Levine always has interesting things to say about writing for games, mostly because they way he writes for them work so well with the medium, despite coming from a cinematic background.

I still can't quite believe several things about this trailer. Firstly its running on proprietary technology, secondly that its realtime, thirdly that it was made by 2 people, and lastly that the game its promoting actually sounds legitimately interesting. Very very exciting.


Also legitimately exciting: when people who write interesting things about games fling down their pen and exasperation and go and make them themselves. Nels Anderson wrote a great blog and now he's a gameplay designer at Klei working on Mark of the Ninja. Which looks like an awesome, intensional stealth game, where all the games systemic elements are visually represented to maximise player understanding and agency.



Tuesday, 10 April 2012

Painstaking Pixels

I don't know where to start.

When I'm writing these blogs I usually go through the images and renders I've saved over the week that I want to share and base the writing around them, I didn't used to do that, but they've become so long and sprawling and infrequent that its the only way I can remember.

So if you'll please turn to figure 1.0

Mosscott
Here we have an image of Moss Scott, the mascot for Kernel during studio time. He partly exists due to the number of times I asked Ryan to cover everything in moss, partly as a nest for the rivet we found in the studio (I think) that matches Leonard's rivet perfectly, and partly to keep spirits up with his jokes.

Figure 2.0
This is the look of the final knowledge cloud and its thanks to Kai's fluid fanciness that it looks this detailed, I borrowed a combination of his and the script's lights to light it like this. He's also placed a particle system in the center which orbits the central light like a nucleus. This was the first time I'd properly used lights with a negative intensity before. Its great because you can actually subtract light from the surroundings and its what gives the cloud that deep red underside.

Figure 3.0
This is the shot that the mask was made for, to properly reveal Leonard, but that strap has been a complete bastard to simulate. Not only did it take forever to fix as it intersected with his head and face over and over again, when it came to render time Maya just ignored the cache and re-simulated it, managing to get the strap right through his nose and mouth for the last 50 or so frames. Why?
I love the red and blue colour palette of this shot's lighting. What was useful about this shot was it forced me to make some final tweaks to the fur and eye shaders so they held up to close scrutiny a little better.
Figure 3.1
Not what he signed up for.

Figure 4.0
I've taken to lighting Leonard alone at first in some scenes now as they are so heavy with geometry and dynamics that it takes half the render time just 'translating the frame' which essentially is it copying everything to the RAM I think, so it can render. This way it copies relatively little and I can start seeing what changes I need to make without have to wait 5 minutes.

Figure 4.1
I got carried away and starting compositing this one. Delicious. You can just see the beginning of Liam's lights and the animated shader I worked on with him. It should look spectacular in motion.

Figure 5.0
As Len's darkest moment where he realises his oxygen is broken, I figured it was time to take that darkness quite literally. And also time to break out the lens flare, but not too much, keep it classy.
Whats weird is this was rendered with final gather, which seems to have covered up the sub surface effect I was getting through his ear. I believe this is because the diffuse light is stronger than the scattered light, but I don't understand why there are such dark bits in his ear. I may have to fake the final gather to get that back, I'd turned it right down anyway so its only go to speed up render time.

We have around 5 weeks left. Its going to be interesting. I am still optimisitic.

Pixel Propaganda

I'm proud to say I understand 90% of what they're talking about in the new release of mental ray's update notes.

An article I'd been meaning to read for weeks turned out to be pretty interesting. Its on one of Pixar's cinematographers. She talks about how her painting allowed her make some observations that helped improve the atmospherics lighting in one of their films.

A good interview with the father of the Metal Gear games. he talks about why and how he innovates and some of his feelings about his own creative successes and failures.