Home Technical Talk

Microscratches in PBR

polycounter lvl 10
Offline / Send Message
dzibarik polycounter lvl 10
I was wondering if it is possible make such effect in current PBR model.

microscr.jpg

here's the link to the scratchmap and the tutorial

I've tried but it looks uniform and too blurry in 2048:

yHvffSG.png

Replies

  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    You'd do that with Detail maps: http://wiki.polycount.com/wiki/Detail_map (not the best page tbh), an in-shader effect.
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    thanks, completely forgot about them. Will test in UE4 tonight.
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    Btw your example looks like it contains a few layers with an anisotropic effect as well, not sure it would translate so easily into UE4.

    Ps, you probably realize, but hand-drawing that map in Photoshop, like the tutorial, is a bit silly when you can easily get a tiling, tweakable result in Substance designer in less time.
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    I did scratches in SD first, got that uniform look, then downloaded the texture and it was the same so yes, it's better to do it in SD, it'll be faster and more tweakable. As for layers... I have seen another setup of these scratches on Modo forums and it didn't rely on layers if I understood right - http://community.thefoundry.co.uk/discussion/topic.aspx?f=8&t=77365.

    I need to try this first anyway.
  • FelixL
    Options
    Offline / Send Message
    FelixL polycounter lvl 9
    This type of effect is not easily done. The scratches are so small that they'd usually be done with a roughness map, not a normal map. But then, you'd lose the directionality. If you look at your pic, the scratches appear circular around the sharp highlights. This means that the surface is rather uniformly scratched, but only the ones perpendicular to the specular highlight are actually visible.

    The most reasonable way would be a tiling detail normal map. But together with bilinear texture filtering, cubemap lookups, mip mapping, and everything else, it might still be hard to get precisely this affect. The surface will likely look too bumpy.
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    first try

    not close so far...

    cg5SKzO.png
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    Here's another one, almost similar but roughness a bit less pronounced.

    3YOyN15.png

    still not close. I wonder if some shader magic could help.
  • rollin
    Options
    Offline / Send Message
    rollin polycounter
    Imo this should be dealt with an anisotropic shader. Take a look at the wiki page, maybe you can find something there:


    http://wiki.polycount.com/wiki/Anisotropic_map


    btw.. this effect and pbr don't have anything to do with each other. People tend to think pbr is some now technology or so.
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    @rollin:

    thanks for tut!

    I thought it wasn't possible with the standard shader?
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    it seems that UE4 doesn't support anisotropic maps yet -

    https://answers.unrealengine.com/questions/10648/undefined.html

    UE3 had it though. And if it can be done through anisotropic maps only then no PBR needed indeed.
  • FelixL
    Options
    Offline / Send Message
    FelixL polycounter lvl 9
    I don't see how this has anything to do with anisotrophy. If this was brushed metal, as in, brushed in one direction only, then you would get the long, stretched highlights.
    These, however, are microscratches that are in all directions.

    In your last screenshot, it looks like you used the scratches in the roughness map. Have you tried a detail normal map instead?
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    FelixL wrote: »

    In your last screenshot, it looks like you used the scratches in the roughness map. Have you tried a detail normal map instead?

    I used both. I tried to keep normal down because it gets too bumpy.

    But here it is more intense:

    I9BKpp8.png

    and a bit more intense:

    NBctoA9.png

    I think I should play more with scratches pattern.
  • FelixL
    Options
    Offline / Send Message
    FelixL polycounter lvl 9
    Yes, that's what I meant with mip mapping.
    The mip mapping process blurs the scratchmap, and it looks more like molten ice with scratches now.
    You would need to adjust the mip bias in your GPU driver or try saving the texture without mips (if that would work in UE4)

    This is one of those things in realtime rendering that's very hard to do due to the underlying rendering process. In offline rendering, with supersampling and no mips, it's another story.
  • deohboeh
    Options
    Offline / Send Message
    deohboeh polycounter lvl 5
    Doesn't ue4 create a mip set in import?

    Why not change the compression to bc5 or something on import?
  • ZacD
    Options
    Offline / Send Message
    ZacD ngon master
    Are you using a detail normal map with it? Might be worth a try to use a very subtle one to try to catch the light and expand the highlights a bit like the reference.
  • Campi
    Options
    Offline / Send Message
    Campi polycounter lvl 11
    It is an issue in offline rendering as well that is only slowly starting to get solved there.
    Bascially the shape of your highlights at distance will always be wrong compared to the highlight at close ups due to the filtering.
    One approach is to use lean mapping to encode the normal direction (http://www.csee.umbc.edu/~olano/papers/lean/) but I don't know if any engines support it yet.
  • Jerc
    Options
    Offline / Send Message
    Jerc interpolator
    Using a detail normal map of random scratches worked for me before, but you'll need to have a custom shader that will only use this normal to calculate an additional specular pass on the scratches but not for the reflection or diffuse component.

    It works with point light sources but it probably wouldn't work with IBL.
  • CharacterCarl
    Options
    Offline / Send Message
    CharacterCarl greentooth
    Jerc wrote: »
    but you'll need to have a custom shader that will only use this normal to calculate an additional specular pass on the scratches but not for the reflection or diffuse component.

    That's right: The detail map should be limited to the scratch areas only. You could also use a 'Detail Weight Map' inside Marmoset to mask off the detail map and see if that works.
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    Jerc wrote: »
    Using a detail normal map of random scratches worked for me before, but you'll need to have a custom shader that will only use this normal to calculate an additional specular pass on the scratches but not for the reflection or diffuse component.

    It works with point light sources but it probably wouldn't work with IBL.

    this is interesting.

    I haven't dealt with custom shaders before so bear with me. So I understand it right I should create a custom material output (like clearcoat for examople) in Unreal 4 and plug my detail normal map in? And this node will take a normal map and calculate a separate spec pass, right?
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    Mipping turned off:

    yuFQYbR.png
  • almighty_gir
    Options
    Offline / Send Message
    almighty_gir ngon master
    why would you turn mip-mapping off?

    try this:
    people think of detail maps and they go "oh, tiling normal overlay..." but that's not quite true. you can have a detail map in any slot you like! if you're finding that the normal overlay is a bit overbearing, and causing it to look more like ice than metal, why not make a detail map for roughness only? since roughness will actively sample through mip chains anyway.

    You also need to consider a weight map, this is a grayscale map that's multiplied with the result of your detail map before it's applied to the rest of the texture, it stops the detail map being applied to the whole model.
  • FelixL
    Options
    Offline / Send Message
    FelixL polycounter lvl 9
    I've tried this in cryengine and couldn't make it work. Even disregarding IBL, the highlights wouldn't spread far enough through the scratches to achieve the effect in OP's picture.
    Would be cool to see if this can indeed be done in-engine without a specialized shader.

    You can see in the tutorial that he uses a layered shader. He uses about 5 or 6 layers of the same shader, with the bump strength gradually lowered, with the topmost layer being at 0 bump. This is how he makes the scratches deep enough to catch the highlights, without making the surface too bumpy. Which is why the cubemap reflection still looks sharp.

    I guess you should be able to make something similar in UDK. Although the cubemap reflection is probably in a single G-Buffer and can't be blended with multiple layers of itself.
  • almighty_gir
    Options
    Offline / Send Message
    almighty_gir ngon master
    oh i have no idea how to do this in cryengine... in UE4 you would do:

    constant(number of times you want it tiled) -> texture UV's = your tiled detail map
    tiled detail map * weight map = final detail map
    use blending math of your choice to apply final detail map to material. for example, to simulate photoshops "overlay", the math is:
    (BaseLayer> 0.5) * (1 - (1-2*(BaseLayer-0.5)) * (1-OverlayLayer)) +
    (BaseLayer<= 0.5) * ((2*BaseLayer) * OverlayLayer)
  • FelixL
    Options
    Offline / Send Message
    FelixL polycounter lvl 9
    Have you tried what it looks like? My guess is that it will still look either
    a.) like bumpy ice if you use normal maps
    b.) like sprayed on scratches if you use roughness maps

    I don't think you can get the exact same result as in OP's pic without blending several shaders, which may or may not work in UDK because the cubemap reflection is probably rendered in one go, without the possibility for blending.
  • dzibarik
    Options
    Offline / Send Message
    dzibarik polycounter lvl 10
    @almighty gir:

    here it's without normal map.

    with mipping on:

    5jeez10.png

    without mipping:

    MWKoNS6.png

    It tends to be a tiny bit sharper without mipping, scratches are more visible. Still it's not quite there.

    As for weight maps as I understand they are simple masks, right? The only weight map I have found in Unreal can be used only in Landscape material.
Sign In or Register to comment.