Shading For Texture Artists

shading Shading For Texture Artists

Scalar and Diffuse

In Mari we have scalar and diffuse channels and we now have a more advanced colour management using Open Colour IO. In some respects it’s similar to how Nuke handle colour. In Mari when you as an artist are exposed to all colour options it can feel overwhelming and you want to run to Crosstown Doughnuts and have that nice cup of java instead.

Let’s overcome the colour fear and try to simplify the concepts.

Before diving into  Mari let’s examine where your textures are going to end up. Ninety nine times out of a hundred it’s going to end up in a Renderer of some sort. In our case I’m going to demonstrate using Renderman and the new PXR shader.

Let’s simplify shading into two major categories; scalar and diffuse.

Scalar in a shader overrides the effect of something. Maybe you want less specular in a area so you paint a texture map in black and white, where black would result in no effect and white in full effect.
Usually Diffuse values is something you get from texture maps or sampling colours from source images. These are the actual surface properties that we would regard as a colour.

 

Our friend Gamma

In an ideal world, our eyes, your monitor and all display devices would display linear values correctly.

Now we don’t live in an ideal world, do we?

Our eyes don’t have a linear response and nor do our monitors. Really simplified when it comes to the monitors, it’s basically electricity driving pixels on your screen. If we say zero current is black and one would be white and you mix RGB values that represent the picture on your screen, the monitor has a resistance in the components. Most of the resistance in in the middle values. If you would take a linear image captured with a DSLR camera and display it directly it would appear dark and saturated. This is why almost all images we display on monitors have a gamma curve added to it. We add a curve to counter the resistance in the monitor, the most common gamma curve is probably SRGB gamma.

sRGB-65743_x Shading For Texture Artists
reversedSRGB-49086_x Shading For Texture Artists

As you can see in the images above of the hobo gym I captured outside a small town called Laxå in Sweden it looks plausible with the sRGB gamma curve applied. The reversed sRGB curve making the image linear also makes it look dark and saturated and not as I remembered the scene when I pressed the trigger on my Canon 5dmkIII.

Why is that you may ask?

The censor in the camera captures light linear. When shooting to a raw image you will develop the image using a raw converter and you will apply a gamma curve in order for it to look pleasing on the eye. If you shoot as a JPG format direct you have no choice then to brute force apply a Gamma curve directly in the camera. This is not advisable as you are unable to choose how to expose it as you can with the raw variant.

It’s an important concept to understand a little about gamma when we later import images into Mari that is a colour managed software.

Looking at the concepts in compositing and and 3D shading they all have one thing in common…they need to be added in linear to behave correctly. For example if you add 1 and 1 together you get 2 But if our image in some parts is compensated higher in intensity to display correctly on the monitor your math would be incorrect. This is why when using Mari you will need to know what colour space the source material comes from. If I load an image of a brick wall from the texture library Textures.com it would be expected that the images downloaded from online texture libraries are in a gamma encoded state, most likely sRGB gamma. Mari tries to be clever and look at some parameters we define such as name and bit depth etc to set the correct linearization method. If I import an 8bit JPG into the image manager it should set a sRGB curve as input colorspace as this will invert the curve to be linear internally in Mari. If you look at this linearized image on a regular monitor it would look dark. Now it would be really hard to judge what you are doing if everything was dark and saturated so this is where look up tables comes in to play. The most basic LUT would be sRGB LUT making the image look identical to the image view outside of Mari in an image viewer. A look up table is simply a remapping of values.  The confusion when dealing with colour managed concepts can be when dealing with diffuse and scalar values. Especially if you take parts from a Linear channel and mix it into a diffuse channel. Now all of a sudden your channel can start to look different because your colour management doesn’t know what channel you are working in. This is most common if you share material especially if you work in the node graph in Mari.

 

 

Back to Scalar VS Diffuse

Lets dive into a Shader and look what type of shading effects is scalar and what is diffuse. I made a short presentation using the renderman PXR shader as an example I also will take a quick look at the gamma concept.

 

  • Diffuse Colour
  • Specular Colour
  • Transmission Colour
  • SSS Colour
  • Reflection Colour
  • Bump
  • Displacement
  • Specular Roughness
  • Transmission Gain
  • Specular Gain

 

Feel free to provide feedback or if you would like me to go more in depth in any area please request this in the comments below.

Author: The Mari Channel

Peter Aversten Lead Texture artist and Blogger. Started in the 90s writing about graphic art and 3d in Mac Art & Design and VFX art and design magazines under the collumn The Meshmen. In the 2000s I began my journey within VFX and now working as texture artists and blogging in the subject.

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *