I already talked about these two categories in the post Adopting a Physically based shading model
(https://seblagarde.wordpress.com/2011/08/02/hello-world/).
Feeding a physically based shadingmodel Dielectric materials are the most common materials. Their optical properties rarely vary much over the visible spectrum: water, glass,
skin, wood, hair, leather, plastic, stone, concrete, ruby, diamond
Metals. Their optical properties vary over the visible spectrum: iron, aluminium, copper, gold, cobalt, nickel, silver
See [8].
AUGUST 17, 2011 34 COMMENTS (HTTPS://SEBLAGARDE.WORDPRESS.COM/2011/08/17/FEEDING-A-PHYSICAL-
BASED-LIGHTING-MODE/#COMMENTS)
Disclaimer : All the numerical values provided are in linear space. And lighting processing inside the shader must be in linear space. For a practical sample, take the index of refraction of water (1.33) and put it inside the equation:
The Fresnel equation needs to be evaluated for each available spectral sample of complex refractive index over the visible portion
of the spectrum. This will result in a spectral reflectance with multiple samples. Each spectral reflectance sample then needs to be
Specular color
multiplied with the CIE X, Y and Z color-matching functions as well as the spectral power distribution of the appropriate
illuminant (most likely D65). The resulting curves must be integrated and normalized (with normalization constants set such that
the illuminant would have a Y value of 100).
Finally, a matrix transform should be used to convert the XYZ values into RGB values with the appropriate primaries (most likely
Specular texture is rather simple and not time-consuming. the sRGB/Rec.709 primaries). Gamut mapping of some kind may be needed if any of the RGB values are out of gamut [9].
With classic game lighting model specular texture is high-resolution RGB and specular power is a constant value for the whole Fortunately, I wrote a little program at home to do this.
material. For advanced material, a specular power texture is authored. With physically based shading model, artists must switch You can get this program with source code here SL-GetSpecularColor (https://seblagarde.files.wordpress.com/2011/08/sl-
their mind. Specular texture is now rather constant and gloss is high-resolution monochrome. For advanced materials, a high- getspecularcolor.pdf) (WordPress doesnt handle zip file, so right click then save target. Then rename extension to .zip. Code
resolution specular texture can be authored [1]. doesnt handle error and program require VS2008 runtime).
Usage is really simple: SL-GetSpecularColor.exe XXX.txt and you will get a linear color between 0 and 1.
A great advantage of PBR is that we can (and should) use real world material index of refraction to specify the specular albedo. XXX.txt is a file with spectral distribution of complex refractive indices.
Index of refraction will allow to define the characteristic specular reflectance of the material which is the value of Fresnel reflectance Only files downloaded from http://www.filmetrics.com/refractive-index-database (http://www.filmetrics.com/refractive-index-
at 0 (reflectance at normal incidence) : [1]. The term is what we call specular color for our physically based shading database) are working for now. If you improve the program with other sources, tell me.
model.
Using the program above gives you the linear RGB specular color. Here are some values I gathered:
As you can expect, you wont spend your time finding all the refractive indices of metallic material. Especially since values are for Encoding/Decoding normal. Like for compress/decompress data, the exact reverse of algorithm use to encode the normal should
pure laboratory material. But these specular colors can be used as references. Moreover, we can see that specular colors for metallic be used for decode it. I know of two engines doing this the right way:
objects are close to what we think the color of the metal is. The basic rule for metal is to setup a value above 0.5. Crytek with the help of polybump [12].
Naughty Dog with Uncharted 2. Naughty Dog wrote a plugin for XNormal[14] which allows to generate normal map with their
We store specular color as sRGB DXT1 low resolution and reference are only provided in sRGB color space which: encoding method [15]. Naughty Dogs plugin is based on the awesome thesis of Morten Mikkelsen [13].
Generate most of the normal map from high and low resolution objects (Really time-consuming) [16].
Avoids artists to deal with sRGB/RGB mismatch. Use a 16bit floating point normal map pipeline [17].
Allows more precision with low specular color. Always normalize normal map after modification.
Allows artist to work with not completely dark colors (for dielectric material). Generate normal map in the texture coordinate convention of the engine.
We provide a reference specular chart to the artists which looks like the image below (intentionally blurred and reduced): Gloss map:
From my point of view, the most difficult texture to author is the gloss map.
Reasons are:
No tutorial on the web about this texture (at least created for a physically based shading model).
Specular power range deduced from gloss values is completely dependent of your engine.
Values are numerical, neither color nor vector.
The gloss map is closely tied to the normal map. Ideally, gloss map should be generated in the same way as the normal map. It mean
it should be authored under sculpting tools like MudBox or ZBrush. Indeed, bumping in the normal map should be translated by
higher roughness in the gloss map (low gloss means high roughness).
However, new knowledge takes time to master and we still author gloss map by hand in Photoshop. The gloss map encoding (non-
linear) and specular power range (2-2048) we chose allow a perceptual linear distribution. Details like scratches, pores, grooves
(https://seblagarde.files.wordpress.com/2011/08/specularchart.png) can be added even without being in normal map.
Edit: The specular chart is now available at this link Dontnod specular and glosiness chart (https://seblagarde.wordpress.com Artists need to test the response of the lighting inside the engine more frequently than for other textures. To help them we provide a
/2012/04/30/dontnod-specular-and-glossiness-chart/). chart which maps some linear monochrome glossiness values (0-255 under Photoshop) to a screenshot of a cubemap blur level.
Added note:
With normalized lighting model without Fresnel effect like you can choose specular color between and
white, as suggested in [8].
You may notice that we dont use any specular mask texture. Specular texture is no more a scale of specular response. In real world,
everything is shiny [3] and this is roughness (low gloss) and low specular color which will allow to mimic matte material. (https://seblagarde.files.wordpress.com/2011/08
However the specular response in fine cavities can be too strong with our lighting model because of Fresnel effect. [1] suggests two /roughnesschart.png)
way to solve this:
This chart is highly engine specific.
Use an ambient occlusion texture to apply on specular term.
We store normal map and gloss map in DXT5 high-resolution which:
Modify the Schlick approximation in a similar way as Schler in [20]:
. Allows to force artists to use same resolution for normal map and gloss map.
Allows better mipmaping (see added note) because we can retrieve which gloss map is linked to which normal map.
For the Schler case, the assumption is that no real value of specular can be below 0.02. When a value below 0.02 is set in the
Allows not to apply a second non linear encoding on the non linear gloss value. We store gloss in linear in the alpha channel.
specular texture, the maximum reached by Fresnel term is below 1.
The drawback of this method is to require a high-resolution specular texture. Added note:
In both cases the texture budget increases and we chose to go with these artifacts.
Mipmapping of normal map and gloss map are active research topics. The fact that a gloss map, encoded in a non linear way, results
in a wrong filtered value is not the main problem. When generating mipmap for both map, the variation in normal should be used to
modify the value of the gloss map. This allow to conserve the specular shape with the distance, reduce specular aliasing and reduce
Normal and gloss texture thrashing. For more details see these interesting posts by Stephen Hill [11] and Marc Olano [18]. Dan Baker gave a great talk
on this topic at GDC 2011 [20] . Dimitar Lazarov at siggraph 2011 provide must-read slides [31] and describe step for generating gloss
mip for their lighting model.
Reference (http://advances.realtimerendering.com/s2011/Lazarov-Physically-Based-Lighting-in-Black-Ops%20
%28Siggraph%202011%20Advances%20in%20Real-Time%20Rendering%20Course%29.pptx)
[1] Hoffman, Crafting Physically Motivated Shading Models for Game Development and Background: Physically-Based Shading FILED UNDER USE "ALL POSTS AND RECENT UPDATES" IN THE MENU TO NATIGATE THIS BLOG TAGGED WITH
http://renderwonk.com/publications/s2010-shading-course/ (http://renderwonk.com/publications/s2010-shading-course/) GRAPHIC, LIGHTING, PHYSICALLY BASED, PHYSICALLY BASED RENDERING, RENDERING, SHADING, SPECTRAL,
[2] http://www.robinwood.com/Catalog/Technical/Gen3DTuts/Gen3DPages/RefractionIndexList.html SPECULAR, USE "ALL POSTS AND RECENT UPDATES" IN THE MENU TO NATIGATE THIS BLOG
(http://www.robinwood.com/Catalog/Technical/Gen3DTuts/Gen3DPages/RefractionIndexList.html)
[3] Hable, http://filmicgames.com/archives/547 (http://filmicgames.com/archives/547)
[4] Epic game, UDK documentation http://udn.epicgames.com/Three/TexturingGuidelines.html (http://udn.epicgames.com
/Three/TexturingGuidelines.html) 34 Responses to Feeding a physically based shadingmodel
[5] Photoshop CS3 Color Settings http://www.computer-darkroom.com/ps10_colour/ps10_1.htm (http://www.computer-
darkroom.com/ps10_colour/ps10_1.htm)
[6] LCD monitor test images http://www.lagom.nl/lcd-test/ (http://www.lagom.nl/lcd-test/) Pingback: The Blinn-Phong Normalization Zoo | The Tenth Planet
[7] Adelson, Checker-shadow illusion http://www.michaelbach.de/ot/lum_adelsonCheckShadow/
Pingback: Confluence: Programming
(http://www.michaelbach.de/ot/lum_adelsonCheckShadow/)
[8] Akenine-Mller, Haines, Hoffman, Real-Time Rendering 3rd Edition http://www.realtimerendering.com
Pingback: Readings on physically based rendering | Light is beautiful
(http://www.realtimerendering.com)
[9] Personal communication with Naty Hoffman Pingback: Confluence: Development
[10] dEon, Luebke, Advanced Techniques for Realistic Real-Time Skin Rendering http://http.developer.nvidia.com/GPUGems3
/gpugems3_ch14.html (http://http.developer.nvidia.com/GPUGems3/gpugems3_ch14.html) Pingback: Confluence: Art
[11] Hill, Specular Showdown in the Wild West http://blog.selfshadow.com/2011/07/22/specular-showdown/
(http://blog.selfshadow.com/2011/07/22/specular-showdown/) Pingback: Confluence: Frostbite Development
[12] Crytek, http://crytek.com/cryengine/cryengine2/overview (http://crytek.com/cryengine/cryengine2/overview)
SteveM says:
[13] S. Mikkelsen, Simulation of Wrinkled Surfaces Revisited http://image.diku.dk/projects/media/morten.mikkelsen.08.pdf
May 15, 2013 at 4:52 pm
(http://image.diku.dk/projects/media/morten.mikkelsen.08.pdf)
Seb, just wanted to say a giant THANK YOU for these articles! Youve changed my life! Yours are the clearest and most
[14] XNormal, http://www.xnormal.net/1.aspx (http://www.xnormal.net/1.aspx)
straightforward articles on PBR to this day. The simple concept of dielectrics and metals represented by the same spec map was
[15] Diamant, Simantov, Character Pipeline: An In-depth Look at the Creation of U2s Characters http://www.slideshare.net
eyeopening. Ive been using essentially your lighting model at our company for over a year now, and it has completely
/naughty_dog/uncharted-2-character-pipeline (http://www.slideshare.net/naughty_dog/uncharted-2-character-pipeline)
revolutionized our art creation. We can create art faster, more correctly and effectively, and the results are much more visually
[16] Pangilinan, Ruppel, Uncharted 2 art direction http://www.slideshare.net/naughty_dog/gdc-final-sliced
interesting, run faster (less draw calls), fits great with deferred rendering, just all around goodness!
(http://www.slideshare.net/naughty_dog/gdc-final-sliced)
[17] Kaplanyan, CryENGINE 3: Reaching the Speed of Light http://advances.realtimerendering.com/s2010/Kaplanyan-
I know everybodys doing this nowadays, but I think you deserve credit for putting out such clear articles before most everyone
CryEngine3(SIGGRAPH%202010%20Advanced%20RealTime%20Rendering%20Course).pdf
else.
(http://advances.realtimerendering.com/s2010/Kaplanyan-
CryEngine3%28SIGGRAPH%202010%20Advanced%20RealTime%20Rendering%20Course%29.pdf) Thanks!
[18] Olano, Shiny and CLEAN http://gaim.umbc.edu/2011/07/24/shiny-and-clean/ (http://gaim.umbc.edu/2011/07
/24/shiny-and-clean/) Reply
[19] Olano, On Error http://gaim.umbc.edu/2011/07/26/on-error/ (http://gaim.umbc.edu/2011/07/26/on-error/) seblagarde says:
[20] Baker, Spectacular Specular -LEAN and CLEAN specular highlights http://www.google.fr/url?sa=t&source=web&cd=2& May 15, 2013 at 9:23 pm
ved=0CCIQFjAB&url=http%3A%2F%2Fwww.gdcvault.com%2Fplay%2F1014558%2FSpectacular-Specular-LEAN-and-CLEAN& Your are welcome.
ei=XpVETpDoJoPm-gbrqdyTBw&usg=AFQjCNGC26_xSlrstEqFYHIbLuEAhqU8vg (http://www.google.fr/url?sa=t&source=web&
cd=2&ved=0CCIQFjAB&url=http%3A%2F%2Fwww.gdcvault.com%2Fplay%2F1014558%2FSpectacular-Specular-LEAN-and- The credit come mainly to Naty Hoffman as this is his lighting model which come from his Siggraph 2010 talk.
CLEAN&ei=XpVETpDoJoPm-gbrqdyTBw&usg=AFQjCNGC26_xSlrstEqFYHIbLuEAhqU8vg) Yoshiharu Gotanda (TriAce) and Christian Schler also put a lot of effort in this topics well before me. By the way I
[21] http://www.luxpop.com/ (http://www.luxpop.com/) recommend the very understandable FMX 2013 slides of Christian on his blog on the PBR subject for artist:
[22] Hable, Linear-Space Lighting (i.e. Gamma) http://filmicgames.com/archives/299 (http://filmicgames.com/archives/299) http://www.thetenthplanet.de/archives/3684
[23] Schler, An efficient and Physically Plausible Real Time Shading Model Shader X7 book
Cheers
[24] Labounta, Art Direction Tools for Photo Real Games Unavailable on gdcvault, sum up here http://stachmo.wordpress.com
/2011/03/12/the-epic-gdc11-adventure-day-5/ (http://stachmo.wordpress.com/2011/03/12/the-epic-gdc11-adventure-day-5/)
Reply
[25] The Diffuse Texture and Seamless Textures http://robertokoci.com/diffuse-texture/ (http://robertokoci.com/diffuse- Pingback: Confluence: Substance Designer
texture/)
[26] Crazybump http://www.crazybump.com/ (http://www.crazybump.com/) Pingback: Confluence: Substance Designer
[27] Epic game, UDK documentation http://udn.epicgames.com/Three/TakingBetterPhotosForTextures.html
(http://udn.epicgames.com/Three/TakingBetterPhotosForTextures.html) Pingback: Confluence: WoT Development
[28] Wikipedia http://en.wikipedia.org/wiki/Albedo (http://en.wikipedia.org/wiki/Albedo)
[29] Ferguson, Iterating Realistic Human Rendering: Boxers in FIGHT NIGHT GDC 2011 Pingback: Confluence: Art
[30] http://www.xrite.com/home.aspx (http://www.xrite.com/home.aspx)
[31] Lazarov, Physically Based Lighting in Call of Duty: Black Ops http://advances.realtimerendering.com/s2011/Lazarov- Pingback: Confluence: Substance Painter
Physically-Based-Lighting-in-Black-Ops%20(Siggraph%202011%20Advances%20in%20Real-Time%20Rendering%20Course).pptx Pingback: Confluence: Substance Painter
(http://advances.realtimerendering.com/s2011/Lazarov-Physically-Based-Lighting-in-Black-Ops%20
%28Siggraph%202011%20Advances%20in%20Real-Time%20Rendering%20Course%29.pptx)
What do you think about that? I give more details about the albedo stuff here: http://www.fxguide.com/featured/game-environments-parta-remember-me-
rendering/
Reply
And yes, the method use a photograph with a macBeth chart under overcast sky only (take care that there is always some
seblagarde says:
specular into the mix, even with a polorizer filter). The paper you reference do the same thing, except they use the know
March 17, 2014 at 1:52 pm
albedo they measure of a white A4 paper instead of using a macBeth chart (Which have a lot more know albedo values). Still
Hey,
capture the real albedo is a difficult process, but for game we tolerate the error.
Warning, I assume you have black diffuse albedo for metal and F0 define the color of the metal.
You will also be interested by this paper: http://blog.selfshadow.com/publications/s2012-shading-course/mcauley
/s2012_pbs_farcry3_notes_v2.pdf
1. Grayscale for albedo is a bit strange. Are you doing a monochrome game ?
they describe a plugin for photoshop to do the automatic conversion. Still implementation is not simple and I would love they
It make sense to store luminance only then chrominance at lower resolution but using only grey level will just give you a
black and white game. have share their tools This is a bit different from the technique I describe in the FX guide article (which is not mine but the
one of Henry Labounta), which require a manual calibration which respect the tone of the different matter and require artistic
2. Will work for several mocnochrome metal (silver, aluminium, iron ). Will fail with colored metal like gold (again skills (I am not the one doing this, this was the art director).
monochrome game ?). I would simply apply no fresnel on metal on mobile like purpose some offline renderer (VRay).
Another interesting tools is lightbrush: http://www.twitterbuttons.biz/stats/lightbrush.com. Which actually use a technique
But I think my answers dont fit your questions because I think you dont use a BRDF like I describe it: diffuseAlbedo / PI + reverse to this one. i.e use shadowed picture instead of unshadowed. But I have never done in-depth comparison of the result.
Fresnel(F0, LdotV) * normalization_factor * (N.H)^specPower
Keep in mind that whatever the technic you chose, the most difficult part is to take accurate picture, then you need to find the
I have never done mobile dev by the way, if you want more information on PBR on mobile, take a look at the future GDC time to process all these textures.
session on mobile dev: http://schedule.gdconf.com/session-id/826422
Reply
hope thats help Atomof says:
August 18, 2014 at 1:39 pm
Cheers Thank you very much for these links and your time. I think the last link is wrong however.
But exact calulation is more complex, here is an excel formula that you can copy past:
=255*IF(D10<=0,0031308;D10*12,92;(POWER(ABS(D10);1/2,4)*1,055)-0,055)"
replace the D10 by the cell you want to convert
Reply
vanessa says:
December 1, 2014 at 7:13 pm
hi, you can also try this tool to calibrate your albedo textures
https://colortarget.wordpress.com/
Reply
Pingback: Simple PBR Shader for Blender 2.72 Cycles |
Pingback: Things in Unity That Are a Bit Rubbish (and How to Fix Them) | Sc0tt Games .com
Its awesome article with proper refrance.. its realy helpfull to learn more about shading and rendering.
Reply
Pingback: Screen Space Glossy Reflections | Roar11.com
Blog at WordPress.com.
11 de 11 26/7/17 17:48