Vray Materials – Part 1 – Diffuse

I think it’s time to redo my vray material guide with updated techniques and software.
The old one is still valid and a good reference for ‘how’ the vray shaders work, but there are a few changes in my approach and understanding of the shading process.

I’ll break this guide up into multiple posts so it’s not a huge essay that takes hours to read.

Let’s start with the basics.

PBR or physically based rendering

PBR is currently a hot topic, everyone from Disney to game engines are using it. So what exactly is PBR?

Until recently, the dominant approach in CG was using any means necessary to get the final render. If it looks good, it’s good. So there’s a lot of guesswork for the settings and a lot of artistic decisions that make the final image. This method still works, but overall the industry is slowly shifting towards a different approach – PBR

For PBR the main idea is that you should use realistic data from real world to make your 3d scenes. This means realistic light intensities and realistic diffuse/specular/etc settings for your shaders.

The main advantage, I think, is that it’s harder to make your images look ‘fake’ or ‘CG’. The strict rules imposed by PBR make sure that the renderer is at least working with a realistic inputs and thus is much more likely to create a realistic output. I’m not saying the images will look better (there’s plenty of shitty real photos), but they will look more realistic.
If your goal is to make ‘realistic’ renderings, this is absolutely the way to go. If your values are set right, you can spend more time working on the design, composition, lighting and postwork – things that actually matter.

So let’s get started on the actual practical information:

Diffuse

Diffuse color is the light that is reflected from an object in random directions. Some lightwaves are absorbed and some are reflected, if different wavelengths are absorbed by different amounts, the result is a colored.
Measured data from real world suggests that almost all surfaces reflect 3~90% of the light as Diffuse color.

The main exceptions are metals, which do not scatter the light but instead bounce it right back from the surface. Their Diffuse should be set to pure black. At least for pure, clean, non-oxidized metals…

Once we convert this to RGB range it’s something like [8;8;8] for blackest coal and [230;230;230] for the whitest snow. Most surfaces fall somewhere in between. Even things like paper sheet or white paint are only something like ~70% [179;179;179] and 85% reflective [204;204;204] definitely no higher than that.

If you are using Textures instead of color values, it’s a good idea to make sure that your image falls within this range, but there’s a catch… Gamma
Photo sourced textures come with a burned in srgb gamma correction of 2.2. This means that to get the image to look the same in 3ds max, it must be loaded with the gamma setting of 2.2
The side effect of this is that the values you use in photoshop do not match with the linear values that vray outputs. If your texture is medium gray in photoshop, the actual amount of reflected diffuse light is going to be only 22% instead of 50%.

bitmap gamma

When we convert the diffuse color range to sRGB, we get values of 50~243
The formula used: sRGB=(linearpercent/100)^(1/2.2)*255.
As an example, to get 4% reflectance from an srgb texture we can use this calculation. (4/100)^(1/2.2)*255=59
You don’t actually have to do the math every time, scroll down for a chart that allows you to easily convert between the two.

All these numbers seem complicated, but the things that you should take away from this are:

  • Diffuse is darker than we think it is most of the time.
  • The blacks are not as black as we think.
  • Make sure that gamma correction doesn’t fu*k up your values

To get a rough idea on where different material diffuse brightness falls in linear and srgb color space – just use this handy little graph I made (click to enlarge)


Simply pick the color in photoshop and see the value in either of the gradients. This is not something that you have to use as a law, but just to give you a basic approximation. Nobody is going to get upset if your sand is 47% bright instead of 45%.

So how do we actually get the texture to fall within the range we need in Photoshop?
You need to use either Levels or Curves. Here’s quick guide:

Open up your texture and decide the range where it’s values should fit in.
For example – here’s a dirty concrete texture that should be about 75% reflective or [190;190;190] in srgb space.

photo

Open it up in photoshop and press Ctrl+L for levels tool.

1. Make sure the black and white points are adjusted to just touch the histogram on left and right and adjust the output values.
2. Since the main color of clean concrete should be about 190, move the whites down to 195 (some dirt streaks seem brighter than actual concrete). Now move the blacks up to about 65, since the dirt and grime is probably about as dark as dark soil, not darker.

lvls

That’s it – the image should now be a realistic, usable Diffuse map. The difference is not very strong in this case, but it’s noticeable. Overall texture is a bit darker, whereas before it was too bright.

after

If you are used to work with full 0~255 range of color in your scenes, the resulting renders might seem flat or low contrast.
While this might be the initial impression, working in a linear space gets you more than enough color range to bring in some contrast in post.
So don’t be afraid of flat images coming out of your renderer, it’s nothing that some simple postwork can’t make as crisp and contrasty as any other workflow.

Here’s a simple example with coal-black material looking quite light in the render but rich and dark after adjusting the curves.

sample_post

So that’s it for the Part 1 – Diffuse
Stay tuned for the next part where I’ll cover Reflection settings!

