Forum

#1 2011-09-25 21:52:16

Ben
Guerilla dev, the guy to hug

Physically based shading

Hi everyone!

I'm experimenting with physically balanced shading, so I designed a node that let you layer surfaces using physically based relations. This node has 3 modes: diffuse, glass, and metal. The diffuse mode breaks the light contribution between a specular and a diffuse term, glass breaks it between a specular and the under layer, and metal only uses specular. Of course, indirect light contributions are taken into account and are mixed accordingly to the correct fresnel factors.

Here are some examples of how you can combine layers:

http://www.guerillarender.com/images/phys_samples.jpg

From top left to bottom right:
- Base glass layer
- Base diffuse layer
- Base metal layer
- A yellow varnish layer over a diffuse layer
- A transparent varnish layer over a textured diffuse layer
- A green varnish layer over a anisotropic rough metal -- cool setup for metallic car paints, it only lacks flakes
- A slightly tinted glass with refraction (and yes, these are caustics...)
- A redish varnish layer over diffuse layer, with procedural bump -- displacement would do it to
- A rusty layer over a anisotropic rough metal layer -- the rust placement is controlled by a procedural mask, which also controls the bump amount

http://www.guerillarender.com/images/phys_screen.jpg

I implemented 3 different specular models for the direct lighting: Torrance Sparrow using Beckmann distribution (aka Cook Torrance), Torrance Sparrow using Blinn distribution, and an Anisotropic Ward. The diffuse model for the direct lighting are simple Lambert and Oren Nayar.

The physical layer node has a minimal set of controls, but sufficient enough to create a wide variety of different surfaces, for instance a varnished rusty metal, or a diffuse layer over a varnish layer over another diffuse layer to simulate dust on a pool ball... Of course, ambient, diffuse, specular, reflection and refraction are available a separate AOVs (provided you let the contributions flow from the bottom layer to the top layer.)

And they are even workable in OpenGL preview!

Of course the physical model behind is not perfect. For instance it doesn't account for the deviation of the view and light direction when crossing a layer boundary, but designing these layers as separate nodes prevents me from going further... Anyway, this is still worth investigating a little to get these nasty specular formulas into shape! smile

Cheers!


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

#2 2011-09-25 21:59:53

pitiwazou
Member

Re: Physically based shading

Really good Ben ! That's awesome !


The member to blame ! ^^
Cédric Lepiller, Freelance 3D
http://www.pitiwazou.com/

Offline

 

#3 2011-09-25 22:55:22

pixo
Member

Re: Physically based shading

it work with few parameters ! you rox man !

Offline

 

#4 2011-09-26 08:14:12

Elendil
Member

Re: Physically based shading

Yes really impressive !

Offline

 

#5 2011-09-26 09:25:06

hulud
Guerilla dev, the guy to hug

Re: Physically based shading

That's awesome !

Because of Guerilla's default shaders, we are not so confident about opening the beta test to anyone. The users are supposed to build their own shaders before to start rendering. And it is a too difficult task for most of the people. A good default shader library is a big step to the open beta test.

Cyril


Cyril 'Hulud' Corvazier
Guerilla developer
http://www.mercs-eng.com

Offline

 

#6 2011-09-26 09:29:38

pitiwazou
Member

Re: Physically based shading

Yep !


The member to blame ! ^^
Cédric Lepiller, Freelance 3D
http://www.pitiwazou.com/

Offline

 

#7 2011-09-26 09:30:19

hulud
Guerilla dev, the guy to hug

Re: Physically based shading

About the ray direction between layers.. Can't you add a 'I' input and output to your node and connect the output 'I' of the upper layer to the input 'I' of the lower one ?


Cyril 'Hulud' Corvazier
Guerilla developer
http://www.mercs-eng.com

Offline

 

#8 2011-09-26 09:52:29

Ben
Guerilla dev, the guy to hug

Re: Physically based shading

The layering goes from the bottom layer to the top layer, so it would need to be able to cycle connections. The other way around (from top to bottom) is possible but it would require extra parameters to be passed between layers (upper color, attenuation, I direction...) and would render this node less simple to use. Anyway, in both layout the light direction L can't be deviated since it is on;y available from within the illuminance loop...


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

#9 2011-09-26 09:58:55

hulud
Guerilla dev, the guy to hug

Re: Physically based shading

What about the Ashikhmin and GGX models ? Have you gived them a try ? smile


Cyril 'Hulud' Corvazier
Guerilla developer
http://www.mercs-eng.com

Offline

 

#10 2011-09-26 10:54:25

Ben
Guerilla dev, the guy to hug

Re: Physically based shading

Ashikhmin Shirley is easy peasy. GGX papaer, though, gives me back pain. I'll try it out, anyway...


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

#11 2011-09-26 12:03:16

PascalB
Member

Re: Physically based shading

I love the raytracedefrein metal ball in the forground of the exemple.

Offline

 

#12 2011-09-26 12:20:19

pitiwazou
Member

Re: Physically based shading

Have you any idea when we can test this feature ? and the 0.13 ? ^^


The member to blame ! ^^
Cédric Lepiller, Freelance 3D
http://www.pitiwazou.com/

Offline

 

#13 2011-10-13 14:15:25

pitiwazou
Member

Re: Physically based shading

I think, It will be good to add pictures in the addon materials on the site when we will upload new materials based on your Physically based shaders.


The member to blame ! ^^
Cédric Lepiller, Freelance 3D
http://www.pitiwazou.com/

Offline

 

#14 2013-12-09 23:19:17

matic
Member

Re: Physically based shading

Hi, With the new version if guerilla (1.01 right now) How can make  a frosted glass shader ?? I don't see any roughness in the glass tab,


Freelancer 2d / 3d
My Web Site

Offline

 

#15 2013-12-10 04:57:37

Ben
Guerilla dev, the guy to hug

Re: Physically based shading

Unfortunately not, we have to implement rough refraction.


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB