Friday, May 8, 2015

Substance Designer and Rendering in Mental Ray

In the last year I've jumped into Substance Designer. It's node based workflow just makes sense after all these years of Fusion and Nuke. Because of that, potential change requests in textures/shaders are SO easy to make! Add a decal to a wall, branch it to affect normals and make it a bit bumpy, branch it to metallic and roughness to make it not shiny where the decal sits. Client doesn't like it? Use a 2D transform to move it around and all the properties update! I love it. Can I say that about a piece of software?

Working with the roughness/metallic workflow does make for some tricky transitions into Maya and Mental Ray though. Mental Ray's MIA material doesn't have a roughness/metallic input in the same method that Designer does and works based on reflectivity/specularity/glossiness. Fortunately, Substance has included a tool that translates diffuse/roughness/metallic into diffuse/specular/glossiness. Still, what I've found is that those maps aren't quite enough to get a perfect replica of what I did in Substance over to Maya.

In this post I'm going to outline what my workflow is. It's a bit complicated, but it seems to work well, especially when using image based lighting in Mental Ray. My results match what Substance has in its viewport quite well.

Here's a sample material preset from Substance Designer:


As mentioned above, those 4 outputs don't translate directly to the MIA material, so I've come up with this graph:


I'm using the built-in translator to go from roughness/metallic to spec/gloss. I'm keeping the normals and roughness (I know I'm not using roughness in the way Substance uses it, but it still varies the surface a bit which helps with creating a good looking material). As for reflectivity, by using the blend feature in the middle of the above instructions, I'm getting something that work for limiting what is and isn't reflective.

Lastly, I'm using an older method based on some instruction from Master Zap on his mental ray blog on "creating better metal materials." The short of it is:
- turn on Fresnel
- set your IOR high (like 25 or 50!)

Here's the resulting render using the same HDRI and image based lighting in Maya using Mental Ray:



Side benefit? This method works with non-metallic materials too. Here's an example of a graph using the Concrete preset in Designer:


And the resulting turntable:


There IS some reflectivity in the concrete. Barely. You can also see from the image of the resulting graph that the Specular output is pure, dark grey.

Lastly, as one final proof, here's a mixed material of metallic, paint, wood and some burn effects all on one kettle. The handle had some UVs that were a bit small which accounts for the flicker.


So let's talk pros and cons.

Pros:
- results match Substance Designer
- material creation in Mental Ray is repeatable and settings are the same because it's dependent on these 6 outputs

Cons:
- it may be repeatable, but even after coming up with this, I'm constantly referring to my own docs because I forget the steps
- 6 maps? Isn't that too much? Well it depends on the material. You have to use your own judgement. Do you need a concrete with subtle reflections? Then use the 6 maps. If it can just be a simple concrete then use the "Matte Finish" preset in the MIA material and just add color and bump. Done.
- Sometimes, in some cases, maps are duplicated. Look closely at the concrete output. The Reflectivity and Glossiness maps are identical. Work smart, pay attention to what you're doing, and load ONE map into Maya and branch it.
- Render times. So often I see people loading 2k maps on everything regardless of distance to camera. If you're loading SIX 2k maps on every object in your scene, you're not optimizing. Work smart.

It's been a LONG time since my last post, but I'm working on changing that this year. Next post will be using Agisoft Photoscan to aide in the creation of cool materials in Substance Designer!

Monday, April 22, 2013

Earth Day


The first thing that got me hooked on doing 3D was a rendering of the Earth. I was in grade 10 and my art teacher had a setup of Apple Performa computers in the backroom of the art class. It was his secret lab. Mostly he'd go back there to do freelance design work while we sat in class, painting without any direction.

One day a classmate shows me what he's working on the back room with our art teacher's help. He loads up Strata Vision and makes a cylinder with a sphere in it. He quickly applies a glass material to the cylinder and a pre-made Earth texture to the sphere. Rotating the view, he puts it at a 3/4 angle so we're looking at the top and sides. After pressing a render button I watch the computer process this information and give a full color image after a few minutes. I was blown away. The glass material actually refracted the image and the Earth was bent out of shape and warped as you would expect if it was encased in a solid glass tube.

That was it. Up until then I had dreams of being a comic illustrator. Smash! Shattered. Having a similar computer at home, I installed Strata Studio Pro (which a classmate found for me) and I started plugging away at it. (As a side note, how did anyone even find software online in the early 90s?)

Fast forward to present day... While students here at the college have been finishing off their year and my lectures and marking have (nearly) finished, I took a couple days to put this Earth rendering together. I had been thinking of it for a while and what approach I wanted to take. I knew that  I didn't have to have an amazing render to start with because I had, in a way, already built my comp in my head. Here are the layers I used to come up with this final image:


Before I get too far, I should say that I didn't paint these texture maps from scratch. NASA has an amazing collection of image of Earth already unwrapped and ready to apply as textures to you 3D models. You can find them here. They come in various sizes, so I grabbed all the biggest ones.

You can see the "Earth Day Beauty" in the top left corner is a far way off from looking like the final composite at the top. Here's an image of my composite from Nuke:


My process was this:
  • Combine the day and night image using the sunlight mask. 
  • Use the land/water mask to color correct land and water separately. 
  • Throw the clouds on top balancing the shadows to try and give them an illuminated look. 
  • Add atmosphere using existing alpha channels combines with Nuke's built in tools. 
  • Build a lens flare for the sun. 

Voila! Instant Earth!

Monday, April 15, 2013

Modern Gaming

Based on reviews and my (now waning) love of all things Batman, I decided to buy Arkham City a few months ago when it was on sale for $7.50. With work and life in general being busy at the time, I had yet to download and install it, but now being relatively caught up on the two, I thought this would be the weekend to give it a go.

I'm going to say from the beginning that I have very little love for modern games. Most reviews I read and watch have games with amazing graphics that continue to blow my mind, however I get more and more turned off by the fact that so many of them rely on violence as a means to complete your objective. The latest re-imagining of Tomb Raider seems to be one of the worst of the bunch. Sad, because it looked so promising.

But violence and gameplay isn't what I want to talk about right now. Instead, let's talk about how one starts to play a game in this day and age. We'll start with early Saturday...

1) Login to Steam. I've already bought the game, I just haven't downloaded it. 16 gigs is going to take a while, so I start early.

2) By Saturday evening, Batman is downloaded, but now Steam needs updating. Download and install.

That was Saturday. Fast forward to Sunday night at 9pm when I'm ready to play the game.

3) Steam uses new .Net features, so now Windows needs to update. Download and install. Reboot.

4) .Net already has service packs. Download, install, reboot.

5) Nvidia Experience won't load. Go to Nvidia website, download the new Experience. Install, reboot.

6) Graphics drivers are slightly out of date. Download, install, reboot.

7) Log in to Nvidia Experience to see what settings I can run Arkham City at. Turns out with my new computer I can run Batman at very high quality. Click to run game from Nvidia Experience. Error. Can't load. Desktop game shortcut doesn't work either. What?!

8) Log in to Steam. Click to play. Before loading game I need to install Windows Live gaming. Game loads now.

9) Start screen. Finally ready to play! Nope. Please type the serial number for the game. What? Glad I saw a screen earlier with that info. Copy. Paste. Game continues to load.

10) Finally ready to play! Nope. Windows Live pops up. Enter your credentials. Thankfully I still have my old Hotmail address. Log in. Windows Live now needs to update its software. Install, quit game, continue installation, reboot.

11) Okay. Load up Steam again. Login. Start up game. Windows Live pops up. Enter credentials. ERROR CAN'T CONNECT. So if I keep playing I might not be able to save progress. What?! I was able to login 3 minutes ago! Fine. I just want to play the game. Close window.

Window opens again.

Close window.

Window opens again.

Close window.

Window stays closed. Finally.

12) Main menu. Click to play game. One more error telling me I might not be able to save progress. Fine! Whatever! Just let me play the game.

13) It's now 9:30. Game begins. Swearing, constant violence, sexism, sprinkle in some misogyny for good measure... but look at those graphics!

Tuesday, January 29, 2013

Last Post About The Car

So here's my final version for now. Some of the aliasing issues I feel are a limitation of the resolution. Some of these problems would be better at (true) 720p rather than the upres'd renders I've been producing. In the end I created another ambient occlusion pass for the ground only which helped match the background shadows under the cars. Additional masks were used to tint the windows so they weren't so blue. Blacks overall I feel match better and I reduced the amount of glow around the reflections/highlights.

A bigger issue has to do with the HDRI that I shot when this footage was filmed. I used the mirror ball method and unfortunately it's quite scratched. This gives me very elongated highlights. It would look much nicer if they were proper, circular highlights. Perhaps if/when I revisit this I'll block them out of the HDRI and put geometry in the scene to represent the ceiling lights.


I feel that doing this has helped better my knowledge of mental ray and Nuke. The thing I find mostly with projects like this is that the more you know, the more you know you don't know... or something like that. Every time I learn something new I can see where there's potential to push renders, textures, and lighting even further. As they become more accurate or real or advanced, the renders take longer. It doesn't matter how fast your computer is. As soon as you buy/build a faster one, the technology advances to undo your purchase. This wasn't so bad at about 12 minutes / frame at 960x540.

So what's next? I need to improve my render debugging skills. There's so much important information on the elementalray blog that I haven't had time to digest. Mostly I find these tweaks aren't going to cut times in half, but I always like to know why something works or doesn't and if I have a better understanding of optimizations, I feel I'll better understand why I have issues, artifacts, whatever. Along with that, there are mia material settings that need exploration and then a better understanding of new BSDF shaders... the list goes on an on.

Anyway, here's the final render (for now).

Saturday, January 26, 2013

Updated Car Rendering

I've been rendering this with better sample settings. I'm using Unified Sampling in Mental Ray. It's good, but my render isn't exactly fast. I can't say that I've really gone into the settings and optimized it for best possible render time... more like brute forcing it to render. Still it could be a bit better.

I had a problem with Vector motion blur. It turns out all my camera settings like f-stop had been reset to 0. That doesn't make sense.

So now this render has some basic color corrections and filters. Motion blur applied in Nuke. Some glowing edges (too strong). I'm noticing now that my reflection pass doesn't quite match the film plate and will need a bit of tweaking, but I'll save that for the final upload next week. It's still rendering at the college but will be ready by Monday.