Home Technical Talk

AO: Unreal Engine 4?

How do I go on about creating Ambient Occlusion maps for UE4? Now that I know we shouldn't incorporate AO into the Albedo/Base Color input in UE4, where should I plug the AO map in the material inputs?

Is AO creation necessary for any assets in UE4? I mean I saw a few AO systems like SSAO and DFAO; what are these and how do I activate/utilize these in UE4? Should these be used along with AO maps, or should only either be used (AO map or SSAO/DFAO)? Also, already after all these systems in place, is it necessary/required to create AO maps manually for use in UE4?

I'm about 3 months into UE4 and today I suddenly realized about this AO thing! I know I've asked too many questions, but please I really need help on this one! Too confused!

Thanks! Any help would be greatly appreciated! :)

Replies

  • Axi5
    Options
    Offline / Send Message
    Axi5 interpolator
    I think there is an AO slot on the standard material if I remember correctly.

    edit:

    yup!

    298ab15797d336581df9fa9b04ad53a4.png
  • LMP
    Options
    Offline / Send Message
    LMP polycounter lvl 13
    Axi5 wrote: »
    I think there is an AO slot on the standard material if I remember correctly.

    edit:

    yup!

    298ab15797d336581df9fa9b04ad53a4.png

    You put it in there ^

    I like to put my roughness, metallic, AO, and sometimes a 4th map into the alpha channel.
  • EarthQuake
    Options
    Offline / Send Message
    LMP wrote: »
    You put it in there ^
    I like to put my roughness, metallic, AO, and sometimes a 4th map into the alpha channel.

    Making a combo map with 3 RGB channels is a really good idea, however, putting a 4th in the AO channel doubles the compressed texture memory.

    Usually you can find at least one map that works fine with less resolution than the others, so, If you size down that one (for instance, 1024x1024 to 512x512) and save it as a second texture instead of into the alpha channel, you would save a nice chunk of VRAM. Even simply putting that 4th map into its own image is no less efficient memory wise (thought it is an extra texture call).
  • slayniac
    Options
    Offline / Send Message
    Remember that AO maps need to be in gamma space (sRGB) while roughness, metallic and similar maps have to be in linear space which makes combining them inadvisable, at least in UE4.
  • LMP
    Options
    Offline / Send Message
    LMP polycounter lvl 13
    I thought about it a bit, and I don't recall ever actually putting a 4th channel into my combo maps. It's pretty much my standard procedure when I'm building textures to output from substance for UE4 that I add an extra output for my combo map.
  • Solmas
    Options
    Offline / Send Message
    Solmas polycounter lvl 4
    slayniac wrote: »
    Remember that AO maps need to be in gamma space (sRGB) while roughness, metallic and similar maps have to be in linear space which makes combining them inadvisable, at least in UE4.

    About this, when you say gamma space what do you mean exactly? I'm currently working with an indie company and combining maps as so: normal/height RGB/A (normal and parallax), rough/AO/metal = R/G/B, and Albedo as it's own map. I just learned that G has 6 bit depth while R and B has only 5 bit depth and that the alpha channel has 8 -- which is why AO is going into G channel. Does this have anything to do with gamma space or am I way off track? Thanks!
  • EarthQuake
    Options
    Offline / Send Message
    slayniac wrote: »
    Remember that AO maps need to be in gamma space (sRGB) while roughness, metallic and similar maps have to be in linear space which makes combining them inadvisable, at least in UE4.

    The only thing that *needs* to be linear space is a normal map, though it makes some sense for roughness maps and metalness maps to be in linear space too. However, there is no requirement there, you can have sRGB roughness and metalness maps, you just need to author and preview them as sRGB. The problems arise when you author/preview in linear and then set as RGB later, that would break your stuff, but again, there is no need for either of those maps to be in linear space. A metalness map should be mostly 0 or 1, so linear or srgb you should see little to no difference.
    Solmas wrote: »
    About this, when you say gamma space what do you mean exactly? I'm currently working with an indie company and combining maps as so: normal/height RGB/A (normal and parallax), rough/AO/metal = R/G/B, and Albedo as it's own map. I just learned that G has 6 bit depth while R and B has only 5 bit depth and that the alpha channel has 8 -- which is why AO is going into G channel. Does this have anything to do with gamma space or am I way off track? Thanks!

    Gamma space means the image is gamma corrected, or that there is a curve applied to the image to viewed on screen as intended. Gamma shifts more of the precision to the darker half of the images (the most common values) so 50% grey isn't actually 127 in gamma space. In linear space, all values are linear, so 50% linear is 127.

    Maps that define mathematic functions, like normal maps and height maps, which should definitely be in linear space. A roughness map is sort of similar, however roughness is generally created by eye not to specific math values, so it can be either or, and again, metalness is mostly 0 and 1 values so it just doesn't really matter there.

    What you're doing is perfectly fine, as long as you maintain either sRGB/gamma or linear for your textures for the entire process. Again, if you author in linear and the combine later and set the texture to sRGB, it will be off.
  • Solmas
    Options
    Offline / Send Message
    Solmas polycounter lvl 4
    Thanks for the info EarthQuake! I think I understand the concept as you describe but if you happen to know or have a link to a good resource or two that goes into depth I'd really appreciate having it :) I've been having a difficult time finding anything good myself
  • EarthQuake
    Options
    Offline / Send Message
    Good place to start here: http://filmicgames.com/archives/299

    This covers mostly linear space in lighting, which isn't really what we're talking about here. UE4 and most modern engines do all the shader calculations in linear space. But that is a separate issue than loading in gamma or linear space textures. Though the concept of gamma correction is explained in detail in that link.
  • slayniac
    Options
    Offline / Send Message
    EarthQuake wrote: »
    The only thing that *needs* to be linear space is a normal map, though it makes some sense for roughness maps and metalness maps to be in linear space too. However, there is no requirement there, you can have sRGB roughness and metalness maps, you just need to author and preview them as sRGB. The problems arise when you author/preview in linear and then set as RGB later, that would break your stuff, but again, there is no need for either of those maps to be in linear space. A metalness map should be mostly 0 or 1, so linear or srgb you should see little to no difference.

    Yea, sorry for my wording. I'd just strongly advise against doing so, especially when you (or someone in your team) are using tools like Substance. Yes, Substance can be set up to export those maps in sRGB but that would only add to the confusion. There is also the risk of people using it inconsistently throughout the project which can lead to other problems.
    Our artists are sometimes confused about when to use that sRGB flag. I'll always tell them to use it when the information on the texture directly affects the color of the material. This works pretty well and people tend to understand it :)
  • EarthQuake
    Options
    Offline / Send Message
    Yeah, not having any strict guidelines for this could cause a lot of problems, especially if you have artists reusing content for other assets without knowing the color space it was authored in. I wouldn't really recommend artists making this call on an individual basis or a per asset basis, but if you're talking about project guidelines, there is no reason roughness or metalness maps *need* to be linear. I agree it makes a little more sense, but as long as its a consistent convention, it should't cause any problems.
Sign In or Register to comment.