Physical Shaders

Phys­i­cal­Shaders is my col­lec­tion of shaders designed to pro­duce pho­to­re­al­is­tic results based on research of the phys­i­cal prop­er­ties of sur­face mate­ri­als and cam­era optics.

The shaders are fine-​​tuned to com­ple­ment each other and offer best results when used in com­bi­na­tion. For exam­ple, using the Phys­i­cal­Cam­era with a Phys­i­cal­Light will by default pro­duce phys­i­cally cor­rect light­ing com­pa­ra­ble to the out­put of a 100W light bulb pho­tographed at ISO 100, f8, 1100.

All shaders expect the scene to be mod­eled to scale for accu­rate results.

  1. PhysicalCamera

    This lens shader mimics a DSLR camera's exposure settings in order to allow more intuitive lighting in CG.

  2. PhysicalLight

    PhysicalLight can be used to realistically simulate artificial light sources such as electric bulbs, candle flames and fluorescent tubes.

  3. PhysicalMaterial

    PhysicalMaterial is a physically accurate mental ray shader that is based on Maxwell's material system.

  4. PhysicalSkylight

    PhysicalSkylight uses an HDRI environment map to light the scene and renders fast ambient occlusion shadows from the direction of the light source.

  5. PhysicalTones

    PhysicalTones is a true tone mapping operator for mental ray. Tone-mapping is the process of bringing high dynamic range images into a range more suitable for display on ordinary computer monitors.

  6. PhysicalNoise

    PhysicalNoise is a simple lens shader that simulates film grain or sampling noise at render-time.

PhysicalCamera

This lens shader is designed to be phys­i­cally accu­rate and mim­ics a DSLR camera’s expo­sure set­tings. For simplicity’s sake I mod­eled the set­tings after the pop­u­lar and beginner-​​friendly Nikon D40.

Phys­i­cal­Cam­era bases its expo­sure cal­cu­la­tions on these real-​​world cam­era units:

The shader offers use­ful pre­sets for each indi­vid­ual set­ting and also com­bined pre­sets for var­i­ous light­ing sit­u­a­tions such as sun­light, over­cast skies, tung­sten etc. as you might know them from your DSLR cam­era.
Any­one famil­iar with pho­to­graphic cam­eras will find Phys­i­cal­Cam­era intu­itive to use.

More­over, Phys­i­cal­Cam­era fea­tures basic color cor­rec­tion set­tings and sim­u­lates var­i­ous pho­to­graphic effects includ­ing vignetting, chro­matic aber­ra­tion and film grain for added realism.

Usage

This shader can be used as a basic tone map­ping oper­a­tor and to prop­erly expose an image as you would with a real DSLR camera.

Phys­i­cal­Cam­era is designed for best results when used in com­bi­na­tion with Phys­i­cal­Light and Phys­i­cal­Ma­te­r­ial.

PhysicalLight

This advanced light shader is designed to be phys­i­cally accu­rate in its base con­fig­u­ra­tion but can be eas­ily mod­i­fied for artis­tic effect.

PhysicalLightPhysicalLightPhysicalLightPhysicalLight

Phys­i­cal­Light is meant to work with Phys­i­cal­Cam­era — sim­ply set the lens shader to a real­is­tic pho­to­graphic expo­sure and your Phys­i­cal­Lights will ren­der as you would expect real­is­tic lights within the scale of your scene.

Unlike most light shaders in biased ren­der­ing engines, Phys­i­cal­Light does not take arbi­trary input val­ues: Instead, you can enter (or choose from a use­ful range of pre­sets) your light’s color tem­per­a­ture and lumi­nance in watts, which actu­ally cor­re­lates to real world val­ues. The shader sup­ports area lights, soft shad­ows and IES pro­files for even more real­is­tic effects.

Phys­i­cal­Light was mod­eled after Maxwell’s light model to ensure the utmost phys­i­cal accu­racy while at the same time pro­vid­ing quick ren­der times.

Usage

Phys­i­cal­Light can be used to real­is­ti­cally sim­u­late arti­fi­cial light sources such as elec­tric bulbs, can­dle flames and flu­o­res­cent tubes.

PhysicalMaterial

Phys­i­cal­Ma­te­r­ial is designed to accu­rately sim­u­late real-​​world mate­ri­als in a real­is­tic and effi­cient shad­ing model.

PhysicalMaterialPhysicalMaterialPhysicalMaterialPhysicalMaterialPhysicalMaterial

