Home Technical Talk

PBR - AO - Question

Hi there,

Long after PBR is introduced, I'm still wondering about one thing.
Do we have to use an AO texture for every single Albedo texture? if so, why not just keeping the shadows in the texture in the first place? if that is because we can control the AO intensity, doesn't that mean we have to change it's intensity under each different lighting condition to make it sit perfectly? that shouldn't be a good way of doing things.

Here is my maps:

vi2u1D.jpg

In engine render:

rJs02U.jpg

What always seems better in my eyes is exactly breaking the first rule of PBR, which is taking out all the shadow information. Like on the right, it feels better than the left.

Taking out shadows does make sense to me when it's about a geometry with curvatures, where engine already adds AO to it, but like 90% of surfaces are not bending on themselves or curves like that.

Replies

  • s6
    Offline / Send Message
    s6 polycounter lvl 10
    The idea behind separating AO and Albedo is so the engine can handle the relationship they have together dynamically. Meaning, when a light shines into a crack or crevice where AO would typically live the engine can remove it. If AO lived in the Albedo, there would be no way to accurately light that area.

    That said, it's all about the end result. Do what makes sense visually, and technically, for whatever project you're working on :)

    Edit: And to clarify, PBR doesn't suggest you don't use a detailed AO via texture, it suggest you seperate your AO and Albedo and multiply them together realtime.
  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
    Depending on your ssao shader those cracks in the normal *could* be shadowed with ao if it supports normal maps and geometry normals

    I dont know what engine this is, but you may try messing around with the SSAO settings
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    It's just one of the cases where PBR approach fails. Especially if you texture is not very hi-res and the normal map have not enough resolution to define those cracks nicely.

    Moreover with typical metallic / roughness aproach it would not allow to wipe out highlight completely from those "in-cracks" shadows even with 100% roughness.
  • Maximum-Dev
    @s6, Thanks a bunch. I didn't know when a light hits a surface it does remove the AO I have plugged in. The surfaces are in shadow still use the plugged AO that's nice and... also bad. I'm going to say why in reply to @radiancef0rge.

    @radiancef0rge, Sorry for not mentioning the engine. It's UE4. It does shadow the cracks in the normal map but it only does it for that part of the surface that's in the shadows.

    If the engine do AO for normal map even while the surface is not under a shadowed area then that's a more realistic result. Like the Diffuse/Albedo comparison texture in the OP, the diffuse is also taken in bright day light but it does have AO in the cracks.

    One temporary solution can be letting some AO be there in Albedo itself so when a light does reach a surface and take out all the AO there'll still be a little shadow there from the Albedo. But still say the material was also use in an overcast level too then we need to duplicate the material.

    So after all, I'm still not seeing a clear approach to this.
  • EarthQuake
    Yeah s6 hit the nail on the head.

    An example I always like to use when this comes up is: Go look under your fridge. Its really dark under there, yeah? Now shine a flashlight under it, it lights up, right?

    If you bake medium-large scale AO into your diffuse, what you're essentially doing is flagging the area under the fridge as dark no matter if a direct/dynamic light source hits it. This is physically incorrect, and well, just looks dumb when you see in it in game.

    This is not a "fail" of PBR, it's an advantage of it. When the AO data is stored in a separate map, the shader can use the information in a more intelligent way.

    Now, for small detail aka micro-occlusion, where you don't have enough geometry resolution to properly shadow, you may want to include high frequency details in a cavity map. Typically, a cavity map will apply to both ambient and direct light sources. For more on this, check out the explanations for AO vs cavity maps here: http://www.marmoset.co/toolbag/learn/pbr-practice

    Its worth noting that the example in the OP is closer to what I would consider cavity detail rather than AO detail.
  • Maximum-Dev
    ^ Thanks, but we don't have a cavity slot in UE4 as we do in Toolbag. How do you meant to use it so a cavity map will apply to both ambient and direct light sources ?

    Edit: The orange area should still be darker while there is light shining on the surface is what I'm trying to say.

    mIfb66.jpg

    No matter what I plug into the AO slot in UE4, it all completely goes out in angles that are facing light between the whole 0 to 89 degrees. I'm curious to know how should I be using a cavity map so it also stays there on the surfaces that are lit.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    While I agree completely with EarthQuake fridge example and we did use separate AO map for that purpose long before PBR , still from what I saw in U4 and other game engines ( non Marmoset) with mostly simple metallic/roughness approach+energy conservation we do need extra "cavity" and " speclevel" maps just because PBR is too honest and not allowing you to fake anything.

    Before PBR it was no problem at all since the system was much more flexible and not so physical dogma driven.

    In such cracked surface I personally even can't use the normalmap for cracks shading because I can't make the texture repeating in each few meters to get enough normal map resolution and strong highlight just wipes those cracks shadows out whatever roughness they would be.

    That was actually such cracks on the asphalt when I changed my initial excitement about PBR to pretty opposite opinion.
  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
    The spec input on the unreal shader is supposed to act like a cavity map. If you plug your cavity map into there it *should work* work.
  • Maximum-Dev
    The spec input on the unreal shader is supposed to act like a cavity map. If you plug your cavity map into there it *should work* work.

    Apart from changing the spec level it does nothing else really what you said.

    The only solution seems to be changing the term "Remove AO information from texture" to "Reduce AO information from texture" in PBR rendering until game engines catch up with more options such as micro AO/Cavity shader, that doesn't get wiped out if there's light on the surface.
  • radiancef0rge
    Offline / Send Message
    radiancef0rge ngon master
    Apart from changing the spec level it does nothing else really what you said.

    that is absolutely incorrect. it is used for cavity shadowing

    https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/index.html#Specular
    To be clear this is BaseColor = Cavity*OldBaseColor, Specular = Cavity*0.5.

    http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf slide 20
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    I also see it changes speclevel only , no actual shadowing in the cracks. Still very convenient and useful input. The one allowing to deceive all those physical dogmas.
  • Joopson
    Offline / Send Message
    Joopson quad damage
    gnoop wrote: »
    Moreover with typical metallic / roughness aproach it would not allow to wipe out highlight completely from those "in-cracks" shadows even with 100% roughness.

    You can get full black by setting the black areas as metallic. Because the albedo defines the brightness and colour of metals' specular highlights, setting the albedo to black removes all highlights for those areas.

    Also, if light's never ever ever going to get into those cracks, you can totally multiply the AO over the diffuse input. It might be breaking a rule or something, but this is one of the scenarios where I don't really see a downside.
  • Cathodeus
    Offline / Send Message
    Cathodeus polycounter lvl 14
    In my eyes rules are good but when you know it and understand them you can start to break them if they are too limitating !
  • Maximum-Dev
    @radiancef0rge, Maybe it is meant to, but it's not shadowing anything.
    I have adjusted the levels/contrast to strengthen the effect and plugged it into the Specular slot. As gnoop mentioned
    it changes speclevel only , no actual shadowing in the cracks

    JzwUdQ.jpg

    No matter how the map is looking up there I only get to see a change in specular level.


    @Joopson, Setting the cracks to metallic does darken it a little. The amount depends on the brightness of the albedo and we cant adjust the cracks in albedo to look darker because that'd be the same as multiplying AO with albedo.
    As you said
    Because the albedo defines the brightness and colour of metals
    so here's the result.

    azd4jc.jpg

    @Cathodeus, Wise words from a zBrush master. Have no other option left but trying to break the rules and find my own pipeline. :)

    Thanks all for the time.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Making cracks metallic is what I did for a while . Having both metallic and speclevel in alpha channel. Metallic darkening actually works only on dark colors.

    Still I consider it a huge pain in the a.. altogether. Because it's basically a trying to deceive inflexible PBR system , too honest for all those tricks.
  • Maximum-Dev
    This whole PBR is based on removing AO from texture because engine already adds AO at a vertex level. I see no point for removing AO from textures that are for surfaces that don't have a complex vertex level to make the engine add AO on them.

    This ground cracks was just an example I used quickly from CGTextures. This problem happens with everything imagine a tree bark, a wooden shield, a rocky surface etc. none of them get AO on them by the engine unless another object is too close to them, and while the AO map doesn't keep anything if light is reaching that surface we'll only be seeing "base color" meaning only pure flat colors and normal map with no darkening in the cracks and things like that at all that's too ugly.

    So keeping AO information in diffuse is not the best approach but it does the job until game engine at least supports some micro AO even while the light is reaching a surface.
  • EarthQuake
    gnoop wrote: »
    Making cracks metallic is what I did for a while . Having both metallic and speclevel in alpha channel. Metallic darkening actually works only on dark colors.

    Still I consider it a huge pain in the a.. altogether. Because it's basically a trying to deceive inflexible PBR system , too honest for all those tricks.

    To be clear, the metalness workflow itself is not "PBR", its not mutually exclusive or inclusive to the concepts of physically based rendering. It is simply a method to pack textures inputs to save on memory, while providing a fail safe for implausible materials. Yes, working with the metalness workflow has certain drawbacks, but it's very misleading to tie those to PBR.

    Now, to get cavity detail in UE4, you can simply multiply your cavity map on your base color. This will effect the diffuse for insulators and the specular for metals (so you may want to mask your cavity map with your metalness map to prevent it from showing on metallic areas). Because it's generally desirable for cavity detail to multiply on ambient and direct light sources this content doesn't need to live in a different map like AO. Again, this is a very bad idea for mid-large scale ao but should work fine for micro-occlusion aka cavity detail.

    As Chris says, Epic's docs clearly state that this is what should be happening when you use the spec input, but I guess the docs are incorrect and it isn't happening. Weird. Anyway, at minimum it masks the insulator reflectivity, so if you want to apply your cavity map to occlude micro detail on the spec pass for insulators, load the cavity map here as well.

    It's also important to note that this a cavity map:
    cavity01.jpg

    While this is a curvature map (contains both concavity and convexity detail):
    cavity2.jpg

    More here, including how to convert curvature to cavity/convexity: http://www.polycount.com/forum/showthread.php?t=140861
  • Joopson
    Offline / Send Message
    Joopson quad damage
    @Joopson, Setting the cracks to metallic does darken it a little.

    Sorry; I should have been clearer. Setting the cracks to be black AND metallic. That's the only way in PBR to get pure non-light-accepting black.

    So take your cavity map, multiply it onto your diffuse. Then take the cavity map, invert it using a one-minus node, and plug that into Metalness. I have to say though, pure black can be really jarring to the viewer, so be careful using it.
  • EarthQuake
    Yeah I would only do that for areas like fake holes in objects that really, really need to be pure black.
  • teaandcigarettes
    Offline / Send Message
    teaandcigarettes polycounter lvl 12
    Something that is worth mentioning. While bending the rules of PBR can sometimes make standalone props or scenes look better, especially when tweaked by a single artist, this approach might be a bit risky when used in a production environment.
    Personally I try to deviate from rules as little as possible. It might not make the most eyecathing assets, but it makes for more pleasant looking scenes.
  • EarthQuake
    Right. While I understand artists longing for the workflows they are used to, its very important to realize why a lot of these "rules" were put into place, and in the case of PBR, have become the defacto standard. When each artist tweaks individual assets and comes up with unique workflows for every little piece of art in the game, it's extremely difficult to ensure consistency. It's much better to have a game full of un-exceptional assets pulled together with exceptional art direction and lighting (a lot easier with standardized workflows) than a game built of a hodge-podge of random techniques.
Sign In or Register to comment.