Studio 3 Development Blog 7

Welcome back,

Today we are going to have quite an in-depth look at a specific area of PBR materials. I started looking into PBR more closely when 3DS Max 2017 included a physical shader in it’s material editor. It’s physical material however is much different to that of UE4 and thus much different to what I am use to. But nevertheless I thought it would be a great tool for doing beauty renders and presenting my models rather than resorting to what can be done in real time engines.

As what I am focusing on this trimester is suited to pre-rendering rather than real time I thought looking into the physical shader in Max 2017 would be a wise idea. I created a model and followed the general PBR pipeline that I use. Got the standard PBR maps that I use (albedo, roughness, metalness and normal) a standard base for any material, plugged them into their spots on the physical shader and… it looked like plastic…

So I did some research. As with all software, the more powerful it is the  more you need to know to get it to work right. The main contributing factor to the lack of success of my shader was the IOR value (Index of Refraction). It basically controls the refractive nature of the shader and subsequently the object that shader is applied to.

In theory it’s a pretty simple concept, the index is a relative value, comparing the speed of light as it travels through a medium to the speed of light and the speed it travels through the medium of the receiver (human eye or camera). The index value tends to indicate density of the object, that is to say air has a IOR value very close to 1, its 1.0003 to be specific, water is 1.333 and glass is around 1.6 ish. These values can be easily found by looking up an IOR table.

Thinking about it a little further if you wanted a super realistic scene you could take into account lots of other physical parameters that would affect the IOR value of an object. Given that IOR is connected to density then you could adjust the IOR value accordingly. Also worth noting the other dependencies of the density of a material such as the pressure or forces it is under and the temperature of the substance (both particularly effective on gasses and other compressible substances). For example, logically, the higher the altitude of the scene the closer the IOR value would be to 1 for air as the density of the air lowers due to the lowing of atmospheric pressure, or the deeper in the ocean you travel the higher the pressure, and thus density of water (although it compresses much less than a lot of other substances) and so the IOR value would increase, although only marginally.

Through some research I found that with little more than and IOR value and some base colours you could can some fairly good basic materials. This suggested to me that the IOR value was super powerful and super important. But at the end of the day it was just a value for the whole material.

What about objects that are made of several sub-materials?

Surely they wouldn’t pigeon hole you into using multi-sub-object materials for every model?

Turns out you can control the IOR values for separate parts of the model through the use of an IOR map. Being only a value it logically follows that a grey scale map works to control the IOR value of the material.

3DS Max’s documentation says that when using a map to control IOR the material always interpolates the IOR value between 1 and the value set by the material.

In the physical shader the IOR values you can enter range from 0.1 to 50. Regardless of what you enter the values never go higher or lower than that range. Additionally as the means of control through a map is grey scale then the RGB values for the corresponding IOR are also bounded by the 0-255 range that RGB is bounded by. Also, we know that the map is an interpolation between the IOR value you set in the material and 1. Assuming a linear interpolation, logically then, it follows that it shouldn’t be too hard to formulate a way to predict what the set values of IOR and the RGB values in the map will produce as an active IOR value.

A linear graph tends to have the form y=ax+b where ‘a’ and ‘b’ are constants. In our case y (what we want) is the active IOR value, x is our RGB value. We can safely say that our constant ‘b’ is 1 as that is the minimum value for IOR when the set value is above 1 and is the maximum value for the IOR when the set value is between 0 and 1. So currently we are looking at something like IORactual= a * RGB +1. As the actual IOR value we want is based on the set IOR value of the material than we know that our constant ‘a’ must be that same scalar.

Of course we have neglected that the RGB value there is also a relative RGB value and so should be actualRGB/maximumRGB or RGB/255.

So from all of that we get that the IOR value we want should be equal to SetIOR*(RGB/255)+1.To compensate for the fact that IORactual cannot exceed IORset we can modify the equation to be IOR=setIOR*(RGB/255)+(1-(RGB/255))

This allows us to maintain the limits of 1 and set IOR.

Some simple tests. Assuming setIOR=10

White RGB is 255

IORactual= 10*(255/255)+(1-(255/255)) = 10

Black is 0

IORactual= 10*(0/255)+(1-(0/255)) = 1

So the extremes hold true.

Unfortunately this is all speculation without testing.

So I built an IOR grid out of spheres with lots and lots of materials.

IOR_Grid

On the left going down is the base scale. at the top down is IOR=50/25/10/5/2/1

The grid on the right from left to right is using RGB values of 255/192/128/64/32/0

As you can see the RGB of 255 is the same as its set IOR counterpart and the IOR of 1 is the same all the way along its corresponding RGB values. Also where the RGB is 0 the IOR also appears to be 1.

So far as I can tell the formula seems to hold true. But what I have noticed and may need further testing is that adjusting the IOR value with a map alone does not seem to do as much as I would like (could just be a rendering error on my part, missed a setting somewhere or something like that). I found that I needed to work with both the reflective map and IOR map to achieve results.

So this is what I have learned and have derived from the research I have done into IOR maps in 3DS max 2017.

Hope it was helpful or insightful, references to follow in APA 6th edition.

As always,

Thank you and till next time,

James Day – 1002467

References

{{ meta.title }}. (2016). Area by Autodesk. Retrieved 9 July 2016, from https://area.autodesk.com/blogs/the-3ds-max-blog/introducing-3ds-max-2017

3ds Max 2014 tutorial – V-Ray material IOR maps (and color map experimenting in general). (2016).YouTube. Retrieved 9 July 2016, from https://www.youtube.com/watch?v=k93ECl5bPZQ

Find answers to all your CG Questions anc catchup on the LATEST CG News, EXCLUSIVE Features and Images from movies, games and art. (2008). CGSociety Forums. Retrieved 9 July 2016, from http://forums.cgsociety.org/archive/index.php?t-662851.html

Find answers to all your CG Questions anc catchup on the LATEST CG News, EXCLUSIVE Features and Images from movies, games and art. (2007). CGSociety Forums. Retrieved 9 July 2016, from http://forums.cgsociety.org/archive/index.php?t-513458.html

Material IOR Value reference. (2016). Blenderartists.org. Retrieved 9 July 2016, from https://blenderartists.org/forum/showthread.php?71202-Material-IOR-Value-reference

Pixel and Poly – Design Focused Creative Services. (2016). Pixelandpoly.com. Retrieved 9 July 2016, from http://www.pixelandpoly.com/ior.html

Refraction Map | 3ds Max | Autodesk Knowledge Network. (2016). Knowledge.autodesk.com. Retrieved 9 July 2016, from https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/3DSMax/files/GUID-CCD9B76C-9AC6-46E6-8B9C-E367CFC0FDAF-htm.html

To Use ActiveShade Rendering | 3ds Max | Autodesk Knowledge Network. (2016).Knowledge.autodesk.com. Retrieved 9 July 2016, from https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/3DSMax/files/GUID-06FF191B-B740-40C8-BD6A-CE07AF380304-htm.html

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s