Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: fyckfaco on 2020-12-04, 18:37:53

Title: Normal maps in Corona
Post by: fyckfaco on 2020-12-04, 18:37:53
Hi everyone.

I'm having some real issues with normal maps within Corona 3ds max.
I have updated both max and corona and still cannot rectify.

I have green channel the correct way round, plus gamma set up correctly.

No matter what I try Corona seems to merge the shading from the low mesh with the lighting of the normal map.

Title: Re: Normal maps in Corona
Post by: fyckfaco on 2020-12-04, 19:46:29
Ok i have solved this to some degree. Unwrapping the low res model with a single UV island and smooth group resulted in the bad normal map.
Unwrapping into multiple UV islands (flattern) asigning a different smooth group per island, and rerendering the normal map works as expected.

Why scanline can cope with a single UV island and corona cannot though is unfortunate.
Title: Re: Normal maps in Corona
Post by: romullus on 2020-12-04, 19:55:26
If i would have to guess, i would say that Corona and scanline use different tangent basis. You need to bake normal maps in exact tangent basis that your rendering app is expecting, otherwise you risk to get shading artifacts.

Edit: looking at your example - it could be wrong gamma, or flipped axis issue as well.
Title: Re: Normal maps in Corona
Post by: fyckfaco on 2020-12-04, 20:03:07
As I say, it was multiple UV islands with separate smooth groups VS a single smooth group and 1 UV island.
Title: Re: Normal maps in Corona
Post by: romullus on 2020-12-04, 20:47:27
Corona has no problems with single smooth group and single UV shell. However errors due to mismatching tangent basis will always manifest more in such scenario, simply because the difference between high-poly and low-poly normals are much more severe. I think i can see some shading errors in your multiple smoothing groups example, rendered with Corona, but they are much more subtle.

Where do you bake normal maps? What tangent basis do you use for that?
Title: Re: Normal maps in Corona
Post by: fyckfaco on 2020-12-05, 01:09:34
Was just using scanline render texture. Where do I find tangent basis?
Title: Re: Normal maps in Corona
Post by: fyckfaco on 2020-12-05, 01:16:17
Is this is referring to RGB +X+Y+Z or +X-Y+Z, I have that set up correctly.
Max exports as -Y by default, so I just use that until I leave max. Does it go more in depth than that?

I really think I was just trying to use far too large directional gradients across the single UV shell, the tangent space wasn't uniform due to that, so the surface will probably have shading seams.

I baked from Xnormal also and got the same issue until I did the above fix.
Title: Re: Normal maps in Corona
Post by: romullus on 2020-12-06, 10:41:47
No, tangent basis is not the same as Y axis flipping. You can read more about it here: http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Tangent_Basis

Surprisingly, not many bakers allows user to chose what tangent basis to use for normal map baking. 3ds Max uses its own tangent basis, other bakers use different basis, most often it's Mikk. If you're baking in xNormal, then in theory scanline shouldn't produce artefact free output, since their tangent basis doesn't match. Anyway, it's hard to tell what's going on here just from the pictures. Maybe if you could upload low-poly mesh and normal map, someone could be able to check it out and see if they could find where the issue is.
Title: Re: Normal maps in Corona
Post by: fyckfaco on 2020-12-07, 14:39:35
ok cool thanks!
I guess the question is then, what should I be baking in for Corona 3ds max?
Title: Re: Normal maps in Corona
Post by: romullus on 2020-12-07, 15:06:49
Marmoset Toolbag is excelent baker and it supports 3ds Max tangent basis, but it's commercial tool and not exactly cheap if you need it for baking alone. There also is Handplane baker, which is free and i think it supports multiple tangent basis too.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-01-21, 00:55:00
I've always had this problem with Corona Renderer / 3ds Max, and have basically avoided it by using high poly geo whenever I can. When working with game assets, however, this is unavoidable and produces very harsh shading artifacts as described above.

