Using Real World Map size with UV unwrapped models

Lately I’ve been using Real World Map sizes for my shaders. It’s just a more convenient way to reuse them on different models without adjusting the UVs.
The scale of textures always stays the same and you don’t need to worry about “Is it too small?”, “Is it too large?” As long as you get the scale correctly when creating the shader the first time, it’s going to be fine forever after.

If you are using this method for objects with regular mapping (box,sphere,planar,etc) it is very easy to just tick the little box that says real world map size in the UVW Map modifier and get a correct result. However, what if you need to use these shaders on a model that you have properly UVW Unwrapped?

There is an easy method to get the scale correctly, you just need to use a couple of little tricks:

So here’s my object, as you can see it is nicely unwrapped and works fine with regular map sizes.

regular_map

To get it working with real world map size, I’m going to add an UVW Xform modifier to it.
You can adjust the tiling in these little boxes.

uwvxform

But how do you know what numbers to enter so it matches the real world mapping?
Simple! Assign a map that has clearly visible borders (a simple grey square with black border works fine) and set the size to something like 10 cm (smaller for smaller objects and larger for larger ones). Now create a little box or a rectangle above your object with the same size as you set up for the map and from the top view adjust the tiling until it matches.

topview

In this case the magic number was 290

290

Now it works perfectly with any real world scaled texture!

fit

If you want to mix and match the UVs between realworld and unwrapped, just use a different UV channel like this.

channel2

Vray Materials – Part 3 – Metals

Let’s continue the shader theme a bit further. Todays topic will be METALS

Metals are a special case – in their pure form, they do not have a Diffuse component, only reflections.
As if that were not enough, those reflections behave differently from non-metals.

They are much stronger, the fresnel equation (and the resulting curve) is more complex and the reflections are colored in a lot of cases.
Here is a comparison of reflection curves of aluminum and plastic.

curves

Notice that overall reflections are stronger and that there is a dip towards the right end of the graph for the aluminum. The math to create this graph needs multiple values, not just a simple number for IOR.
Vray doesn’t natively support the complex fresnel equation with n and k values used for metals. So to get accurate reflections, we must use some tricks.

The first method (popularized by Grant Warwick in his Mastering VRay course) is by creating custom falloff curves by hand in the material editor.
This method works, although it is quite tedious to set up. If you watch his course you will see how to use it, I’m not going to repeat it here.

However, there is one important thing that Grant didn’t quite get correctly, so I feel like I should ‘fix’ it.
The falloff map in 3ds max works in a strange way, the actual values are not really exactly what they seem. It seems that the falloff goes from 0 to 90 degrees in a linear fashion, but that is simply not true. So if we place a point at 50% and expect it to represent the color at 45 degree incidence angle… it doesn’t really show up at 45 degrees.
Here’s a simple test setup and the results. The lines on the sphere are rotated at exactly 45 and 22.5 degrees As you can see, it simply does not match.

edit

***Edit***

Thanks to on Wobi on chaosgroup forums for writing this osl you can use to ‘fix’ the falloff precisely. Just unzip and load this FILE as both Front and Side of the falloff and you can use the curves like Grant suggests in his videos.

FIX

After writing this post, there have been some changes that make the method below outdated. Siger from sigerstudio.eu has written a FREE plugin that works with older versions of vray and also has ready-made presets that allow you to get the correct metal reflections very quickly and easily!

Check it out HERE!


The second method (the one I prefer) uses a custom OSL shader as the reflection texture (load it into the reflection slot through VrayOSLTex node and make sure the Fresnel is off in the shader settings) and it’s a bit easier to use. You just have to enter the n and k values taken from the refractiveindex.info site for R, G and B wavelengths.

nkvalues

rgb
The actual values for red, green and blue are somewhat open to interpretation, Different sources use different numbers but the approximate range is similar.
I use values from NASA’s site: 0.650, 0.510, 0.475

Now the resulting reflection map has the correct color and the correct falloff calculated by the complex fresnel equation.
When you’ve set up the values for a particular metal, save the osl file for future use.

If the color feels a bit wrong or you need a slightly different alloy, just run the map through a color correction node and adjust the hue saturation there. This way you still have the correct starting point with correct falloff curve and are just making color changes.

color_tweak

Another interesting thing about metals is that they are actually almost never pure metals. As soon as they are exposed to air, they start to oxidize (tarnish, rust).
tarnishThe resulting metal oxides behave like dielectrics. So this means they actually have a completely different set of properties. There are a couple of ways to deal with this: Blend materials and complex map setups in single layered shaders. I’ll demonstrate these workflows in detail pretty soon as a premium video.

That’s it for this chapter in the vray PBR material guide :)

Linear workflow and Gamma

I’ve had some requests for this tutorial in the past, but never came around to making it.
Fortunately Ismail Rebbane offered to write a guest post explaining this subject, so here goes :)

Linear Workflow and Gamma allow you to process texture, color and light in a correct mathematically way.
It has nothing to do with creativity or art, just a matter of working with correct math versus broken math.
We unfortunately can’t avoid it!

If you usually get dark corner, textures and color that doesn’t much the reference. or, doubling the light’s intensity all the time to make the scene brighter then, working in a linear manner is what you’re missing.

After you watch the video below, you’ll have a complete understanding of Linear workflow, Gamma and how to set it up correctly, starting from 3ds max, Vray and finally in Compositing (Photoshop, After effects, Nuke).

Quick tip:
One trick i learned recently from Austris to speed up the rendering process while keeping the Linear information, is to “change the color mapping to Reinhard with burn value at 0.8~0.9 and keep the mode set to none”.
You’ll get the same image and faster render time, because vray will sample the highlight areas more efficiently!

USEFUL LINKS AND RESOURCES MENTIONED

Color Mapping. Tone Mapping is very important, make sure to visit this page and learn more about it.
Gamma and LUT Preferences. Gamma policy in 3ds max.
ProEXR. Extracting passes with this tool is a piece of cake.

————————————————————–
About Ismail Rebbane
3D Artist and Visualizer, specializing in the field of Architecture Visualization.
Also the guy behind cgalter.com, which is the place where he shares what he learned over the years working in the visualization Industry.

————————————————————–