Author Topic: Corona Layered Material: Normal Map Combine  (Read 8692 times)

2020-02-01, 00:19:21
Reply #15

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8840
  • Let's move this topic, shall we?
    • View Profile
    • My Models
As you can see, the surface response of the material is different under all three of those conditions, but which is the correct method?

But of course it is different... and that is expected outcome. If you unplug normal map from wood material, then wood will be rendered without micro details. In your case, the only correct way is to plug normal map into both materials. There's no other option. It seems that for some reason, you simply overthinking the "issue" :]
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2020-02-01, 02:23:10
Reply #16

cjwidd

  • Active Users
  • **
  • Posts: 1077
    • View Profile
    • Artstation
That's right, it is expected that there should be a difference between the three possibilities, however, it is not clear based on the rendered image that plugging the normal map into both the Base Material and Layer 1 is the correct setup; insofar as it does not match the rendered output from Marmoset as well as either the case of when the normal map is plugged into only the Base Material or only Layer 1.

There seems to be some conflicting answers based on the information that is provided on the forum, but my impression was that the logic of how displacement maps behave in a Corona Layered Material (i.e. displacement only affect base material) would extend to normal maps as well.

2020-02-01, 03:01:46
Reply #17

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
Hi. This made me curious, so I made some simple test with Corona 5, and based on that it's clear that bump and normal maps doesn't work the same way as displacement maps.

If your use two different materials and a black & white mask, it's easy to see, that bump and normal maps follow the materials as expected, whereas displacement maps unfortunately only works in the base layer.

When the mask is greyscale however, there might be some differences in how the maps blend (like in Marus example). Can't say for sure, since I haven't tested this in dept.

2020-02-01, 03:17:33
Reply #18

cjwidd

  • Active Users
  • **
  • Posts: 1077
    • View Profile
    • Artstation
Thank you for sharing your findings @PROH, this is *precisely* why I am posting; because the metalness mask I am using is a greyscale image, not a quantized black and white image.

2020-02-01, 09:39:47
Reply #19

sprayer

  • Active Users
  • **
  • Posts: 794
    • View Profile
maybe difference what you may see in marmoset because you need to invert channel on normal map and forgetting this what gives difference in corona?
Also there is topic in bug section how bump rendering different on Intel CPU in corona this also may be the case.

2020-02-01, 09:58:41
Reply #20

cjwidd

  • Active Users
  • **
  • Posts: 1077
    • View Profile
    • Artstation
Marmoset defaults to OpenGL and Corona defaults to DirectX, iirc. For this example, the normal map is inverted in Marmoset, but not in Corona.

2020-02-01, 10:06:11
Reply #21

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8840
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Comparing directly to Marmoset, isn't the best idea, because difference in shading methods, can be deceiving. There is simple method how to test if Corona layered material is giving correct output. Create new Corona material and plug only normal map into it. You may want to add semi glossy reflectiveness and make sure that your lighting have enough contrast, to better see micro details. Assign newly created material to the door object and render it. Save picture to disk or render history. Now create layered material and plug your previous material to both, base and layer 1 slots. Add metallness mask, assign layered material to the door object. Render and compare with previous render. If two renders are different, then it means that Corona layered material doesn't treat normal maps correctly. If that's the case, then the only option to get trully correct output, is to use single material and performe blending through maps, not through materials.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2020-02-01, 12:27:54
Reply #22

cjwidd

  • Active Users
  • **
  • Posts: 1077
    • View Profile
    • Artstation
Yeah, after conducting more tests, including the one you described (@Romullus), I agree: the only correct way is to plug the normal map into both materials.

The fact that the Corona Layered Material is being masked by a greyscale image is probably the only reason it was ever a question to me in the first place. In this example, the greyscale image masks the bump amount such that it is not *obvious* that one arrangement is wrong compared to another, particularly when viewed at a distance. In a close-up, it is clear that the correct arrangement is for both materials to receive the normal map in a Corona Layered Material.

2020-02-01, 20:28:37
Reply #23

cjwidd

  • Active Users
  • **
  • Posts: 1077
    • View Profile
    • Artstation
Thanks for the clarification everyone, really means a lot, thank you :)

2020-02-11, 18:22:27
Reply #24

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12754
  • Marcin
    • View Profile
Ok, so just to close this thread and also officially remove it from my todo ;)

What happens when we have two materials with different normal maps and we are blending between them: basically it can be seen as just rendering both materials with 50% transparency and then stacking them together on layers. If you have concave normal on one material and convex bump on another material, blending them won't make the resulting surface flat, but instead will show both the convex and the concave bump. See: https://forum.corona-renderer.com/index.php?topic=27703.msg163341#msg163341
This may be a bit unexpected, and having different normal "blending modes" would be really great (so that for example one normal on top of each other would neutralize the underlying one, or would amplify it.

What happens when we have two materials with different properties and we want to blend them, but we want to show one normal map on the whole object: the above description applies. So if we apply the normal map to material 1 only, we will see it only in the areas covered by material 1. If we apply it to material 2 - we will see it only on material 2 areas. If we blend between the materials (for example using a gradient mask) - we will see the normal only on the material to which it is applied, and it will be fading into the non-bumpy material. To get the effect of a single normal map applied to all areas (material 1 and material 2), the normal map has to be applied to both materials.

I am adding an archive here and a .max file saved in 2017 format + renders showing different scenarios (hopefully self-explanatory when accompanied by the above description). Feel free to experiment.

There is also a small bug which produces weird artifacts under specific circumstances, but so far I encountered it just once, and it is reported. So forget about it. :)
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2020-02-11, 20:35:37
Reply #25

cjwidd

  • Active Users
  • **
  • Posts: 1077
    • View Profile
    • Artstation
This is a really helpful demonstration, especially 'mat1mat2-gradient-mask.jpg' illustrates the transformation clearly

2020-02-11, 20:37:33
Reply #26

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8840
  • Let's move this topic, shall we?
    • View Profile
    • My Models
Ok, so just to close this thread and also officially remove it from my todo ;)

I did little test too. I think there's definitely room for improvement in how Corona handles normal map blending. In attached examples you can see how normal maps are blended in layered material now and how it could look if normal vectors would be properly* averaged. I think difference is quite obvious. maru, i would like you to reconsider that and add this task back to your todo list :]

* that's the best what i could achieve in slate editor, using mix nodes, but i'm pretty sure that proper normal vector calculation and re-normalization would give even better results.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2020-02-13, 14:19:18
Reply #27

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12754
  • Marcin
    • View Profile
Ok, so just to close this thread and also officially remove it from my todo ;)

I did little test too. I think there's definitely room for improvement in how Corona handles normal map blending. In attached examples you can see how normal maps are blended in layered material now and how it could look if normal vectors would be properly* averaged. I think difference is quite obvious. maru, i would like you to reconsider that and add this task back to your todo list :]

* that's the best what i could achieve in slate editor, using mix nodes, but i'm pretty sure that proper normal vector calculation and re-normalization would give even better results.

What exactly did you do here? In what way is the "unexpected" result different than the "expected" one (technically, not visually).
I think what you are showing here is what I described here:
https://forum.corona-renderer.com/index.php?topic=27703.msg163341#msg163341
So blending identical convex normal map with an identical concave normal map will show both with 50% transparency instead of showing fully flat surface - right?
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2020-02-13, 14:35:39
Reply #28

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8840
  • Let's move this topic, shall we?
    • View Profile
    • My Models
No, not exactly.  Blending with opacity will give wrong results, because normal maps defines vectors and you can't simply mix them to gect correct result. Overlay blending gives more correct result, so that's what i did there. I'm attaching screenshot of shader tree. As you can see, it's not very practical and that's only with two maps. If you would want to mix three or more normal maps, the tree would get ridiculously complex. I could upload the scene with maps to private uploader if you want, i think i saved it somewhere on the disk.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2020-02-15, 00:47:41
Reply #29

Juraj

  • Active Users
  • **
  • Posts: 4762
    • View Profile
    • studio website
"Stacked" layering (not just of normals) always remind of the Ready&Dawn material system for Order 1866, everyone should look up that paper/presentation on it.

It would make material creation in CGI so much more logical, so much easier.

Current LayeredMaterial is just opacity blending in Photoshop..not very useful.
Please follow my new Instagram for latest projects, tips&tricks, short video tutorials and free models
Behance  Probably best updated portfolio of my work
lysfaere.com Please check the new stuff!