There will be times when it is not possible, or practical, to get normal maps for an asset baked in [whatever tangent space 3ds Max prefers].

I'm wondering if CoronaRoundEdges or the new PBR shader will have any say in this?
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-01-21, 02:38:45
It seems like the default normal map strength (1.0) is not on parity with the strength (representation) of the normal map in viewports of some popular real-time renderers, e.g. Marmoset, Substance Painter, Mixer, etc.

The normal map strength 1.0 seems twice as strong, thus the correct (consistent) bump strength should be 0.5(?)

Wondering if there is some sort of conversion factor that could make sense of this(?)
Title: Re: Normal maps in Corona
Post by: romullus on 2021-01-21, 10:21:51
Can you show some examples? As far as i'm concerned, default normal map strength in 3ds max and Corona is correct and in line with industry standard.
Title: Re: Normal maps in Corona
Post by: maru on 2021-01-21, 10:29:11
The normal map strength 1.0 seems twice as strong, thus the correct (consistent) bump strength should be 0.5(?)

I have noticed something similar. I will try to bring this to the surface again and let you know about my findings.
Title: Re: Normal maps in Corona
Post by: maru on 2021-02-02, 15:14:55
Logged.

(Report ID=CRMAX-239)
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-02-02, 16:30:55
Thank you!

I will post examples when I get the chance
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-02, 07:22:48
@romullus @maru

I really want to help as much as I can to isolate and address this issue. What sort of assets or evidence would be most useful to provide?
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-02, 10:09:40
Don't ask me, as i said, i never noticed abnormal normal map behaviour in Corona. As long as you set-up it correctly (gamma, space, tangent basis, handedness, etc.), default strength of 1, should always provide correct result. The only exceptions i can think of, is when you use normal map for special effects, like flakes in metallic paint, or when a normal map is arbitrary authored crap, or when you use it in combination with displacement. In any case, if you observe incorrect normal map behaviour, then at very least you should attach some examples how it looks. Providing offending texture would be even better.
Title: Re: Normal maps in Corona
Post by: GeorgeK on 2021-04-02, 13:31:26
@romullus @maru

I really want to help as much as I can to isolate and address this issue. What sort of assets or evidence would be most useful to provide?

Any form of reproduction scene/steps and further screenshots about the differences you've encountered in other software would help.

Thanks,
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-04, 11:31:06
See attached for comparison images

Watch x1.5-2.0 speed

Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-04, 15:04:34
There's clearly something wrong with Corona renders in your example, but i don't think it's the strength of normal map. You can see artifacts even at 0.5 strength, they just less clearly expressed. I suspect it's because of not synched workflow (http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Synched_Workflow). 3ds Max and UE uses different tangent basis and you can't expect to get the correct result from both, if you're using the same normal map. It would be great if you could author normal map in correct tangent basis for each app and compare the result. You would need to have high-poly version, or object space normal map to bake normal map in correct basis (synched workflow).
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-04, 20:54:56
That sounds right to me, although...

3ds Max and UE uses different tangent basis and you can't expect to get the correct result from both, if you're using the same normal map.

I believe this is the problem - I expect normal maps to produce the correct results irrespective of the application. Otherwise, the implication is that there are normal maps for 3ds Max and normal maps for everything else, and asset libraries are not constructed in these terms, e.g. Megascans, Substance Source, etc.(?)

There are cases in which it is not possible to access a normal map baked in the correct tangent space for 3ds Max / Corona Renderer, and it would seem an extreme conclusion then that 3ds max  / Corona Renderer is not an appropriate rendering solution for those cases(?)
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-04, 21:23:57
Unfortunately there's no single standard for normal map implementation, every app uses its own tangent basis, handedness and whatnot. Luckily for archviz all this is mostly irrelevant, because almost all materials are baked onto flat surfaces and difference between different tangent basis becomes imperceptible. I think that's the reason why majority of users in Corona have no issues with normal maps - they are mostly using assets prepared for archviz. Unsynched workflow only becomes a problem, when normal map is baked from and used on complex objects with highly curved surfaces, like a robot in your example. And even in this case it is possible to mitigate issues from mismatching tangent basis, but you have to prepare low-poly object for that before baking.

To summarize, you can safely use textures from megascans, substance source and similar sources in Corona and you will have zero issues, but if you want to use assets which were made for real-time use, you must be careful and look for hidden issues. But that's not Corona's fault, if your workflow is unsynched, you will have issues in every app.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-04, 21:45:26
you can safely use textures from megascans, substance source and similar sources in Corona and you will have zero issues

To be sure, you mean so-called 'surfaces' and not textures for '3D assets', per the Megascans library - I expect the same is true for other libraries as well.

But that's not Corona's fault, if your workflow is unsynched, you will have issues in every app.

Right, although that is the pretense of my question, "Is there something Corona Renderer could do about it?" For example, a conversion tool, a normal map node, etc. It sounds like @Maru has already logged something related to this issue (Report ID=CRMAX-239).
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-04, 22:31:16
To be sure, you mean so-called 'surfaces' and not textures for '3D assets', per the Megascans library - I expect the same is true for other libraries as well.

Yes, i meant surfaces, but i think even with their 3D assets you should have no issues, because they are fairly high-poly. If you'd use LOD4-5, maybe you could see some small artifacts when compared it side by side with UE output (i'm making assumption that megascans normal maps are baked in UE compatible tangent basis), but i don't think it's something you should worry about.

Right, although that is the pretense of my question, "Is there something Corona Renderer could do about it?" For example, a conversion tool, a normal map node, etc. It sounds like @Maru has already logged something related to this issue (Report ID=CRMAX-239).

That's obviously not for me to answer, but i don't know any software which would support multiple tangent basis.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-04, 22:50:55
I think (maybe) Handplane did something like this, but even then it might require the high poly or world space normals or something...
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-04, 23:38:38
Yes, original handplane is a tool for normal map conversion and yes, it does need object space normals for that, which you can get if you have high-poly model. And to be clear, when i said that to my knowledge, there's no app that supports multiple tangent spaces, i was talking about rendering apps. Specialised bakers usually can bake in multiple tangent spaces, but Corona isn't baker.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-05, 07:54:41
Regarding Megascans 3d assets, if lower poly geo is more likely to produce normal map shading artifacts in 3ds Max / Corona Renderer, then that is a sticking point; low poly geo (LOD 4-5) is crucial for physics simulation, e.g. Tyflow. However, I agree that high poly 3D assets from the Megascans library are less likely to produce shading artifacts (see attached).

