Last active
May 23, 2021 17:40
-
-
Save behreajj/3dbb436c7af3c6657e69f210cdda8a7e to your computer and use it in GitHub Desktop.
Closure Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader closureExample( | |
normal Normal = N, | |
float DiffuseRoughness = 0.01, | |
color DiffuseColor = 0.0, | |
float GlassRoughness = 0.125, | |
float GlassIor = 1.45, | |
float GlassReflectivity = 0.125, | |
color GlassColor = 1.0, | |
float Pattern = 0.5, | |
output closure color Surface = diffuse(N)) { | |
closure color diff = DiffuseColor * oren_nayar(Normal, DiffuseRoughness); | |
closure color refl = reflection(Normal); | |
closure color beck = GlassColor * microfacet_beckmann_refraction( | |
Normal, GlassRoughness, GlassIor); | |
closure color glass = (1.0 - GlassReflectivity) * beck | |
+ GlassReflectivity * refl; | |
Surface = (1.0 - Pattern) * diff + Pattern * glass; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment