LYGIA Shader Library

2f0 (lygia/v1.2.0/lighting/ior/2f0)

index of refraction to reflectance at 0 degree https://handlespixels.wordpress.com/tag/f0-reflectance/

Dependencies:

Use:

<float|vec3|vec4> ior2f0(<float|vec3|vec4> ior)

Check it on Github



#ifndef FNC_IOR2F0
#define FNC_IOR2F0
float ior2f0(const in float ior) { return pow2(ior - 1.0) / pow2(ior + 1.0); }
vec3 ior2f0(const in vec3 ior) { return pow2(ior - 1.0) / pow2(ior + 1.0); }
vec4 ior2f0(const in vec4 ior) { return vec4(pow2(ior.rgb - 1.0) / pow2(ior.rgb + 1.0), ior.a); }
#endif

Dependencies:

Use:

<float|float3|float4> ior2f0(<float|float3|float4> ior)

Check it on Github



#ifndef FNC_IOR2F0
#define FNC_IOR2F0
float ior2f0(const float ior) { return pow2(ior - 1.0) / pow2(ior + 1.0); }
float3 ior2f0(const float3 ior) { return pow2(ior - 1.0) / pow2(ior + 1.0); }
float4 ior2f0(const float4 ior) { return float4(pow2(ior.rgb - 1.0) / pow2(ior.rgb + 1.0), ior.a); }
#endif

License

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository