OctaneRender™ Standalone 3.08 TEST 4

A forum where development builds are posted for testing by the community.
Forum rules
NOTE: The software in this forum is not %100 reliable, they are development builds and are meant for testing by experienced octane users. If you are a new octane user, we recommend to use the current stable release from the 'Commercial Product News & Releases' forum.
Post Reply
User avatar
acc24ex
Licensed Customer
Posts: 1481
Joined: Fri Mar 19, 2010 10:58 pm
Location: Croatia
Contact:

how do you access toon shaders
User avatar
funk
Licensed Customer
Posts: 1206
Joined: Mon Feb 07, 2011 1:24 pm
Location: Australia

OTOY devs, there is some kind of colorspace problem with OSL shaders plugged into the normal pin on materials.

If you just output color(0.5, 0.5, 1.0) from your OSL texture, and plug it into a normal pin, the normals are incorrect (eg you will see triangle artifacts on the octane material preview ball). I have to add 2 color correction nodes after it with gamma = 2.2, to get the correct output

I noticed this while playing around with the vray flakes shader. It has an option called "flake normal orientation", which when set to 1, basically outputs color(0.5, 0.5, 1.0)

Regular RGB node to normal pin
rgb_to_normal_good.png
OSL RGB to normal pin
OSL_rgb_to_normal_bad.png
Win10 Pro / Ryzen 5950X / 128GB / RTX 4090 / MODO
"I am the resurrection, and the life: he that believeth in me, though he were dead, yet shall he live" - Jesus Christ
User avatar
funk
Licensed Customer
Posts: 1206
Joined: Mon Feb 07, 2011 1:24 pm
Location: Australia

funk wrote:Shouldn't a "metallic material" with n = 1.5, k = 0, look the same as a glossy material with IOR = 1.5?
The metallic material is shinier. Is this a case of using the wrong fresnel formula again? You've done this in the past and had to switch to non polarised
EDIT: Setting n = 0, and specular = 0.04 (4% = IOR 1.5), is getting much closer to the glossy material (although fresnel is a bit different due to schlick's approximation). So something is wrong with your n/k formula
OTOY Devs,

I did some more testing and it seems the VRay Complex IOR OSL example (https://docs.chaosgroup.com/display/OSL ... nel+shader) matches your metallic material and has the same problem (n = 1.5, k = 0 is more reflective than the glossy mat at IOR 1.5).

I found another site with a different formula (and some hlsl code) for conductors and converted it to OSL. This one looks correct at IOR 1.5
https://seblagarde.wordpress.com/2013/0 ... equations/

I thought it was worth passing this on so you can look into it.

Here is the code converted to OSL. It includes functions for another approximation, along with the vray osl function, so I could compare them.

Code: Select all

// Based on https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations/
// This seems to be the most accurate (?)

float FresnelDieletricConductor(float Eta, float Etak, float CosTheta)
{  
    float CosTheta2 = CosTheta * CosTheta;
    float SinTheta2 = 1 - CosTheta2;
    float Eta2 = Eta * Eta;
    float Etak2 = Etak * Etak;

    float t0 = Eta2 - Etak2 - SinTheta2;
    float a2plusb2 = sqrt(t0 * t0 + 4 * Eta2 * Etak2);
    float t1 = a2plusb2 + CosTheta2;
    float a = sqrt(0.5 * (a2plusb2 + t0));
    float t2 = 2 * a * CosTheta;
    float Rs = (t1 - t2) / (t1 + t2);

    float t3 = CosTheta2 * a2plusb2 + SinTheta2 * SinTheta2;
    float t4 = t2 * SinTheta2;   
    float Rp = Rs * (t3 - t4) / (t3 + t4);

    //return 0.5 * (Rp + Rs);
    return clamp(0.5 * (Rp + Rs), 0.0, 1.0);
}


// Based on the approximation at https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations/

float FresnelDieletricConductorApprox(float Eta, float Etak, float CosTheta)
{
    float CosTheta2 = CosTheta * CosTheta;
    float TwoEtaCosTheta = 2 * Eta * CosTheta;

    float t0 = Eta * Eta + Etak * Etak;
    float t1 = t0 * CosTheta2;
    float Rs = (t0 - TwoEtaCosTheta + CosTheta2) / (t0 + TwoEtaCosTheta + CosTheta2);
    float Rp = (t1 - TwoEtaCosTheta + 1) / (t1 + TwoEtaCosTheta + 1);

    //return 0.5 * (Rp + Rs);
    return clamp(0.5 * (Rp + Rs), 0.0, 1.0);
}


// Based on https://docs.chaosgroup.com/display/OSLShaders/Complex+Fresnel+shader

float fresnelVrayComplexIor(float n, float k, float c)
{
    float k2=k*k;
    float rs_num = n*n + k2 - 2*n*c + c*c;
    float rs_den = n*n + k2 + 2*n*c + c*c;
    float rs = rs_num/ rs_den;
     
    float rp_num = (n*n + k2)*c*c - 2*n*c + 1;
    float rp_den = (n*n + k2)*c*c + 2*n*c + 1;
    float rp = rp_num/ rp_den;
     
    return clamp(0.5*( rs+rp ), 0.0, 1.0);
}

float fresnel(float n, float k, float c)
{
    return FresnelDieletricConductor(n, k, c);
    //return FresnelDieletricConductorApprox(n, k, c);
    //return fresnelVrayComplexIor(n, k, c);
}

    
shader FresnelDieletricConductor (
    vector n=vector(1.5, 1.5, 1.5) [[ string description = "Refractive index for red, green, blue wavelengths (f.e. for 0.65, 0.55, 0.45 micrometers)" ]],
    vector k=vector(0.0, 0.0, 0.0) [[ string description = "Extinction coefficient for red, green, blue wavelengths (f.e. for 0.65, 0.55, 0.45 micrometers)" ]],
    output color Col_Out = color(0.5)
)
{
    float thetaCos = abs(dot(-I,N));
    float red=fresnel(n[0], k[0], thetaCos);
    float green=fresnel(n[1], k[1], thetaCos);
    float blue=fresnel(n[2], k[2], thetaCos);
    Col_Out=color(red, green, blue);
}
Win10 Pro / Ryzen 5950X / 128GB / RTX 4090 / MODO
"I am the resurrection, and the life: he that believeth in me, though he were dead, yet shall he live" - Jesus Christ
User avatar
bepeg4d
Octane Guru
Posts: 10321
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

Hi acc24ex,
just create a new one, or transform one of the existing material into a Toon material:
Screen Shot 2017-11-13 at 12.55.18.jpg
Then, you need also a Toon light, to be able to render in Toon mode:
Screen Shot 2017-11-13 at 12.56.04.jpg
Please, have a looka t the attached scene with a simple setup to have the Daylight Sun position linked with a Toon Distant Light position:
Screen Shot 2017-11-13 at 13.00.18.jpg
toonTest_01.orbx
(542.46 KiB) Downloaded 217 times
ciao beppe
User avatar
acc24ex
Licensed Customer
Posts: 1481
Joined: Fri Mar 19, 2010 10:58 pm
Location: Croatia
Contact:

cool, I did find the toon shader, but next I wanted to do just the outlines - so it looks like some sort of technical render, just the lights.. and it always looks like it's trying to do the glossy shade of that outline color.. even though specular and all is at 0.. tried ramps, same thing .. like all toons are glossy.. should be an option to turn all of that glossy outline color off

- basically, black outlines on white, if it's not yet implemented, consider that - so we can get a technical illustration out, that would be awesome
User avatar
bepeg4d
Octane Guru
Posts: 10321
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

Hi acc24ex,
you can set the specular at 0, and switch the Toon Light mode to Camera light:
IMG_0235.jpeg
ciao beppe
User avatar
acc24ex
Licensed Customer
Posts: 1481
Joined: Fri Mar 19, 2010 10:58 pm
Location: Croatia
Contact:

thanks for the info
..but I had a complex curvy object, and tried that, it looked sort of like this only on some angles, when you move around it always casted the outline color that looked like glossy..
try something curvy..
User avatar
acc24ex
Licensed Customer
Posts: 1481
Joined: Fri Mar 19, 2010 10:58 pm
Location: Croatia
Contact:

try doing a toon on this to get an outline only.. do the toon light affect this
Capture.JPG
Attachments
Cylinder18 scifi 13 02 17.OBJ
(911.56 KiB) Downloaded 207 times
User avatar
bepeg4d
Octane Guru
Posts: 10321
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

Hi acc24ex,
you need to play with the Outline Thickness value, but the issue comes with flat surfaces, not with curved surfaces:
Screen Shot 2017-11-13 at 18.25.41.jpg
Here is a different effect by mixing two different thikness with a mix material:
Screen Shot 2017-11-13 at 18.35.13.jpg
ciao beppe
User avatar
acc24ex
Licensed Customer
Posts: 1481
Joined: Fri Mar 19, 2010 10:58 pm
Location: Croatia
Contact:

thanks for the tryout.. so at low angles you get this "shine" overlay that is outline color/thickness.. check the boots on you characters at the bottom.. this is prononuced on this cylinder..

- octane guys, how about it - it will be very useful for archvis and product when you need to do a lineart type render.. tried all settings on the shader couldn't much closer than this
Post Reply

Return to “Development Build Releases”