Linear workflow and How I Stumbled Ass Backwards Into It

It all started with hitting the "create physical sun and sky" button and the disappointment that followed.  You see, my colors were all washed out in the render and I did not understand why.

dramatization :)

Then I found a tutorial that said I first needed to run my textures through a gamma correct node with a gamma value of .454, it worked but I was still confused.  The number just seemed so arbitrary and I couldn't let it go.

Its a Material World

Okay, so now that we're passed the cheesy title, the point of this post is the Sampler Info Node and how I've been using it to make various materials like satin, velvet, etc. And to not give myself a headache, I'm going to approach this in a step by step manner, flapping my lips all the way, yay.

First up on the chopping block is satin.

Googled examples

Do Your Poly Models have CG-itis?

Well what is CG-itis? It is a condition where 3D models have a somewhat blocky unnatural look due to razor sharp edges at every turn. Those most at risk are hard surface models such as chairs, desks and John Deere tractors. Is there a cure or a vaccine? Why yes there are, several in fact.

*look to camera 2 and smile*

- Build the model for smoothing: inserting edge loops or splitting where you want to keep definition, the closer the edges, the harder the definition.

- Use the "Bevel" Poly operation, it comes in handy if you're not planning on smoothing the entire model but just want rid yourself of some sharp corners.

- Use the "mia_roundcorners". Its a Mental Ray texture that's plugged into the bump slot of an mia_material. It's "radius" attribute acts like the "offset" attribute of a polygonal bevel operation. Test render away.

And something a tad more complex than a cube on a plane -_-. I used the "insert edge loop" cure in this one.

Fell off the wagon :(

Note to self: I need to get back into 2D, my poor little Intuos is catching dust lol.

Layered Shader [Update]

This post is in addition to my Layering Shaders with Mental Ray post and the focus of that was the mib_color_mix node. A thread on SimplyMaya reminded me that I needed to update this thing.

I found that plugging bare textures into mib_color_mix slots results in weirdo alpha channels in the rendered image, like a strange masking effect on the shader.

This confused me for a while, it seems that Mental Ray uses the top most layer on the mib_color_mix to generate the alpha channel, which in this case is a simple fractal texture. It ignored the fact that there are solid SSS and mia_material shaders beneath it.

I needed to have my fractal spit out a solid alpha, and this is where the "alpha offset" attribute comes into play.

Alpha offset allows me to add black or white value to my texture's alpha in a uniform manner. I set the value to 1. The rendered image will look the same but my little torus will be solid in my alpha mask now because my fractal's alpha is all white.

And of course a value of -1 will have my fractal not even show up in the alpha channel of my render, since since its now black.

Commentor JJJenkins was having problems with alpha offset affecting his color channel and these are the results of my tests.  Forgive my texture, it's the result of 10 seconds in Photoshop lol.

IES Profiles

IES profiles are files that store information on light shape and intensity so you can mimic these lights accurately in a digital design package plus you get 10 cool points every time you use one.

Random googled images to demonstrate.

You can grab photometric data easily from any lighting manufacturer like General Electric Lighting or Lithonia Lighting just to name a couple. And there is even a free IES viewer, called well....IES Viewer. It was created by Andrey Legotin and it allows you to view all the information associated with the light profiles and there's even a really handy render feature so you can see exactly how the light looks without having to setup a scene in your 3D package just for that yay.


Scene setup in Maya: Really simple geometry, walls, ceiling, floor and a few light fixtures. And a camera with a photographic exposure lens shader with a Cm 2 factor of 10000 (have to crank up the value or it'll be too dark) Without the exposure lens shader, you'll get horrifically blown out highlights and hotspots so fast it'll make your head spin. Now on to the lights, I created some point lights and positioned them near my fixtures. Why point lights? They have a special little slot for light profiles in the Mental Ray tab, and clicking that all too familiar checker box will automatically create a light profile node, from there you can browse for the IES file of your choice.


Hit render....nothing.... Apparently you have to set a decay rate on the light, I chose quadratic and to keep pace with the light now dying off with distance, the intensity must be increased (don't be shy with the numbers :) and BAM! juicy photometric lights in all their glory hell yeah! 


The Mia_Material_X

    Well, I made my own little shader swatch scene thingy, I had to (I was using spheres prior to this, don't ask, just chalk it up to laziness and back away slowly). Since I'm rendering out swatches, thought I'd write about it, might help a new user, who knows :o).

    The mia_mat_x is one of my favorites, if not my favorite shader, yeah that's right I said it, it's out there now so deal with it. It's a very versatile shader, from glass, to plastic, rock, wood, metal , even the crud stuck in that creepy guy's teeth, it can pretty much do it all. Migrating over from shaders like the Maya Blinn where there are independent channels for qualities like reflectivity and specularity, the mia_mat took a little getting used to since it's a physical shader, good thing the attributes are self explanatory . I tried the whole "use a preset and reverse engineer 'em" method to know what makes that particular "look" tick. Well, that didn't work out too well as I wasn't familiar enough with the shader's default attributes to even know most of what was changed so I decided to poke around 'til I knew what attributes did what.

Mia_mat Caustics

As far as generating caustic patterns, there are a few things that I need to setup, two of the most obvious ones are, telling the mia_mat to use caustics instead of transparent shadows and turn on caustics in the MR render settings. On the caustic settings, I usually take the ol' cheapo route of lowering caustic accuracy to say about 20 or 30 and use the cone filter, this enables me to get sharper patterns without having to juice up the photon count emitted from the light too much.


Was bored as hell, didn't know where I was going with this. Favorite parts are the hair and glitter.

Changes Changes.

I'm making a sketches section instead of having the 2D and 3D stuff all lumped together-------------->>Sketches



This one doesn't have a name, was just having fun while I was setting up my Photoshop prefs...again.

Layering Shaders for Mental Ray

The Maya layered shader always drove me nuts, I always found it so unfriendly. And since Mental Ray is my renderer of choice, I needed something that wouldn't strangle it, and I figured it must have a layered shader equivalent tucked away somewhere. Scouring the help files for anything color blending related I found this puppy that I suspected could do the trick. The mib_color_mix node.

I'm in the process of experimenting with this node. Initially, I tried just dragging and dropping it onto the geometry, the connection editor popped up, its not a material duh! So after that brain malfunction, I tried figuring out a way to work it into a shading network. I needed a mule! And so I decided to use a Blinn shader, I normally use a Maya shader with a MR shader plugged into it's shading group, because some MR shaders don't display well in the viewport.  I figured that could apply here as well. I also made three more shaders, these are the ones I wanted to blend (you can input 8 but I thought 3 was more than enough to see whats going on here). I had an SSS shader, a blinn with a checkered bump and specular and a blue ramp shader, I plugged these into the Color 0, Color 1 and Color 2 slots of the mib_color_mix node respectively. Now, where does the mib_color_mix go?

A couple crashes later, I plugged the mib_color_mix into the material shader and shadow shader slots of the blinn's shading group. It worked! But and this is a big but, my SSS shader didn't look translucent at all and that was only because my lightmap from my SSS shader was not plugged into the light map shader slot of my blinn's shading group(try killing the connection between an SSS shader and its light map and see how un-sexy that shader becomes).

In the mib_color_mix, the SSS shader is heaviest, then the checkered blinn and at a light weight is the blue ramp shader. All modes are set to 'add'. And this is what I got.

So I messed around with that but one of my favorite shaders, the mia_material_x wasn't able to be dragged and dropped into any of the mib_color_mix color slots. Instead I had to use the connection editor to plug the RGB of the mia_material_x's "result" attribute into the RGB places of the mib_color_mix's desired color slot.

Did some more fiddling around with it. Plugged a fractal into the mib_color_mix node on multiply and added a bumpy shader and got this.

Its a pretty neat node but I wish the channels were grouped in a sensible order like the different inputs having their weight attributes beneath them instead of having all the inputs lumped together and all the weights lumped together, it makes tweaking kinda tricky.

In the previous paragraph I was moanin' and groanin' about the color mix node attributes' layout and so David shared his solution(yay!) ---->>

Dealing with mib_color_mix and caustics

Plugging the color mix into the "photon shader" slot of your shading group will result in two things:
1) Increased render times
2) No caustics anyway :(

You could drop a photon friendly shader in there like an mia material or whatever that mimics the refractive/reflective coloring of your color mix result to give you the appropriately colored caustics....but....and this is a big BUT...

What if there are textured transparencies involved and you want caustic patterns and colors from the different shaders in your color mix? Is there a way to layer photon shaders!? Commenter David asked about this and I'm sharing my own method.  It's a little hacky and a lot convoluted lol.

I never did find a way to mix photon shaders but I did find a work around...kinda >.> And that adds another shader (mia_mat <3), a color mix, along with a some ramp textures.

Be warned, color mixes add to render times in a pretty notable way yay.

My thought process behind this is to trick Mental Ray by having each shader pipe its refraction color into a ramp, which pipes that same color into a slot in the color mix which is plugged into a transparent shader's refraction color slot, creating a layered refraction color, and this transparent dummy shader will be inserted into the photon slot to generate caustic patterns that match our layered shaders.
Lets say I have a pink glass shader and a blue semi transparent plastic shader layered using the color mix and there is a checkered texture plugged into blue shader's color mix weight slot, masking it off on top of the pink glass.  Well in the caustic pattern of such a shader you'd expect to see pink and a dim blue (since the blue plastic is only semi transparent unlike the pink glass).  Kind of like what you see going on here in the shadow.

Ehem, excuse the noisy render >.>

My solution was to create that extra shader I mentioned earlier (let's call that "causticDummy"), set a transparency of 1.  Create another color mix (let's call that dummyMix) and slipped that into causticDummy's refraction color.  CausticDummy is whats going into the photon slot.

Now I plop down those ramp textures I mentioned earlier, deleted all but one of the ramp colors (this ties in with causticDummy's transparency value, more on that in the following paragraph) and using the connection editor, connect the refraction color of the shaders  to a ramp of its own.  These ramps are plugged into dummyMix's color slots in the order that you layered your shaders in the first place, weight maps too!

O.K so why the ramps?  Because they allow me to control how opaque the texture appears in the caustic patterns using the color balance attributes so the weight in the color mix can be used for masking and whatnot.   If having that control doesn't matter then you can use one ramp with however many color entries then pipe those into the color mix, cuts down on nodes. That was also the reason why I set the transparency to 1 as the power to control how transparent the texture appears in the caustics is all in the ramps.  Same can be done for reflections ^^.  Right now I'm tired so hopefully if I read this tomorrow it makes sense.

Yeah, yeah I know it's noisy but you get the point.

Wow I read this again today and had to make a few grammar/spelling corrections.  Note to self: Do not blog while tired.

See also Layered Shader [Update]