Home Technical Talk

[PBR] Physically Based Rendering Bible

124

Replies

  • Joopson
    Offline / Send Message
    Joopson Polycount Sponsor
    cman2k, maybe try bringing it into Photoshop, and resaving it?
  • NicolasW
    Offline / Send Message
    NicolasW polycounter lvl 9
    cman2k wrote: »
    I tried this actually...does it only apply after a restart or something? I'll try again today.

    edit; even with the sample table size set to 256, and a restart, I'm still getting the artifacts. It may be worth noting that while both the physically_based and physically_based_specular_glossiness shaders get the artifacts, they look slightly different. Also I used the linear textures and disabled post-processing.

    Thanks for the assets!
    Indeed, the amount of sample does not change much, it looks like the artefact are more visible around the sphere poles. We are working on pre-filtering the env map but we'll take a look at this anyway (can't exclude their is a bug somewhere).

    FYI the metallic and specular shader are 99% the same, they just don't take the same inputs, internally the brdf is the same.
    And no need to restart SD for the sample amount change to apply.
  • EarthQuake
    marks wrote: »
    That metalness 1 roughness 1 corner in marmoset GGX looks kinda sketchy...

    Yeah, we're looking into improving the gloss curve for 2.06, should be able to fix it.
  • marks
    Offline / Send Message
    marks greentooth
    EarthQuake wrote: »
    Yeah, we're looking into improving the gloss curve for 2.06, should be able to fix it.

    I think there's an argument to be made for linear lookup with gloss rather than a curve - I believe that's also what CryEngine does. Having a steep gloss curve at the top of your histogram can be a *nightmare* if you have a lot of glossy materials let me tell you, it's compression artifact hell.
  • EarthQuake
    Well, a big concern is getting it matched up to UE4, so its easy to use Toolbag to preview before importing into the engine. But I would also be curious to see what Crytek looks like.
  • 3py0n
    Offline / Send Message
    3py0n polycounter lvl 6
    Got around to updating the doc some more :) It's near official release lol. So-to-speak.

    Just got a handful of more information to add on. Lots of stuff to sift through unfortunately :(

    Hope everyone is finding it useful.
  • Mr Whippy
    Offline / Send Message
    Mr Whippy polycounter lvl 7
    Metalness seems a weird name for the axis given how metalness maps work here.

    "Metalness" isn't a physical property, it's a form of optimisation based on IOR ranges and using albedo maps for metal data rather than a separate IOR colour map.

    It'd make more sense to have IOR or perpendicular reflectivity, vs roughness.

    Mis-using the word 'metalness' is exactly why I needed to ask for clarification on it here so I think it'd be sensible to say exactly what that axis represents, rather than using terminology that confuses.
    For example, we can go from say 0.035 > 0.06 value and not have anything to do with "metalness" on a gamma-space IOR map with values ranging from 30 > 70 or so srgb.




    Also it's interesting to see different approaches to the gloss value vs LUT input value.
    It looks like Disney essentially use a 'gamma' type curve to push the apparent glossiness output into a perceptively linear space, rather than a linear input which can feel very sensitive low down and not make much difference high up the LUT range.

    You can see the effect of that in those images above where the Marmoset range looks very rough then suddenly gets mid-gloss, while the UE4 version seems to have a nicer spread in the rougher range.

    Does UE4 use a different gloss scale? It looks nicer at least.

    Dave
  • Mr Whippy
    Offline / Send Message
    Mr Whippy polycounter lvl 7
    Also is it worth noting in the sciency/technical part of the wiki about how we derive IOR/perp reflectivity values?

    I was certain it was (1-ior)sq/(1+ior).sq = perp reflectivity factor

    I'll let someone re-arrange that to get IOR from perp refl factor :D
  • DEDE_pig
    Offline / Send Message
    DEDE_pig polycounter lvl 7
    Hi,

    I actually have a question regarding the color of the gloss.

    What I learnt in the diffuse/spec/gloss texturing, the darker the gloss map the sharper the reflection will be.

    But I noticed from the bible and try it out on Ddo, why is gloss map logic being inverted into white being the sharpest ?

    Is there a reason for it ?
  • ConSeannery
    I hope my question hasn't already been answered in this thread, but I didn't have the time to read through the entire thread.

    I can't get my head around why I am supposed to treat e.g. a metal with a clear coat (like car paint) as dielectric. All the light that passes through the clear coat will hit the metal and will thus be reflected in a metallic way, right? Where is my misconception here?
    I always thought such a material would require a more complex material layering system.

    Thanks a lot for clarifying!

    ConSeannery
  • rube
    Offline / Send Message
    rube polycounter lvl 14
    You never really see the metal on a painted part of a car.. under the clear coat is the coloured paint. and under that still is a primer.

    Oh, now I think you just used clear coat as an example, not an actual car with paint and then a clear coat on top.. and for that I'm not really sure. My guess would that since the actual surface would be dielectric then it's closer to used that as your base for the shader.
  • almighty_gir
    Offline / Send Message
    almighty_gir sublime tool
    that's getting into a little more complex materials, in order to achieve a "physically correct" look, it should really be rendered in two stages/materials.

    ideally you'd want the top material to be your clearcoat. now i'm not sure what the actual refractive index is on clearcoat, but i'd estimate it's probably similar to water or glass and so it's very low (like around 0.02 or so).

    then you'd want to render anything underneath it. but you also need to bear in mind that 2% of the light hasn't actually reached this layer as it's been reflected by the top layer. you then need to take into account that the diffusion of light on this layer would be greater than normal, as when the light comes back out from the object it's then reflected back in by the top layer, thus making the reflectivity lower again.

    see how it starts getting complicated?

    as rube says: car paint is treated as dielectric because, even metallic paint isn't actually metal, unless it's like chrome plating or something. it's a layer of paint (dielectric) over the top of the car frame (metal), and because it's on top, the light never reaches the metal, so the renderer never needs to consider the object as metallic.
  • ConSeannery
    that's getting into a little more complex materials, in order to achieve a "physically correct" look, it should really be rendered in two stages/materials.

    ideally you'd want the top material to be your clearcoat. now i'm not sure what the actual refractive index is on clearcoat, but i'd estimate it's probably similar to water or glass and so it's very low (like around 0.02 or so).

    then you'd want to render anything underneath it. but you also need to bear in mind that 2% of the light hasn't actually reached this layer as it's been reflected by the top layer. you then need to take into account that the diffusion of light on this layer would be greater than normal, as when the light comes back out from the object it's then reflected back in by the top layer, thus making the reflectivity lower again.

    see how it starts getting complicated?

    as rube says: car paint is treated as dielectric because, even metallic paint isn't actually metal, unless it's like chrome plating or something. it's a layer of paint (dielectric) over the top of the car frame (metal), and because it's on top, the light never reaches the metal, so the renderer never needs to consider the object as metallic.

    rube, almighty_gir, thanks for chiming in! Metallic car paint with a clear coat was probably a bad example for what was confusing me.

    I'm also aware that a material which has something opaque like paint on top of metal is being treated as dieletric. That makes perfect sense.
    I just didn't know how things would work with e.g. a pure metal that has a clear coat on top of it. You have a medium glossy, highly reflective, metallic surface beneath a transparent, perfect glossy, low reflective, dielectric surface. I guess things get more complex here, as a glossiness/metallic/specular map can only assign a single value PER PIXEL. However, with the aforementioned material you would have to assign two different values per pixel. As almighty_gir already said, only a material layering system should be able to simulate such a material since two materials (each with their own set of texture maps) have to be evaluated separately and then blended.

    So in summary, most PBR system are good at handling different materials close to each other in materials maps, but not ON TOP of each other. Is that correct?

    Doesn't UE4 have such a material layering system?
  • marks
    Offline / Send Message
    marks greentooth
    marks wrote: »
    Well, this is all working on the assumption that you're using a single-layer material model, which I'm pretty certain *every* games PBR renderer is right now for your standard BRDFs.

    Yeah, in order to "correctly" render surfaces like that (clearcoat over metal) and other multi-layer materials, you need a multi-layer material model. I don't know of any games that have implemented something like this for their standard BRDF. You probably are going to be looking at using a special shader for this kind of thing.
  • EarthQuake
    While it would be nice to use a two layered setup for this, mainly so you can have a normal map for each layer, I don't think its entirely necessary.

    However, here is a quck and easy way to sort of hack it together in TB2 by using two meshes (one standard and one with an additive material on top): http://www.polycount.com/forum/showpost.php?p=1971591&postcount=500. A single material shader could be set up to do the same basic thing, but it would be a special purpose shader like Mark suggests above.

    Now specifically with a clear coat on bare metal, using a standard shader with the metalness workflow, this would still be tagged as metallic if you're using the metalness workflow. The light passes through the clear coat for the most part, though a small % reflects off of it, so you would make the reflectivity value a little lower than you otherwise would if it was totally bare.

    Where it gets tricky (and why its nice to have to two layers/normal maps) is that the gloss on top really smooths out the surface. So for that clear coat, the reflections are going to be very glossy. However, the layer below it will have the surface roughness of the bare metal, which depending on the material may be more rough than the clear coat.

    I can't really think of a specific material/object that would have a bare metal and a clear coat on top though, as mentioned above generally you would have metal, primer, paint and then a clear coat.

    13%20(45).JPG

    I suppose something like that ^, then you really want the layered material so you can have unique normal, gloss and reflectivity control for each layer.

    bugatti-veyron-pur-sang-1.jpg

    With this one though, the surface roughness varies much less with the bare metal and the clear coat, so you might be able to do it with a single layered material.
  • ConSeannery
    marks wrote: »
    Yeah, in order to "correctly" render surfaces like that (clearcoat over metal) and other multi-layer materials, you need a multi-layer material model. I don't know of any games that have implemented something like this for their standard BRDF. You probably are going to be looking at using a special shader for this kind of thing.

    I think there are quite a few materials where a layered system would be necessary. Essentially every material with truly distinct material layers and some kind of transparent (glossy or semi glossy) material on top is only really achievable with a material layering system. The bike and the car you posted are good examples, but I'm sure there are a lot more materials in particular when it comes to simulating special industrial materials. But I think even many everyday type materials have protective coatings or finishings even though they are visually less evident than in the examples you posted. If I look around in my room I have to say that probably most materials aren't very pure, but have some kind of thin transparent layer on top of them.

    Isn't even a semi glossy wooden floor a good example? It consists of very rough wood with a glossy finish on top of it. With a single material system we neglect the low glossiness of the wood, but instead only simulate the glossiness of the coating and the diffuse part of the wood. Of course we can easily get away with that as the lack of the low specular reflectivity and low gloss of wood is not something a viewer will necessarily notice.

    As another example, the developers of the offline renderer mental ray are currently developing a material layering system as a complete or partial substitute for their current shaders. I also just checked and confirmed that UE4 also has a similar material layering system. I think this is a good move, because IMO it is the logical way to think about many non-pure materials. Of course the challenge for the developers is that energy conservation is harder to achieve with complex material layers stacked on top of each other. In addition, rendering times will likely be higher which, in particular in a real-time environment, is a serious downside.
  • EarthQuake
    Yeah, in an ideal world you would have a two layer setup for laqured wood, however its pretty easy to get by with only representing the outer layer in the normal map and gloss, as the roughness of the base wood would give the specular highlight a dim appearance. Its harder to do that when the layer below is significantly more reflective, as is the case with bare metals.

    Most non-metals like plastics or painted materials with a clear coat can get by with simple variation in the gloss map though, as the clear coat would not be significantly more or less reflective than the base plastic/paint.

    This gets difficult to emulate with the metalness workflow however, as you have a fixed reflectance value of 4%. Lets say we have a plastic material that has a reflectance of 4%, then the clear coat itself is also reflecting 4%, but it lets the majority of the light through to hit the under surface, so total reflectivity is 7-8% or so. You would need an additive spec layer to pull it off correctly.

    On the other hand, if you have a full color specular/ior input, you can simply set the reflectance value directly. No way to set the two different gloss values though, so dual layers still wins.

    On the other, other hand, if both layers reflect 100% at the edges due to fresnel, then you're getting 200% reflection there which would be incorrect. Hmm, not sure if there is a good way to handle that.

    I'm not sure if the layering system in UE4 is really suitable though, I think that's more for blending from one layer to another, not having a clear layer on top of one below it. But I haven't used the layering system in UE4 so its possible that you can have an additive layer.
  • EarthQuake
    Ok, less words, more pictures.
    clearcoat01.jpg
    This is what I mean about the reflectance difference between a single layer mat and a double layer mat:
    1. base rough undercoat
    2. clear coat
    3. result of 1+2
    4. single layer material with diffuse content of 1 and gloss of 2

    #3 looks a bit better to me, and is certainly more realistic in terms of how a material with a clear coat actually behaves. However its not a massive difference, and when you get into actual game content where the player is running around and shooting people or whatever, this probably wouldn't be worth the expense for all but very special assets.

    Oh also, the above material can be created with a single mesh/material in Toolbag 2 as well, by using the secondary reflection function. However, you can't have a secondary normal map then, for that you need another material and a duplicated mesh (for now at least).
  • ConSeannery
    EarthQuake wrote: »
    This gets difficult to emulate with the metalness workflow however, as you have a fixed reflectance value of 4%. Lets say we have a plastic material that has a reflectance of 4%, then the clear coat itself is also reflecting 4%, but it lets the majority of the light through to hit the under surface, so total reflectivity is 7-8% or so. You would need an additive spec layer to pull it off correctly.

    I never fully understood why people say that with a metalness workflow the specular reflectance has to be hardcoded. For instance, I am working with the PBR Plugin Alloy for Unity which also employs a metalness workflow. It is based on Disney's Principled BRDF. However, you can still assign a monochrome specular map. That specular map however only maps to a specular reflactance range of 2%-8%, i.e. a black pixel maps to 2% whereas a white pixel maps to 8%. So there is no way to misuse the specular map to create physically implausible materials.
    The advantage of less memory consumption is also still there, because a monochrome texture is only 8 Bit and can thus be inserted into the channel of a composite bitmap.
    On the other, other hand, if both layers reflect 100% at the edges due to fresnel, then you're getting 200% reflection there which would be incorrect. Hmm, not sure if there is a good way to handle that.

    True, energy conservation is tougher to handle with a layering system. But this is something developers have to deal with, not the artist.
    I'm not sure if the layering system in UE4 is really suitable though, I think that's more for blending from one layer to another, not having a clear layer on top of one below it. But I haven't used the layering system in UE4 so its possible that you can have an additive layer.

    I'm not sure either. The documentation doesn't give much insight and I don't use UE4 so I have to way to check that at the moment. But you might be right in that UE4's layering system is only a more user-friendly way to blend materials.
  • EarthQuake
    I never fully understood why people say that with a metalness workflow the specular reflectance has to be hardcoded. For instance, I am working with the PBR Plugin Alloy for Unity which also employs a metalness workflow. It is based on Disney's Principled BRDF. However, you can still assign a monochrome specular map. That specular map however only maps to a specular reflactance range of 2%-8%, i.e. a black pixel maps to 2% whereas a white pixel maps to 8%. So there is no way to misuse the specular map to create physically implausible materials.
    The advantage of less memory consumption is also still there, because a monochrome texture is only 8 Bit and can thus be inserted into the channel of a composite bitmap.

    That's true, there is nothing stopping you from developing or using a shader based around the metalness approach that also has a reflectivity input for non-metals.

    However, you lose some of the optimization benefit (use twice as much vram), and now artists have 3 inputs (albedo, metalness, non-metal reflectivity) for reflectivity to author instead of two. But you still have the inherant drawbacks of the metalness system, like nasty artifacts when doing transitions from metal to non-metals.

    Personally. If I'm going to load a specular/reflectivity map anyway, I would much rather not use the metalness workflow at all. Its only a little more expensive to load a full color reflectivity map at that point, it gives you more control and its one less input to manage. This was the basic conclusion we can to with TB2 as well, you can use the simplified, optimized metalness workflow, or the flexible and precise full color spec workflow.

    Epic seems to have taken the opinion that the metalness with fixed reflectivity for non-metals is good enough for most things. Though they do allow you to load a map that multiplies on top of that reflectivity value for materials lower than 4% reflectance, the often misunderstood specular input.
  • ConSeannery
    EarthQuake wrote: »
    That's true, there is nothing stopping you from developing or using a shader based around the metalness approach that also has a reflectivity input for non-metals.

    However, you lose some of the optimization benefit (use twice as much vram), and now artists have 3 inputs (albedo, metalness, non-metal reflectivity) for reflectivity to author instead of two. But you still have the inherant drawbacks of the metalness system, like nasty artifacts when doing transitions from metal to non-metals.

    Personally. If I'm going to load a specular/reflectivity map anyway, I would much rather not use the metalness workflow at all. Its only a little more expensive to load a full color reflectivity map at that point, it gives you more control and its one less input to manage. This was the basic conclusion we can to with TB2 as well, you can use the simplified, optimized metalness workflow, or the flexible and precise full color spec workflow.

    Epic seems to have taken the opinion that the metalness with fixed reflectivity for non-metals is good enough for most things. Though they do allow you to load a map that multiplies on top of that reflectivity value for materials lower than 4% reflectance, the often misunderstood specular input.

    Yeah, I guess I would prefer the specular/IOR workflow, too.

    Just two more questions:

    - If you guys use a photographic texture as source for your material maps, would you derive the normal map with a normal map converter BEFORE removing all lighting information from the texture (to transform it into an albedo map)? Or would you use the albedo map as input for the normal map converter? I ask because I think that an albedo map might have too little contrast and not enough AO in order to yield a good normal map. Is that true?

    - Do you keep the micro occlusion/cavity map/short distance AO (or whatever else it is called) as a separate map and multiply it over the albedo and specular map in the shader? Or do you already multiply it with the albedo and specular map in Photoshop? I've seen people do both. Is one way better than the other?
    I always thought micro occlusion is the only type of AO you can safely bake into the albedo and specular map or leave it in the photo texture in case it was captured.

    Thanks :)
  • EarthQuake
    Yeah, I guess I would prefer the specular/IOR workflow, too.

    Just two more questions:

    - If you guys use a photographic texture as source for your material maps, would you derive the normal map with a normal map converter BEFORE removing all lighting information from the texture (to transform it into an albedo map)? Or would you use the albedo map as input for the normal map converter? I ask because I think that an albedo map might have too little contrast and not enough AO in order to yield a good normal map. Is that true?

    Do whatever gives you the best normal map. This will vary depending on a bunch of different factors, including what your source content looks like and what you're using to do the converter.
    - Do you keep the micro occlusion/cavity map/short distance AO (or whatever else it is called) as a separate map and multiply it over the albedo and specular map in the shader? Or do you already multiply it with the albedo and specular map in Photoshop? I've seen people do both. Is one way better than the other?
    I always thought micro occlusion is the only type of AO you can safely bake into the albedo and specular map or leave it in the photo texture in case it was captured.

    Thanks :)

    If you're using a full color spec map, you can multiply a cavity map on the diffuse and spec, there isn't much difference using another map except more control in the shader.

    If you're using the metalness workflow, its better to have a separate map, as you don't have a specular map for non-metals to multiply the cavity on.
  • ConSeannery
    EarthQuake wrote: »
    Do whatever gives you the best normal map. This will vary depending on a bunch of different factors, including what your source content looks like and what you're using to do the converter.

    If you're using a full color spec map, you can multiply a cavity map on the diffuse and spec, there isn't much difference using another map except more control in the shader.

    If you're using the metalness workflow, its better to have a separate map, as you don't have a specular map for non-metals to multiply the cavity on.

    You know your stuff :) Thanks a lot, EQ!
  • JasonHeckmen
    Offline / Send Message
    JasonHeckmen polycounter lvl 4
    This thread is doing God's work. Great stuff!
  • 3py0n
    Offline / Send Message
    3py0n polycounter lvl 6
    hey guys,

    Sorry for the lack of updates. I've been busy with my project and I'm employing what I've learnt from compiling this doc. However I had a few questions that I don't recall me finding an answer to.

    Here's the scenario, I'm using UE4 in order to practice this engine and have experience with it. There are all the slots you'd expect, base colour, spec, metallic, etc. My question is this.

    In general, is one workflow (metallic VS spec) easier than the other?
    In the case of UE4, is one workflow easier than the other? And/or does one produce more realistic (hopefully better looking as well) results than the other?

    I don't have much knowledge/experience with UE4, just what I learnt so far.

    Also, am I correct in stating this in my doc:

    2 Most Common Workflows
    1. Albedo, Specular/Reflection, Roughness/Gloss, Normals, anything else (i.e. detail normals, separate AO/cavity, etc depending on need and shader)
    2. Albedo/Specular in 1 map, Metalness, Roughness/Gloss, Normals, anything else like #1


    Hoping someone can help me out here :) Having knowledge of this stuff isn't the same as having experience lol
  • 3py0n
    Offline / Send Message
    3py0n polycounter lvl 6
  • Fnitrox
    Offline / Send Message
    Fnitrox polycounter lvl 6
    Unreal's documentation suggests to leave the Specular at the default value of 0.5 and only modify metalness/roughness.

    My usual setup for non translucent material is:
    Texture 1: Albedo + alpha if needed
    Texture 2: Roughness in R, Metalness in G, Occlusion in B
    Texture 3: Normal + displacement if needed

    For translucent i usually add one more texture or just use the alpha from Texture 2 for the opacity slot (which controls the "depth" of the material). Usually for simple objects it's good enough to just use a constant for the opacity slot.
  • cartermrobbinson
    Great resource. Nice to have a manual for PBR, all in once place.
  • CreativeSheep
    Offline / Send Message
    CreativeSheep polycounter lvl 5
    What color space must you work in if you don't want to work with sRGB values and rather linear ?

    For example, you are working on an Albedo map you create this map strictly in linear values, what color space must you use ? I understand some maps can be linear, others sRGB but I think you could cause a hiccup, rather then working with all maps strictly in linear.  

    I don't understand the term; one should use real world material index of refraction to specify the specular albedo ?
  • EarthQuake
    What color space must you work in if you don't want to work with sRGB values and rather linear ?

    For example, you are working on an Albedo map you create this map strictly in linear values, what color space must you use ? I understand some maps can be linear, others sRGB but I think you could cause a hiccup, rather then working with all maps strictly in linear.  

    I don't understand the term; one should use real world material index of refraction to specify the specular albedo ?
    There is very little reason to author Albedo maps in linear space. Doing so is just going to be a pain in the ass. As a rule of thumb, maps which are perceptive like albedo and specular should simply be authored in sRGB space. Trying to work in linear space in a perceptive way means you're fighting against your monitor, as all monitors use sRGB color space.

    Your game engine can handle inputs in linear or sRGB. There's some bad information out there that suggests that linear renders (which is pretty much all renderers / game engines these days) need linear inputs, but this is not at all true. 

    As to your last question, I'm not sure of the context or specifically which part you're confused by?
  • CreativeSheep
    Offline / Send Message
    CreativeSheep polycounter lvl 5

    As to your last question, I'm not sure of the context or specifically which part you're confused by?
    I quoted either that statement from the PBR Guide or the PBR Encyclopedia; one is going to have to search that exact sentence in either documentation to relate as to my question.
    From what I see with PBR rendering is, depending how realistic one wants to get, they should understand the real world material and how it is effecting by any time of natural or un-natural elements.  It's not so much as to say, I want a brick wall; rather, what is the brick wall surface history and that is what the texture artist needs to know, especially if realism is the goal or close to it.

    For all other cases, a standard PBR material will suffice. 

    You mentioned your game engine can accept linear or sRGB images; although other rendering engines only accept linear images. Otherwise if I use sRGB, as you know; in a rendering engine which is set for linear images, I'll run into problems.  
  • EarthQuake
    @CreativeSheep

    "From what I see with PBR rendering is, depending how realistic one wants to get, they should understand the real world material and how it is effecting by any time of natural or un-natural elements.  It's not so much as to say, I want a brick wall; rather, what is the brick wall surface history and that is what the texture artist needs to know, especially if realism is the goal or close to it."

    Well, if you want to reproduce materials faithfully, you need to research and understand the materials. This applies with PBR workflows, it applies to learning anatomy, it applies to pretty much every aspect of art and really, doing anything well in life requires the same sort of approach. So yes, you should try to understand what you're doing at every step.

    "You mentioned your game engine can accept linear or sRGB images; although other rendering engines only accept linear images. Otherwise if I use sRGB, as you know; in a rendering engine which is set for linear images, I'll run into problems."

    Pretty much every game engine or offline renderer has the ability to accept sRGB or linear space texture inputs. Generally this can be found in the texture's properties somewhere. Can you give me an example of a renderer that only takes linear inputs?
  • Eric Chadwick
    Well obviously... yer mum.
124
Sign In or Register to comment.