Corona Renderer Forum

Corona Renderer for 3ds Max => [Max] Corona Goodies - User Contributions => Topic started by: dubcat on 2015-04-21, 02:58:45

Title: Linear Falloff Map
Post by: dubcat on 2015-04-21, 02:58:45
I have recreated the linear falloff map that Viscorbel is talking about HERE (http://viscorbel.com/vray-materials-part-3-metals/)
Viscorbel has uploaded two OSL shaders that people can use in V-ray to correct the maps, but as far as I know, we can't use OSL in Corona.

I have uploaded a max 2013 scene with the custom falloff map and a Material Library.

Would be awesome if Corona got some kind of OSL support.

This is the OSL code that make linear falloff. Made by Wobi.
Code: [Select]
shader facing_ratio_linear (output color Col_Out = color(0.5))
{
float floatOut = acos (1.0 - (1 - (dot(normalize(N), normalize(I))* -1)))/(M_PI * 0.5);
    Col_Out = color(floatOut  , floatOut , floatOut );
}

Since we can't use the OSL, you have to plug the fixed falloff map into an Output map to adjust it.

(http://i.imgur.com/ZaycizD.png)
(http://i.imgur.com/fqxugXh.jpg) Look into his eyes !
(http://i.imgur.com/alvAaCA.jpg)

Enjoy.
Title: Re: Linear Falloff Map
Post by: romullus on 2015-04-21, 10:26:55
In Mental Ray one just simply plugs fallof through gamma & gain map and that's it. CoronaColor map has ability to input colors in linear or sRGB space, but unfortunatelly there's no way to plug a map in it. Maybe it's time for yet another request?

And support for OSL shaders would be great too.
Title: Re: Linear Falloff Map
Post by: Ludvik Koutny on 2015-04-21, 12:26:22
Actually, 3ds Max falloff node set to linear truly is linear, but the problem is that 3ds Max gamma correction (LWF) gamma corrects also procedural textures (as Romullus pointed out), which is often undesired. You can fix that by feeding your falloff through color correction node with Gamma set to 2.2, as on the picture below.

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=7893.0;attach=30873)
Title: Re: Linear Falloff Map
Post by: dubcat on 2015-04-21, 12:41:09
They tried the gamma fix before they made the OSL shader. But the result is not 100% correct. They said the falloff map is using "cosine of the angle" and not the "actual angle". So they are inverting the cos with arccos.

(http://i.imgur.com/EEGFCAE.jpg)
Title: Re: Linear Falloff Map
Post by: Ludvik Koutny on 2015-04-21, 14:47:48
Ah, okay. Nevermind then ;)
Title: Re: Linear Falloff Map
Post by: Juraj on 2015-04-21, 20:08:18
Interesting, so the outcome is Viscorbel was correct ?

SigerShaders might be interested in this :- )

Edit,ah found it:

Quote
The Falloff map works with the cosine of the angle, and not with the actual angle. The curve that viscorbel shows above is the graph of its inverse (the arccos function).

Best regards,
Vlado

And this :- D

Quote
I've reported this to heading of rendering engineering at Autodesk and it surprised him as well.
Dave Worthley
Title: Re: Linear Falloff Map
Post by: fco3d on 2015-04-22, 01:21:08
If I understand correct you fixed falloff, will only apply to one type of material only? one type of metal.
By CorBel shader you can change the curve depending of N and K values.

how did you get that curve any ways? I am trying to copy but it does not give me any values, just the curve.
Title: Re: Linear Falloff Map
Post by: dubcat on 2015-04-22, 15:25:23
If I understand correct you fixed falloff, will only apply to one type of material only? one type of metal.
By CorBel shader you can change the curve depending of N and K values.

how did you get that curve any ways? I am trying to copy but it does not give me any values, just the curve.

It's just a linear falloff map, so you can use it for whatever you want. The curve I have recreated is the inverse of the curve that is messing up the original falloff map. (The one I have uploaded here is still 1-2 pixel off the perfect OSL shader. Going to tweak it later today, can re-upload)
Just plug it into an Output map and adjust the curve as you usually would do.

I posted this test over at the original thread. As you can see, no normal person would see the difference. It's all about the geek inside, that knows you have been using a wrong falloff map your whole life!
(http://i.imgur.com/LdiLYkS.jpg)
Title: Re: Linear Falloff Map
Post by: fco3d on 2015-04-23, 00:26:10
Ok thanks for the answer.
I was wondering what values did you used to create that falloff, because. When I opened your file 3d Max warn me that it was created using a educational version of 3D Max, after using that falloff in a new scene, in my machine still telling me that it was created in student version :(

I won't be able to use that falloff here, if you could share the actual values ( don't know how) it would be great.
Thank you again.
Title: Re: Linear Falloff Map
Post by: dubcat on 2015-04-23, 01:51:47
Here's the new tweaked falloff.
(http://i.imgur.com/fqxugXh.jpg)

I have uploaded a Material Library for you, just download that one.

EDIT:
The Material Library was empty, fixed in the new upload
Title: Re: Linear Falloff Map
Post by: Siger on 2015-04-26, 01:13:12
Now I'm in progress on free Texmap plugin based on Vlado OSL code: http://forums.chaosgroup.com/showthread.php?81605-Complex-fresnel-using-VRayOSLtex&p=651334#post651334
Test on Corona - OK :) Now adding presets.
Title: Re: Linear Falloff Map
Post by: dubcat on 2015-04-26, 06:23:54
Now I'm in progress on free Texmap plugin based on Vlado OSL code: http://forums.chaosgroup.com/showthread.php?81605-Complex-fresnel-using-VRayOSLtex&p=651334#post651334
Test on Corona - OK :) Now adding presets.
Great work as always :)
Title: Re: Linear Falloff Map
Post by: romullus on 2015-04-26, 09:34:30
Now I'm in progress on free Texmap plugin based on Vlado OSL code: http://forums.chaosgroup.com/showthread.php?81605-Complex-fresnel-using-VRayOSLtex&p=651334#post651334
Test on Corona - OK :) Now adding presets.

Wow, looking forward to it!
Title: Re: Linear Falloff Map
Post by: steyin on 2015-04-27, 17:45:43
Sorry to be OT, but is there anyway to change the threads on the vray forum to descending? I hate reading newest posts from the bottom to the top. All I can find is the linear option, which doesn't allow to edit ascending->descending.

That aside, this looks very promising. Already downloaded the beta, will give it a whirl later.
Title: Re: Linear Falloff Map
Post by: danielmn on 2015-05-01, 20:00:53
I could get the Linear falloff shader to work, so I moved on to what viscorbel talked about, that glossy reflection have a sharpness as they approach the 90 degree of incidence.

Here is a test I did with Siger's Complex Fresnel Shader.  Thanks to the guys at Siger btw.