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.
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.
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.
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?
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.
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.
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.
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.
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.
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?
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.
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.
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)
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.
Replies
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.
I need to try this first anyway.
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.
not close so far...
still not close. I wonder if some shader magic could help.
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.
thanks for tut!
I thought it wasn't possible with the standard shader?
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.
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?
I used both. I tried to keep normal down because it gets too bumpy.
But here it is more intense:
and a bit more intense:
I think I should play more with scratches pattern.
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.
Why not change the compression to bc5 or something on import?
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.
It works with point light sources but it probably wouldn't work with IBL.
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.
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?
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.
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.
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)
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.
here it's without normal map.
with mipping on:
without mipping:
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.