Chaos Corona Forum

Chaos Corona for Cinema 4D => [C4D] Bug Reporting => [C4D] Resolved Bugs => Topic started by: danielsian on 2018-02-01, 02:54:22

Title: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-01, 02:54:22
Hi guys

EDIT: please see the project file attached

I'm working in a character with hair/fur and I'm experiencing a weird problem with Polygon Hair shader.
It's hard to explain so I'm attaching some images to show the problem.

I did 2 sets of render tests, the first using a standard Corona material with off-white color only. Everything works as expected.
Then I just applied another material with Polygon Hair shader in my Hair object. The result you can see, looks like there is a reflector bouncing the light on my model, and resulting in a wrong lighting and funny colorization.

I suppose this is a bug not hard to address a solution.
I'd be glad if it's possible to fix this so I can proceed with my project without issues.

Thanks
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-02, 03:22:31
Did you disable the specularity in the c4d hair material? (if you're using that as source)
It doesn't create correct highlights(no traced reflections) if the native or flat hair is not used.
The highlights are also way to bright.
Those things could affect the overall look and the problems you've described.
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-02, 05:11:10
I made a lot of tests before to post here, so I'm sure this is something I can't control.

I tried also turn off all the channels, leaving only Diffuse, but the same problem happens.

If you are happy to test by yourself, the project file is attached. Maybe you have a new idea and can find a different solution.

Thanks for your help!
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-03, 00:10:54
So from what I can see, the undesired color comes from the spherical light with the light yellowish tone. It disappears when you decrease the saturation.
I also did a test with another renderer, placed lights at the same place, same colors etc. and the result was pretty much the same.
So it doesn't stem from the material but the color of the light.(40°,14%,100%)
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-03, 09:05:12
yes, I agree the problem is related with light. To be precise, colored light.
I've tried already to change all the lights, but the result is the same, so there is no relation with the shape, but only color.

I have another light just illuminating a different object in my scene, far away from my dog and with Include option on, just to illuminate that specific object. But even in that case that light is affecting the hair and makes the colorization more visible.

I'm proceeding with my project without colors in my illumination just to avoid problems. I'll try to put some warm temperature in post because it's the only way to attenuate the problem. Once the hair receive any ray other than white, we start to see a weird result.
So, I'm using white lights (the same settings as the sample I shared earlier) but I still can see a wrong colorization in the shadows (attached image). Probably it's related to non-white rays from bounces.

I'll try to make another test and making the problem more evident.

Thanks
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-03, 15:12:48
Yes, I think Post would be the best to get rid of those areas.
However, I noticed that the yellow color affects the fur overall, it's just more prominent in the shadowed areas.
For me, it looks like as if someone added an ambient light. (Same result in AR too)
You could try a darker light with the same degree&saturation or switch to a more directionalized area light.
Another thing would be to add some grayish-white color to the translucency which could absorb some of the yellow.
Also, before going to post, maybe you'll find the answer in one of the multipass channels.
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-03, 23:45:24
I have rendered already, and I can see the yellowish color only on Indirect pass.
I'm surprised you can see the problem in AR as well.
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-04, 01:14:15
I used the preset color first, then a neutral fill and at last a bluish tone.
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-05, 10:29:45
Just to make the problem more evident I'm using a pinky rim light.

This rim light is supposed to illuminate only the left edge, but as we can see, is coloring overall in a wrong way.

Please, anyone from development team, help me to fix this problem?

Thanks
Title: Re: Hair Shader is causing weird lighting variation
Post by: houska on 2018-02-06, 17:58:45
I don't know man...

First of all - we are going to add support for hair in Beta 2, so nothing can be guaranteed right now.

That said, I tried your scene and I must say I was a little bit confused by the stack of materials on the Hair object. What are you trying to achieve?
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-06, 20:00:08
I'm trying to use a color map to paint the hair based on UV, like the first example.

As you know if we apply a color map on Diffuse channel, this texture will be repeated for every single hair and this is not what I need.

I hope I was clear in my explanation.
Thanks
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-06, 21:34:47
... I was a little bit confused by the stack of materials on the Hair object. What are you trying to achieve?

Forget the stacking. I left both tags there just to help tests.
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-08, 10:05:14
... First of all - we are going to add support for hair in Beta 2, so nothing can be guaranteed right now.

I'm following the Road Map and I'm looking forward to have a Corona's Hair shader.
But I presume it is interesting to have an alternative until Beta 2 arrive. And this is the way to go once we dont have a Corona hair shader.

This technique, using Cinema 4D's Hair Shader inside a Corona Material, is awesome because makes possible to have some access to parameters normally unreachable in Hair material, like Color.

Currently there is no option to colorize the hair based on UV unless we use Hair Shader.
Don't forget this technique looks like is the unique way to render Hair properly with Corona if you need color in it, and it's working already with limitations.

Should be simple to fix this, isn't?
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-08, 16:09:54
I don't see what there is to fix.
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-08, 19:48:59
I don't see what there is to fix.
Did you see the pink version I posted above?
Is that normal for you?
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-08, 22:28:51
It actually is.
I think you'll find the solution in the illumination channel of the c4d hair material. reflection, translucency etc. are still turned on and affecting the look heavily.

It should also be mentioned that the c4d hair shader gives overbright results and the color has to be tweaked & toned down if you want it to look "properly" in Corona.(even with spec/backlight turned off)





Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-09, 11:46:31
It actually is.
I think you'll find the solution in the illumination channel of the c4d hair material. reflection, translucency etc. are still turned on and affecting the look heavily.

It should also be mentioned that the c4d hair shader gives overbright results and the color has to be tweaked & toned down if you want it to look "properly" in Corona.(even with spec/backlight turned off)
You are misunderstanding the problem. Nothing that I change in Illumination tab fixes the BUG.
I'll try to explain again.

Key Light = top light, white color
Back Light = Left side, pink color

If I use only Key, nice result, top illumination, dark shadow.
If I use only Back Light, nice result, extreme left illumination drawing the silhouette on the left edge only.

If I use Both lights at the same time the Back Light cross the model and illuminates everything, like if the Key Light was pink.

Is this the expected result?
Of course not!
Title: Re: Hair Shader is causing weird lighting variation
Post by: TomG on 2018-02-09, 14:00:51
What is the result from other render engines? Wondering if this bug is with Corona, or with the C4D hair material (or hair system itself), so would be great to see comparisons. Thanks!
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-09, 17:05:54
If the pink light still penetrates the mesh and colorizing the hair with a normal material, without the hair shader plugged in, then it's likely to assume that the hair shader is the problem.
As I mentioned, the shader wasn't constructed for this purpose, it was for c4d's renderer and using polygonal hair.
There are a lot of things that don't work well.
As for the illumination tab, things like translucency, reflection, even shading affects the colors. It might be that the light hits the roots of the hair somehow and those transmit the color all over the hair, together with the bounces, it might be even worse.

To be clear: I meant that you might find the solution in the hair materials illum. tab, not the shaders. (pic1)
You can decrease the colorization, not completely but to a certain level. A Rayswitch material could also help. It won't be perfect with the hair shader and I'd make use of some multipass channels to get rid of those.

2.pic: RS render with the c4d hair material connected to the RS hair.
If you want more RS examples, you'll have to wait until next week when I visit my gpu-buddy again.


Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-10, 10:13:13
What is the result from other render engines? Wondering if this bug is with Corona, or with the C4D hair material (or hair system itself), so would be great to see comparisons. Thanks!
Using Physical Render we have a expected result. No surprises.

If you wanna check the file, see attached a Corona version and a Physical version.

So, I presume Corona is not being able to deal with Polygon Hair shader.

Thanks
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-10, 12:20:48
... the shader wasn't constructed for this purpose, it was for c4d's renderer and using polygonal hair.
There are a lot of things that don't work well.
Yes, I agree, all the shaders in Cinema 4D were constructed to work only in Cinema 4D.
And because of this, Corona is trying to adapt it´s code and fix every error and bug in order to have everything working fine, including Polygon Hair shader.

... As for the illumination tab, things like translucency, reflection, even shading affects the colors. It might be that the light hits the roots of the hair somehow and those transmit the color all over the hair, together with the bounces, it might be even worse.

As I said earlier, nothing in Illumination tab is going to fix the problem. It changes a little, but the problem is not fixed.

Thanks
Title: Re: Hair Shader is causing weird lighting variation
Post by: Eddoron on 2018-02-10, 12:44:11
Not solving the problem entirely, but it could make post easier.
BTw, What about just rendering the rim, key separately, maybe use light passes for that and then combining the image? That could go quickly.
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-10, 13:20:04
Not solving the problem entirely, but it could make post easier.
BTw, What about just rendering the rim, key separately, maybe use light passes for that and then combining the image? That could go quickly.

The dog is done already, everything alright thanks to post production.
To reduce the colorization I had to use only white lights. Then I fixed the remaining problem in Photoshop, and add the warmness  as I was looking for before to desaturate my lights.

But I have more animals to do so I need to have everything working well from my raw render.
Title: Re: Hair Shader is causing weird lighting variation
Post by: houska on 2018-02-12, 15:27:40
So I looked into the issue briefly and I cannot find out what the cause is. Indeed, the colorization should not be there, because your rim light is behind the object and thus should not appear on the "hair".

As I said earlier, we will be looking into C4D hair later. To fix your issue would mean understanding how C4D hair is done internally and that's non-trivial. When we do a more thorough investigation, we might as well implement the Corona hair already.

I'm sorry to be the bearer of bad news, but you'll have to wait for hair to appear in a Beta 2 daily build.
Title: Re: Hair Shader is causing weird lighting variation
Post by: danielsian on 2018-02-12, 22:56:50
Thanks houska

I'm looking forward to see the Corona's hair.