(https://i.imgur.com/O81ZHd3.jpg) (https://i.imgur.com/YrkOCXY.jpg)
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-05, 10:12:23
Regarding Megascans 3d assets, if lower poly geo is more likely to produce normal map shading artifacts in 3ds Max / Corona Renderer, then that is a sticking point; low poly geo (LOD 4-5) is crucial for physics simulation, e.g. Tyflow.

You can use lowest LOD for simulation, but for rendering you would still use LOD0, right? So it shouldn't be a real issue. On the other hand those artifacts on LOD4 in your example looks a bit extreme - make sure that you're using normal map specifically baked for that LOD and not any other. Anyway, as i said, that's not Corona's fault, that's an issue with industry's lack of single standard. They never learn, even today whenever they come up with new technology, they make sure that everyone will implement it in their own way, which is incompatible with each other. Poor artists are left to deal with all this mess.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-05, 22:04:12
Regarding tangent space, I think there are a few to consider:
Regarding my previous post, there was a mistake in the render and I did not use the correct normal map for the LOD4 mesh - the image has been updated in the post. However, the shading is still pretty rough. I think this is a meaningful comparison to illustrate my concern (see below); Corona Renderer (left) vs. Unreal Engine (right). Normal map shading artifacts for low poly geo from the Megascans library are more visible in the image rendered in Corona Renderer.

I am starting from the conclusion that has already been made, which is that the shading artifacts are not Corona Renderer's 'fault'. I am proposing whether Corona Renderer can do something about it at a feature level.

This is just one asset from the Megascans library, but if we expect similar behavior from other 3d assets in the library, that strikes me as a major point of friction, i.e. significant shading artifacts are to be expected from low poly geo in the Megascans library when rendered with Corona Renderer, out of the box.

(https://i.imgur.com/kcdn9tU.jpg)(https://i.imgur.com/BYx3xmo.jpg)



[off-topic] Regarding simulation with low poly geo, what is the general workflow for simulating with low poly LOD and replacing with high poly LOD at render time?
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-05, 22:27:40
[off-topic] Regarding simulation with low poly geo, what is the general workflow for simulating with low poly LOD and replacing with high poly LOD at render time?

You can try substitute modifier. I remember it had some issues in Corona few years ago, but by now it's probably solved.
Title: Re: Normal maps in Corona
Post by: GeorgeK on 2021-04-06, 14:02:13
Regarding tangent space, I think there are a few to consider:
  • Marmoset
  • Mikk / xNormal
  • Maya
  • 3ds Max
  • Unity 4.x
Regarding my previous post, there was a mistake in the render and I did not use the correct normal map for the LOD4 mesh - the image has been updated in the post. However, the shading is still pretty rough. I think this is a meaningful comparison to illustrate my concern (see below); Corona Renderer (left) vs. Unreal Engine (right). Normal map shading artifacts for low poly geo from the Megascans library are more visible in the image rendered in Corona Renderer.

I am starting from the conclusion that has already been made, which is that the shading artifacts are not Corona Renderer's 'fault'. I am proposing whether Corona Renderer can do something about it at a feature level.

This is just one asset from the Megascans library, but if we expect similar behavior from other 3d assets in the library, that strikes me as a major point of friction, i.e. significant shading artifacts are to be expected from low poly geo in the Megascans library when rendered with Corona Renderer, out of the box.

(https://i.imgur.com/kcdn9tU.jpg)(https://i.imgur.com/BYx3xmo.jpg)



[off-topic] Regarding simulation with low poly geo, what is the general workflow for simulating with low poly LOD and replacing with high poly LOD at render time?

Can you please clarify if your bridge export to 3ds max has 99,0 bump?
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-06, 14:48:26
This is just one asset from the Megascans library, but if we expect similar behavior from other 3d assets in the library, that strikes me as a major point of friction, i.e. significant shading artifacts are to be expected from low poly geo in the Megascans library when rendered with Corona Renderer, out of the box.

May i remind you that you're comparing LOD4 models? Even in game engine those are shown only when object is few pixels big. Nobody ever use LODs in off-line renderers. Your comparison is similar to situation where one applies 512x512 texture on an object, renders it in 4K and then complains that texture looks blurry. That simply makes no sense.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-06, 20:49:25
Right, I know what you mean. My attitude about this is really just that, "it works in Unreal Engine, it should also work in Corona Renderer".
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-06, 20:53:48
Can you please clarify if your bridge export to 3ds max has 99,0 bump?

Bump: 1.0 in the shader; corona normal texmap, strength mult: 1.0

(https://i.imgur.com/ElZU4JD.jpg)
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-06, 21:04:59
Right, I know what you mean. My attitude about this is really just that, "it works in Unreal Engine, it should also work in Corona Renderer".

Give it normal map in tangent space it's expecting and it will work just fine. You can't feed wrong input and expect right result.

I bet if you'd bake normal map in 3ds max tangent space and go to Unreal forums, requesting "look, it renders fine in Corona, make it work in UE", you would be greated with WTF looks ;]

Edit: on the other hand, i don't want to argue with you just to prove that you're wrong. Maybe the Team has different opinion about this, so i'll leave further discussion to them.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-07, 01:35:05
Give it normal map in tangent space it's expecting and it will work just fine. You can't feed wrong input and expect right result.

Right, I don't disagree with this conclusion, I'm suggesting that this posture diminishes the utility of the Megascans library in a non-trivial way.
On the other hand, maybe it would be better to bring this up with Epic / Quixel, given that one solution would be to provide normal maps baked in a tangent basis intended for use in 3ds Max(?)
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-07, 10:51:41
(https://i.ibb.co/VCQ5FYj/tenor.gif) (https://imgbb.com/)
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-07, 12:14:54
Eh, I floated the issue to the devs at Epic / Quixel, curious what their take is on the issue.

It just seems like someone is going to have to give to resolve the issue, and as you've already described, right now it's the artist.
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-07, 15:40:35
I would be very surprised if they'll show slightest interest in this issue :]
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-07, 21:42:26
You never told me you were a film actor Romullus(!)

(https://i.imgur.com/PRgecez.jpg)
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-09, 03:57:27
@romullus what about Substance Painter, which also uses Mikkt. Is there a solution for correct normal map shading in 3ds Max / Corona Renderer for normal maps baked to low poly geo in Substance Painter?
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-09, 10:30:49
Without converting normal map to correct tangent space? No, i don't think so. On the other hand, i authored textures for quite a few low-poly models in Substance Painter and never observed any significant artifacts in Corona. I don't think it's such a big problem, like you are trying to sell it, but maybe your work requires to deal with specific type of models that are indeed problematic. I think you should investigate your options to convert normal maps to proper tangent space, because it's pretty unlikely that Corona will introduce some solution for that. If some issue is affecting only handful of users, then usually it has low priority in the fix list.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-09, 10:57:47
(https://forum.corona-renderer.com/index.php?action=dlattach;topic=2466.0;attach=96138;image)

Just trying to understand - how about this model? Quite a low poly model, prepared in SP. Just baked out the normals in SP (MikkT) I assume(?)
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-09, 11:38:46
Yes, this would be good example of model that you'd expect to have problems from unsynched workflow. I baked normal map for this one in Marmoset toolbag, but i can't remember what tangent space i did choose to bake (back then tangent space concept was very new to me). I think i baked in MikkT space, because it's the most popular one. I think the most important reason why this model renders artifact free in most apps, it's because i made low-poly with smoothing groups/hard edges. This technique helps to avoid big gradients in normal map, the areas where artifacts from mismatching tangent space shows the most. If i would make such model now, i would use quite different technique for low-poly, but still i would try to minimize the issues from unsynched workflow, since i make these models with selling on stock marketplaces in mind and i have no control over where they will be used.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-09, 12:04:27
it's because i made low-poly with smoothing groups/hard edges.

Are you referring to smoothing groups by UV shells?

Marmoset has option to bake in 3ds Max tangent space, but no support for UDIM; tradeoffs
Title: Re: Normal maps in Corona
Post by: romullus on 2021-04-09, 15:31:01
Are you referring to smoothing groups by UV shells?

Actually it's the other way round - UV has to have seams where there's hard edges on the low-poly model. You don't make hard edge just because there's UV seam, you make them because you want better control over smoothing and less stress on normal map.

Marmoset has option to bake in 3ds Max tangent space, but no support for UDIM; tradeoffs

You don't need Marmoset to bake normal map in specific tangent space, you just need that your app would be able to bake object space normal map and then use Handplane to convert normal map to whatever space you need. I used Marmoset just because it has much more convenient (and at that time faster) baker than Painter.
Title: Re: Normal maps in Corona
Post by: cjwidd on 2021-04-09, 22:49:06
You don't need Marmoset to bake normal map in specific tangent space, you just need that your app would be able to bake object space normal map and then use Handplane to convert normal map to whatever space you need. I used Marmoset just because it has much more convenient (and at that time faster) baker than Painter.

That's right! +1