This men­tal ray shader is based on Maxwell’s mate­r­ial sys­tem and offers very few options com­pared to men­tal ray’s archi­tec­tural mate­ri­als by expos­ing only the most nec­es­sary shad­ing para­me­ters and inter­nally adjust­ing oth­ers auto­mat­i­cally in order to main­tain phys­i­cally plau­si­ble values:

  • Reflec­tion 0
  • Reflec­tion 90
  • Index of refraction
  • Rough­ness
  • Bump

But even with these few options it is pos­si­ble to cre­ate just about any (hard) sur­face mate­r­ial you could imag­ine, thanks to the shader’s built-​​in lay­er­ing sys­tem. And since the shader is energy con­serv­ing it is really sim­ple to cre­ate pho­to­re­al­is­tic shad­ing, espe­cially when used in com­bi­na­tion with my Phys­i­cal­Light.

Of course it is also pos­si­ble to get “under the hood” and tweak advanced fea­tures such as Final Gather con­tri­bu­tion and ambi­ent occlu­sion, but the shader is designed to let you ignore those for the most part… the pre­sets pretty much sim­u­late the mate­r­ial they say they will with­out much ado.

The shader fea­tures spec­u­lar high­lights based on Lafortune’s model, glossy reflec­tions and an inte­grated lay­er­ing sys­tem that lets you cre­ate iri­des­cent coat­ings and advanced effects such as greasy spec­u­lar highlights.

Usage

Phys­i­cal­Ma­te­r­ial is best suited for met­als, plas­tics, car paint, clay, wood, stone… basi­cally any type of hard mate­r­ial. The shader comes with a num­ber of pre­sets that sim­u­late real world mate­ri­als for quick setup in archi­tec­tural renders.

PhysicalSkylight

The look and some effects of the expen­sive Final Gather tech­nique can be sim­u­lated with this light shader. Phys­i­cal­Sky­light uses an HDRI envi­ron­ment map to light the scene and ren­ders fast ambi­ent occlu­sion shad­ows from the direc­tion of the light source.

PhysicalSkylight

To accu­rately sim­u­late a final gather look it is nec­es­sary to pre-​​filter the envi­ron­ment map in an exter­nal pro­gram using a tech­nique called spher­i­cal har­mon­ics.

Unlike true final gather, this tech­nique does not intro­duce unwanted flicker in ani­ma­tion sequences, but it also does not han­dle sec­ondary bounces.

Usage

This light shader is best suited for out­door envi­ron­ments such as over­cast day­light on a cloudy day. It is not intended for inte­rior ren­ders but may be used for direc­tional ambi­ent occlu­sion.
Phys­i­cal­Sky­light can also be used to bring out small details in a scene with­out cre­at­ing the dirty look of a mul­ti­plied occlu­sion pass.

PhysicalTones

Phys­i­cal­Tones is a true tone map­ping oper­a­tor for men­tal ray. As you can see from the sam­ples, tone map­ping can be used for var­i­ous effects — real­is­tic and artis­tic.

minTonemapminTonemapminTonemapminTonemapminTonemap

But the mia_​exposure nodes already do tone map­ping, you might say! Well… not exactly. Not in the true sense of the word, any­way.
What they do is in real­ity just glo­ri­fied gamma cor­rec­tion which works on indi­vid­ual pix­els. Tone map­ping on the other hand is specif­i­cally designed to bring high dynamic range (HDR) images into a more lim­ited dynamic range and works with indi­vid­ual pix­els as well as spa­tial sam­pling depend­ing on the algo­rithm used.

Usage

Tone-​​mapping is the process of bring­ing high dynamic range images into a range more suit­able for dis­play on ordi­nary com­puter mon­i­tors.
Phys­i­cal­Tones can be used in com­bi­na­tion or as a replace­ment for mia_​exposure_​photographic, mia_​exposure_​simple and Phys­i­cal­Cam­era. The shader often does a bet­ter job at lim­it­ing the dynamic range or can be used to achieve the trendy HDR photo look.

PhysicalNoise

Phys­i­cal­Noise is a sim­ple lens shader for men­tal ray that sim­u­lates film grain or sam­pling noise at render-​​time.
The shader has options to con­trol the grain size and strength for the indi­vid­ual RGB chan­nels and to sim­u­late either film grain or sam­pling noise.

minNoise

Usage

Any ana­log or dig­i­tal cam­era pro­duces (more or less sub­tle) grain which, when applied to CG imagery, can lead to more pho­to­re­al­is­tic results.

Another usage is when com­par­ing the out­put of men­tal ray to quick Maxwellren­ders, a lit­tle extra noise makes it eas­ier to spot the other dif­fer­ences between the two results.