Showing posts with label shader. Show all posts
Showing posts with label shader. Show all posts

Sunday, December 29, 2013

Creating a 'Gummi' type Thickness Shader (Part 1)

POST UPDATED 31/12/2013 - INCLUDES SETTINGS FOR MENTAL RAY MIA_MATERIAL
Thickness pass (values inverted from render) - Mental Ray


Some time ago I figured out it's possible to make a serviceable 'thickness' or 'gummi' type compositing/utility shader in Vray using the Vray Mtl and it's 'Fog' parameter. At my current workplace we've used in the past a 3rd party shader from Binary Alchemy (the RayLength shader I believe), in order to compliment subsurface scattering at the compositing stage via a thickness pass. This was explained to me by my boss at the time as a dirty trick, which nevertheless had the desired effect of making our CG food look more 'foodlike' and appetising. It's a strange but potentially useful technique, which I'll cover in a later post. For now let's just focus on making the shader. The basic idea is also translatable to a MR mia_material version, using the 'Max Distance' instead of the Vray 'Fog' parameters.

Basically, a thickness shader is one which is able to approximate the interior thickness of an object. A thickness pass would describe in greyscale values the relative thickness of something, ie- whiter pixels representing thicker areas and darker pixels thinner areas. As you can see in the video above, the dragon's tail, tip of the tongue, horns etc, are all darker in colour while the belly, legs and head are the thickest, lightest areas. When setting up the shader, we will need to invert these values however, and then re-invert back in our compositing package later on.

Setting up the shader/pass...


Thursday, May 31, 2012

Procedural Dents 'n' Dirt / Downward Drips (Part 3)

AO based weathering featuring DDD (Dents, Dirt, Drips)


Lately I've been working on trying to get some directionality into an AO weathering type shader. A problem with my previous shader was that the streaks weren't just dripping down from surfaces, but also dripping up. The current solution is to pipe the Out Colour of a Maya snow texture into both the bright and dark inputs of an AO node. Adjusting the 'depth decay' of the snow as well as the 'threshold' seem to be the main tweakable parameters here, along with AO spread.


I'm attaching an .ma scene file + shader if anyone would like to experiment (12 mb)
http://www.filedropper.com/ddddshader


Just the DDD shader
http://www.creativecrash.com/maya/downloads/shaders/c/ddd-shader-dents-dirt-drips

Wednesday, March 7, 2012

Light Based Ambient Occlusion

Ambient occlusion based on luminance 


Here's a quick shader which will improve the look of your ambient occlusion pass by integrating it more closely with the directional lighting in your scene.

Sunday, February 26, 2012

Fake Parallax

Offsetting texture UVs via the camera normal


A good example of this shader is to imagine a building with a window cut into it, allowing the viewer to see through into the room beyond. Instead of modeling out the interior (which can be prohibitive in computer game environments where this trick is often applied) we can use a texture of the room instead, aligned roughly to the outside wall, with an offset to give the viewer a parallax cue in order to make it appear as though the room has some sort of three dimensional depth.

This is easier to understand when we can see things in motion - here's a quick setup scene to help illustrate.




Obviously this technique has some limitations, but when used in mid to background elements in shots where the camera motion isn't too extreme, it may be just the thing needed to help add some quick depth to a 3D scene, cutting down on the time spent modeling, texturing and lighting an interior.

So let's look at how we can go about setting up a shader which can recreate this parallax effect in Maya...

Monday, August 8, 2011

Procedural Dents 'n' Dirt (Part 2)

The terms 'Ambient Occlusion map' (or 'AO map') and 'Dirt map' are often used interchangeably. Vray has a node called 'Vray Dirt', which is actually just an ambient occlusion node. Recently I saw an advert for a 3ds Max plugin that allows users to weather and dirty up their models with a fairly realistic looking procedural grime, complete with nice looking streaks. Ambient occlusion does a pretty good job of simulating the areas where dirt buildup is likely to occur on an object.


A very dirty keyboard

Today we'll go a little bit further in Maya than simply baking out an AO map; we'll use ambient occlusion as the beginnings of a mask for a procedural dirt texture. Then, as an enhancement we'll add some streaks in order to break things up a bit for a more natural look. Once finished, we will have created something that does a similar job to the commercial 3ds Max plugin described above, and we'll have saved $30! In Part 3 we will conclude this tutorial by connecting the 'dirt' shader network to our 'dents' shader network (see Part 1), for a very flexible overall shader that we can use in a variety of projects.

Friday, August 5, 2011

Procedural Dents 'n' Dirt (Part 1)

edit: This post has been updated as of 6/13/2012, to account for a previous missed step in the shading network (insert clamp node).  
Example shader

This is a really great technique for quickly generating some chips and dents along the outside edges of your model, as well as adding a layer of dirt (in part 2) to the more recessed areas. Once you have a handle on this technique you can then customise and apply it to all manner of materials. For this shader we will be utilising two of the Mental Ray nodes- a 'mib_amb_occlusion' node as well as a 'mia_roundcorners' node.

Firstly, let's work on generating some chips and dents for our model...


To get a better sense of what we're aiming for, here are some images which show the effect of edge chipping...

Examples of images of edge chipping on a variety of materials


Alright. Some nice subtle and not so subtle edge chipping. By looking at these shots we can appreciate that many objects in the real world show signs of this kind of wear and tear. What this means when it comes to our models and textures is that often times it is not enough to just simply apply a bevel to our object- but we should also think about introducing some variation into the bevel itself for added realism. We want to break up the bevel. How much will depend on our object, it's age and the material we are trying to represent.


So let's start... In the hypershade, bring two new 'mia_roundcorners' nodes into the work area. We also need to bring in an additional node- one of the Maya utility nodes- called 'Vector Product'.

Double click on the Vector Product node to bring up it's attributes window. Then, with mouse pointer over one of the roundcorners nodes in the hypershade, middle click and drag over to the 'input 1' slot in the Vector Product attributes. Release the middle button and the two nodes should now be connected. Do the same for the other roundcorners node but this time connect it to the 'input 2' of the vector product.

Two roundcorners_bump nodes connected to input 1 and input 2 of a Vector Product node

So far, so good.