May 5 2009
Shaders for mental ray and RenderMan
PhysicalShaders is my collection of shaders designed to produce photorealistic results based on research of the physical properties of surface materials and camera optics.
The shaders are fine-tuned to complement each other and offer best results when used in combination. For example, using the PhysicalCamera with a PhysicalLight will by default produce physically correct lighting comparable to the output of a 100W light bulb photographed at ISO 100, f8, 1⁄100.
All shaders expect the scene to be modeled to scale for accurate results.
PhysicalCamera
This lens shader mimics a DSLR camera's exposure settings in order to allow more intuitive lighting in CG.
PhysicalLight
PhysicalLight can be used to realistically simulate artificial light sources such as electric bulbs, candle flames and fluorescent tubes.
PhysicalMaterial
PhysicalMaterial is a physically accurate mental ray shader that is based on Maxwell's material system.
PhysicalSkylight
PhysicalSkylight uses an HDRI environment map to light the scene and renders fast ambient occlusion shadows from the direction of the light source.
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.
PhysicalNoise
PhysicalNoise is a simple lens shader that simulates film grain or sampling noise at render-time.
May 10 2009
PhysicalCamera
This lens shader is designed to be physically accurate and mimics a DSLR camera’s exposure settings. For simplicity’s sake I modeled the settings after the popular and beginner-friendly Nikon D40.
PhysicalCamera bases its exposure calculations on these real-world camera units:
The shader offers useful presets for each individual setting and also combined presets for various lighting situations such as sunlight, overcast skies, tungsten etc. as you might know them from your DSLR camera.
Anyone familiar with photographic cameras will find PhysicalCamera intuitive to use.
Moreover, PhysicalCamera features basic color correction settings and simulates various photographic effects including vignetting, chromatic aberration and film grain for added realism.
Usage
This shader can be used as a basic tone mapping operator and to properly expose an image as you would with a real DSLR camera.
PhysicalCamera is designed for best results when used in combination with PhysicalLight and PhysicalMaterial.
May 1 2009
PhysicalLight
This advanced light shader is designed to be physically accurate in its base configuration but can be easily modified for artistic effect.
PhysicalLight is meant to work with PhysicalCamera — simply set the lens shader to a realistic photographic exposure and your PhysicalLights will render as you would expect realistic lights within the scale of your scene.
Unlike most light shaders in biased rendering engines, PhysicalLight does not take arbitrary input values: Instead, you can enter (or choose from a useful range of presets) your light’s color temperature and luminance in watts, which actually correlates to real world values. The shader supports area lights, soft shadows and IES profiles for even more realistic effects.
PhysicalLight was modeled after Maxwell’s light model to ensure the utmost physical accuracy while at the same time providing quick render times.
Usage
PhysicalLight can be used to realistically simulate artificial light sources such as electric bulbs, candle flames and fluorescent tubes.
May 1 2009
PhysicalMaterial
PhysicalMaterial is designed to accurately simulate real-world materials in a realistic and efficient shading model.
This mental ray shader is based on Maxwell’s material system and offers very few options compared to mental ray’s architectural materials by exposing only the most necessary shading parameters and internally adjusting others automatically in order to maintain physically plausible values:
- Reflection 0
- Reflection 90
- Index of refraction
- Roughness
- Bump
But even with these few options it is possible to create just about any (hard) surface material you could imagine, thanks to the shader’s built-in layering system. And since the shader is energy conserving it is really simple to create photorealistic shading, especially when used in combination with my PhysicalLight.
Of course it is also possible to get “under the hood” and tweak advanced features such as Final Gather contribution and ambient occlusion, but the shader is designed to let you ignore those for the most part… the presets pretty much simulate the material they say they will without much ado.
The shader features specular highlights based on Lafortune’s model, glossy reflections and an integrated layering system that lets you create iridescent coatings and advanced effects such as greasy specular highlights.
Usage
PhysicalMaterial is best suited for metals, plastics, car paint, clay, wood, stone… basically any type of hard material. The shader comes with a number of presets that simulate real world materials for quick setup in architectural renders.
April 22 2009
PhysicalSkylight
The look and some effects of the expensive Final Gather technique can be simulated with this light shader. PhysicalSkylight uses an HDRI environment map to light the scene and renders fast ambient occlusion shadows from the direction of the light source.
To accurately simulate a final gather look it is necessary to pre-filter the environment map in an external program using a technique called spherical harmonics.
Unlike true final gather, this technique does not introduce unwanted flicker in animation sequences, but it also does not handle secondary bounces.
Usage
This light shader is best suited for outdoor environments such as overcast daylight on a cloudy day. It is not intended for interior renders but may be used for directional ambient occlusion.
PhysicalSkylight can also be used to bring out small details in a scene without creating the dirty look of a multiplied occlusion pass.
April 22 2009
PhysicalTones
PhysicalTones is a true tone mapping operator for mental ray. As you can see from the samples, tone mapping can be used for various effects — realistic and artistic.
But the mia_exposure nodes already do tone mapping, you might say! Well… not exactly. Not in the true sense of the word, anyway.
What they do is in reality just glorified
gamma correction which works on individual pixels.
Tone mapping on the other hand is specifically designed to bring
high dynamic range (HDR) images into a more limited dynamic range and works with individual pixels as well as spatial sampling depending on the algorithm used.
Usage
Tone-mapping is the process of bringing high dynamic range images into a range more suitable for display on ordinary computer monitors.
PhysicalTones can be used in combination or as a replacement for mia_exposure_photographic, mia_exposure_simple and PhysicalCamera. The shader often does a better job at limiting the dynamic range or can be used to achieve the trendy HDR photo look.
February 2 2009
PhysicalNoise
PhysicalNoise is a simple lens shader for mental ray that simulates film grain or sampling noise at render-time.
The shader has options to control the grain size and strength for the individual RGB channels and to simulate either film grain or sampling noise.
Usage
Any analog or digital camera produces (more or less subtle) grain which, when applied to CG imagery, can lead to more photorealistic results.
Another usage is when comparing the output of mental ray to quick Maxwellrenders, a little extra noise makes it easier to spot the other differences between the two results.