21 thoughts on “Vray Materials – Part 1 – Diffuse

  1. Austris, that’s awesome! Has your rethinking on materials got anything to do with Grant Warwick’s recent set of vray tutorials?

    • *looks like the comments made from admin page never actually appear :/

      I’ve picked up some tricks from Grant, but my workflow is different.
      I’ve also studied how things are done in other software and in game engines so there’s a lot information to process and these posts help me put everything together.

  2. Man thanks for the lesson !

  3. Thank you! See you on next lesson!

  4. Awesome Lecture.

  5. There’s a little thing i want to ask.. Sorry in advance for the ignorance.

    If we setup vray’s output gamma to 1.0, so we work in VFB without displaying colors in SRGB space.. We have the same problem?

    • Not sure why you would do that, it’s not a proper setup for linear workflow. The final linear image, should be gamma corrected for viewing either directly in vray or in postwork.

      Gamma 2.2 in vray color mapping settings just changes the way vray does sampling. It’s more efficient as it takes into account that the image will be corrected to srgb.
      You can still view the linear image in the vfb by not turning on the srgb button and setting color mapping mode to ‘none – don’t apply anything’

      The bitmap input gamma is an entirely different thing – all photos come with a burned in gamma correction so they must have the 2.2 inverse gamma applied anyway.

  6. Hi Austris,
    Thanks for this great lesson.

    In below link also an easy way for making diffuse / albedo PBR textures.
    http://www.cryengine.com/community/viewtopic.php?f=291&t=127206
    In photoshop the right diffuse-albedo value is the “median”. You can find it in the the histogram.
    Also some interesting tips on how to set up photoshop.

    Looking forward to your next lesson!
    Thanks man!

  7. Hi Austris,

    “here’s a dirty concrete texture that should be about 75% reflective or [190;190;190] in srgb space.” – may i know where can i get the 75% reflective value, is there any reference chart for all kind of material in real world?

    • I just used the chart I made for the post. Pick with a color picker from the srgb gradient somewhere around the concrete mark.

      I think there’s enough materials there to make an educated guess for other materials that are not included. Just compare them to the ones in the chart and decide how much darker/lighter they should be. It’s not an exact science, getting close enough is enough.

      75% is actually the value corrected for srgb, linear reflectance is only about ~53%. Sorry if that’s worded a bit confusing.

  8. Thank you!

  9. Short, sweet and to the point – thanks for a great tutorial.
    PFX

  10. Austris, thanks for this lesson.

    Am i righ that in diffuse slot we need to use albedo like this
    https://corona-renderer.com/forum/index.php?topic=2359.0 ?

  11. Hi Austris,

    A “Simple” question:
    I often have to make diffuse textures in a specific Paint color. Like RAL9010 or RAL7022. How would you handle those specific colors? I find it quite hard to get the values right in PBR?

    • Rather than trying to copy the colour numbers into the vray colour picker, I would make a texture in photoshop which is the correct colour, then use that as a map in the diffuse slot.

    • Hi,

      those ral values are kind of subjective, as they are only correct when used within a closed system – they are correct when compared to each other only.

      After a quick look at the range of the ral colors, it seems that they go from ‘jet black’ [10;10;10] to ‘pure white’ [255;255;255] So it seems that the lower limit is ok, but the upper limit is too bright for actual pbr.

      Simple solution – make a small color swatch bitmap in photoshop, fill it with the ral color and using levels tool move the whites down to 236 (80 % linear which is maximum for acrylic paint). Save the bitmap and use it as a map in vray. that’s how I would do it.

      Keep in mind that you need to do this for all ral colors you use, otherwise the relationship between them is incorrect.

      • Thanks for the quick reply guys. I really appreciate it. The question was bothering me for a couple of months now.

        I always make a RAL texture in photoshop (JPG from Google, or a scan from a real RAL color chart). The problem is in the bright values / images as Austris explained above. The solution with the levels tool works like a charm to resolve this problem. Thanks Austris!

        But manually correcting all RAL colours somehow seems “wrong” to me. If PBR is the way for physically correct rendering, I just don’t understand why it is so difficult to reproduce these simple (RAL)colors in a way that it corresponds to reality. It feels strange to have a scanned RAL color image and then using the levels tool to make it darker so that it renders physically correct.

        I’m probably thinking way too much about something unimportant… Time for some sleep ;-).

        • Well think of it this way – the ral colors are there to represent colors of ‘paint’ (or pigment in plastics, varnishes, etc.)
          The paint itself is not the brightest possible object in the world, the whitest paint is still darker than snow and other super bright things.

          Vray uses a larger range of values to represent all the possible brightness range, even things darker and lighter than the paint pigments could ever be.

          Since the ral system doesn’t need to show any colors that are brighter than it could actually show (since it’s impossible) it takes the whitest pigment as max rgb value… It’s just using a scale that’s different from the one we use in vray.

Leave a Reply

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