How to Make your own Physically Correct Shading - Blender.org

download.blender.org

How to Make your own Physically Correct Shading - Blender.org

François Gastaldo

Octopod Studio

How to Make your own

Physically Correct Shading

(...With Cycles...)


1. What is Correct?

2. Who is correct?

3. Why being Correct?

4. How to be Correct?

5. How to be even more Correct?


What is Correct?

Any photography is physically Correct!


Being Physically Correct is:

Or

Using the same laws in reality and in your rendering.

Respecting the Law of Mother Nature!

The goal is to have materials that react to light as real materials do.


What is the difference between ‘physically correct’ and ‘Physically Based’?

• Both are physically correct.

Physically Based is FROM real materials (used as input)

Physically Correct is LIKE real materials


What is the Law?

Or

(don’t be afraid, I’ll explain it later)

Law of Interaction between light and materials, or behaviour of light on

surface material.


Who is Correct?

A lot of renderer have premade Physically Correct Shaders:

• Mental Ray, iRay (©NVIDIA)

• VRay (© Chaosgroup)

• Maxwell (© NextLimit)

• Lux Render (© Luxrender?)

• Thea Render (© Solid Iris)

• Arion (© RandomControl)

• Octane (© Otoy)

• Indigo (© Glare Technologies)

• 3DSMax obsolete ScanLine renderer (© Autodesk)

• and many many more!!!


Who is not, or let choice to not be Correct?

• Mental Ray (©NVIDIA)

• Cycles (©Blender Foundation)

• RenderMan (©Pixar)

• Arnold (©SolidAngle)

• Lightwave (©Newtek)

And just some others…


Who is using Physically Correct Shading in Production?

And also home-made physically correct shaders...

Disney Studio

Sony Pictures Imageworks

Ubisoft

ILM

Tri-Ace

Pixar

RazorBlade

Many, many, many more...


Why being Correct?

And why make your Own Correct Shading?

The first goal is Realistic Rendering.


Second is to have an unified shader pipeline:

• All objects react in the same way to lighting

• All materials are build on the same base

• Materials are specific to your needs and perfectly fitted to what you

want to do with them.

In other words.

• No need to individually relight objects

• No need to develop new shader tree for each objects.

• No need to understand tons of parameters from an all-purpose

material.

(kind of dream, no?)


At first, the LAW:

How to be Correct?


• Result is always 1

• Energy Conservation

R + T + A = 1


A = Absorption

• A material absorbing light is Dark

Physically speaking, a real Absorption can’t exist. It means Heat

Conversion, wavelength shift or diffusion inside the material (SSS)


R + T


R = Reflectivity

• Also (mis)called Reflection


Rd = Diffuse Reflectivity

like on a mat object: paint, wall, wood, etc…

Rs = Specular Reflectivity

More Reflectivity :

like a mirror, or a metal object.

Rf = Fresnel Reflectivity

Rb = Back Reflectivity


T = Transparency


Or like this:

Rd + Rs + T


Rd = Diffuse Reflectivity =

Rs = Specular Reflectivity =

T = Transparency =


…One Minute Break…

What is this law in real life?


First, an object can’t be fully reflective (R=1) and fully transparent (T=1)

due to Energy conservation (if R + T = 1 … then one solution is R = 0.5,

T = 0.5, or R=0.1 and T=0.9…).

Second, an object more glossy (more Rs) than another is also darker

(Less Rd). (wet objects are darker than dry objects)

Third, a dirty glass is white because if there is less T and less Rs, then

there is more Rd (A + Rd + Rs + T strictly = 1, and, on a glass no

Absorption could occur, A=0. If T is lower, Rd is Bigger)

...End of Break...


Keep it below One !

Normalization


Simplest Physically Correct Shader:


Used in MentalRay, VRay, ...

1 st : Reflection

2 nd : Transparency

3 rd : Diffuse

Priority Normalization


Diffuse Factor

Reflection Factor

Transparency Factor

Factor or Color?


Be a little more Correct!

Roughness


Example:

Rs = 50%

T = 60%

Rd = 100%

More Diffuse than Transparency than Reflectivity?


Result is

Rs = 50%

T = 30% (50%*60%)

Rd = 20% (100% * (50% - 30%))

Rs + Rd + T = 100% = 1

NO !


Same example

Proportional Normalization

Rs = 50% -> Rs = 23,8%

T = 60% -> T = 28,6%

Rd = 100% -> Rd = 47.6%

Rs + Rd + T = 100% = 1


Input : Rd, Rs, T

Corr = 1.0 / (Rd + Rs + T)

If Corr > 1.0

Rd = Rd * Corr

Rs = Rs * Corr

T = T * Corr

Output = Diffuse(Rd) + Glossy(Rs) + Glass(T)


Input : Rd, Rs, T

Corr = 1.0 / (Rd + Rs + T)

Corr = Min( 1.0 ; Corr )

Rd = Rd * Corr

Rs = Rs * Corr

T = T * Corr

Output = Diffuse(Rd) + Glossy(Rs) + Glass(T)


Roughness Driven Normalization


Roughness = 0 Rs = 1, Rd = 0, Perfect Mirror

Roughness = 1 Rs = 0, Rd = 1, Perfect Lambertian surface

Roughness > 1 Rs = 0, Rd = 1,

Input : Roughness

Rd = Clamp(Roughness ; 0 ; 1)

Rs = Clamp( 1.0 – Roughness ; 0 ; 1 )

GlossyRoughness = Roughness

DiffuseRoughness = Roughness / 4.0

Diffuse Roughness = f(Global Roughness)


Which Normalization is the Best?

Roughness Driven Normalization ?

Proportional Normalization ?

Priority Normalization ?


Rd(λ,θu,θv,αu,αv,x,y) + Rs(λ,θu,θv,αu,αv,x,y) + T(λ,θu,θv,αu,αv,x,y)


λ = Color

θu,θv =

(RGB or spectral rendering, according to renderer)

Direction of Light (Light / Normal)

αu,αv = Angle of view (Incidence)

x, y = Position on Object


also called:

Things are changing according angle of view and of light

BRDF


Angle of View, Incidence


Fresnel

Layer Weight


Is it Enough Correct?


One Golden Base

+ Dark colored Glaze

+ clear glaze

Candy Apple Paint


1 st Layer : Golden Base


2 nd Layer : Dark Color Glaze


1 st Mix : Dark Glaze on Golden Base


3 rd Layer: Clear Reflective Glaze


2 nd and Final Mix: Clear on top of Golden Base + Dark Color Glaze


Some (good) Advices

• Work with Linear Workspace

• Always keep your input datas outside of Shader Group

• Beware of CPU node limitation

• KISS : Keep It Stupidly Simple


The END

Thanks for your attention

It’s Time for Questions!

See you next year for same talk done with OSL!

Contact me:

fgp@formacd.com

More magazines by this user
Similar magazines