View shader on Shadertoy - Published on 2018-04-30
This shader uses Image Based Lighting (IBL) to render an old watch. The materials of the objects have physically-based properties.
A material is defined by its albedo and roughness value and it can be a metal or a non-metal.
I have used the IBL technique as explained in the article 'Real Shading in Unreal Engine 4' by Brian Karis of Epic Games.[1] According to this article, the lighting of a material is the sum of two components:
- Diffuse: a look-up (using the normal vector) in a pre-computed environment map.
- Specular: a look-up (based on the reflection vector and the roughness of the material) in a pre-computed environment map, combined with a look-up in a pre-calculated BRDF integration map (Buf B).
Note that I do NOT (pre)compute the environment maps needed in this shader. Instead, I use (the lod levels of) a Shadertoy cubemap that I have remapped using a random function to get something HDR-ish. This is not correct and not how it is described in the article, but I think that for this scene the result is good enough.
I made a shader that renders this same scene using a simple path tracer. You can compare the result here:
https://www.shadertoy.com/view/MlyyzW
[1] http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
Source: Common.glsl
Source: Buffer A.glsl
- iChannel0: Buffer A (linear, clamp, vflipped)
- iChannel1: texture (mipmap, repeat, vflipped)
- iChannel2: texture (mipmap, repeat, vflipped)
Source: Buffer B.glsl
- iChannel0: Buffer B (linear, clamp, vflipped)
Source: Image.glsl
- iChannel0: cubemap (mipmap, repeat, vflipped)
- iChannel1: texture (mipmap, repeat, vflipped)
- iChannel2: Buffer A (linear, clamp, vflipped)
- iChannel3: Buffer B (linear, clamp, vflipped)
- Old watch (IBL) on Shadertoy
- An overview of all my shaders
- My public profile on Shadertoy
- http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.