About Store Forum Documentation Contact



Post Reply 
How set Material smoothness in code?
Author Message
yvanvds Offline
Member

Post: #1
How set Material smoothness in code?
Title says it all, I think. I am using the smoothness parameter to give my players a plastic look, when combined with Reflectivity. This works in the editor.

But how do I do that in code? I can use Material.reflect() to set the reflectivity, but Smoothness or something alike is not available.
10-21-2022 07:07 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: How set Material smoothness in code?
It's controlled through rough_mul rough_add params, you set them depending on if you have a smooth texture:

flt roughMul()C
{
if(smooth_map.is())return smooth;
return 0;
}
flt roughAdd()C
{
if(smooth_map.is())return 1-smooth;
return Sat(1-smooth);
}

in general:
rough = 1-smooth
10-22-2022 03:49 AM
Find all posts by this user Quote this message in a reply
Post Reply