Phenomena for the layering shaders
Here are the general base Phenomena currently implemented in the layering package.
Mix glossy and diffuse reflection
This Phenomenon mixes a glossy and diffuse reflection, both using the same tint color.
mila_mix_reflective
declare phenomenon color
"mila_mix_reflective" (
color "tint" default 0.7 0.7 0.7 1.0,
# Glossy
scalar "glossy_weight" default 0.5, #: min 0 max 1
scalar "glossy_roughness" default 0.4, #: min 0 max 1
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the color for glossy reflection and diffuse components.
- glossy_weight
- weight of the glossy mixed with the diffuse reflection component between 0 and 1. Simple weighted mix.
- glossy_roughness
- is the roughness of the glossy reflection component of this combination. It ranges from 0.0 (flat like a mirror) to 1.0 (like diffuse).
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Layer glossy reflection on top of diffuse reflection
This Phenomenon layers a glossy on top of a diffuse reflection, both using the same tint color. The glossy layer is directionally weighted using a fresnel ior to determine the directionally-dependent weight.
mila_layer_reflective
declare phenomenon color
"mila_layer_reflective" (
color "tint" default 0.7 0.7 0.7 1.0,
# Glossy
scalar "glossy_weight" default 0.5, #: min 0 max 1
scalar "glossy_roughness" default 0.4, #: min 0 max 1
scalar "ior" default 1.4, #: min 1 max 20 softmax 2
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the color for glossy reflection and diffuse components.
- glossy_weight
- weight of the glossy layered over the diffuse reflection component between 0 and 1. Multiplies by the directional weight.
- glossy_roughness
- is the roughness of the glossy reflection component of this combination. It ranges from 0.0 (flat like a mirror) to 1.0 (like diffuse).
- ior
- is the fresnel ior used for directionally-dependent weighting multiplied by the glossy_weight.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Mix anisotropic glossy and diffuse reflection.
This Phenomenon mixes a glossy with a diffuse reflection, both using the same tint color. Adds anisotropic controls and diffuse roughness beyond the glossy roughness.
mila_mix_reflective_aniso
declare phenomenon color
"mila_mix_reflective_aniso" (
color "tint" default 0.7 0.7 0.7 1.0,
# Glossy
scalar "glossy_weight" default 0.5, #: min 0 max 1
scalar "glossy_roughness" default 0.4, #: min 0 max 1
# Additional Glossy
scalar "anisotropy" default 1.0,
scalar "aniso_angle" default 0.0,
integer "aniso_channel" default -1,
# Diffuse
scalar "diffuse_roughness" default 0.0, #: min 0 max 1
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the color for glossy reflection and diffuse components.
- glossy_weight
- weight of the glossy mixed with the diffuse reflection component between 0 and 1. Simple weighted mix.
- glossy_roughness
- is the roughness of the glossy reflection component of this combination. It ranges from 0.0 (flat like a mirror) to 1.0 (like diffuse).
- anisotropy
- is 1.0 for isotropic reflections. The actual value is the ratio of U reflectivity to V reflectivity, meaning, both values above and below 1.0 are valid, i.e. it is the "U vector scale factor" of reflections.
- aniso_angle
- defines the rotation of the anisotropy in the UV space, and aniso_channel defines from which texture mapping channel the U and V directions are derived. If set to -1, a default canonical direction based on object space is computed (does NOT relate to any of the texture coordinate spaces).
- diffuse_roughness
- sets the (Oren-Nayar) roughness in the range 0 to 1, where 0 is standard Lambertian shading. Higher roughness values yield a more "powdery" look to the surface.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Layer anisotropic glossy reflection on top of diffuse reflection
This Phenomenon layers a glossy on top of a diffuse reflection, both using the same tint color. The glossy layer is directionally weighted using a fresnel ior to determine the directionally-dependent weight. Adds anisotropic control for the glossy reflection, and roughness for diffuse.
mila_layer_reflective_aniso
declare phenomenon color
"mila_layer_reflective_aniso" (
color "tint" default 0.7 0.7 0.7 1.0,
# Glossy
scalar "glossy_weight" default 0.5, #: min 0 max 1
scalar "glossy_roughness" default 0.4, #: min 0 max 1
scalar "ior" default 1.4, #: min 1 max 20 softmax 2
# Additional Glossy
scalar "anisotropy" default 1.0,
scalar "aniso_angle" default 0.0,
integer "aniso_channel" default -1,
# Diffuse
scalar "diffuse_roughness" default 0.0, #: min 0 max 1
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the color for glossy reflection and diffuse components.
- glossy_weight
- weight of the glossy layered over the diffuse reflection component between 0 and 1. Multiplies by the directional weight.
- glossy_roughness
- is the roughness of the glossy reflection component of this combination. It ranges from 0.0 (flat like a mirror) to 1.0 (like diffuse).
- ior
- is the fresnel ior used for directionally-dependent weighting multiplied by the glossy_weight.
- anisotropy
- is 1.0 for isotropic reflections. The actual value is the ratio of U reflectivity to V reflectivity, meaning, both values above and below 1.0 are valid, i.e. it is the "U vector scale factor" of reflections.
- aniso_angle
- defines the rotation of the anisotropy in the UV space, and aniso_channel defines from which texture mapping channel the U and V directions are derived. If set to -1, a default canonical direction based on object space is computed (does NOT relate to any of the texture coordinate spaces).
- diffuse_roughness
- sets the (Oren-Nayar) roughness in the range 0 to 1, where 0 is standard Lambertian shading. Higher roughness values yield a more "powdery" look to the surface.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Layer glossy reflection on top of diffuse reflection
This Phenomenon layers a glossy on top of a diffuse reflection, but only the diffuse uses the tint color. The glossy layer is directionally weighted using a fresnel ior to determine the directionally-dependent weight.
mila_layer_reflective_plastic
declare phenomenon color
"mila_layer_reflective_plastic" (
color "tint" default 0.7 0.7 0.7 1.0,
# Glossy
scalar "glossy_weight" default 0.5, #: min 0 max 1
scalar "glossy_roughness" default 0.4, #: min 0 max 1
scalar "ior" default 1.4, #: min 1 max 20 softmax 2
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the color for only the diffuse component.
- glossy_weight
- weight of the glossy layered over the diffuse reflection component between 0 and 1. Multiplies by the directional weight.
- glossy_roughness
- is the roughness of the glossy reflection component of this combination. It ranges from 0.0 (flat like a mirror) to 1.0 (like diffuse).
- ior
- is the fresnel ior used for directionally-dependent weighting multiplied by the glossy_weight.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Layer glossy paint reflection with flakes on top of diffuse reflection
This Phenomenon provides a base painted layer for car paint type materials. It layers a glossy with flakes on top of a diffuse reflection that can change color at the edges. Layer as many clear coats as desired, using glossy or specular reflection components over this base.
mila_layer_reflective_paint
declare phenomenon color
color "mila_layer_reflective_paint"
(
color "tint" default 0.8 0.1 0, #diffuse color
scalar "edge_weight" default 0.0,
color "edge_color" default 0 0 0, #diffuse color at grazing angles
scalar "edge_color_bias" default 1.0,
scalar "glossy_weight" default 0.2,
color "glossy_color" default 0.8 0.1 0,
scalar "glossy_roughness" default 0.6,
scalar "flake_weight" default 1.0,
color "flake_color" default 1 1 1,
scalar "flake_roughness" default 0.4,
scalar "flake_scale" default 0.05,
scalar "flake_density" default 0.8,
scalar "flake_strength" default 0.2,
integer "flake_type" default 3, #: enum "distortion1:distortion2:distortion3:cellular1:cellular2:cellular3"
integer "flake_cell_style" default 0, #: enum "edgy:circular"
scalar "flake_circle_size" default 0.3,
scalar "direct" default 1.0,
scalar "indirect" default 1.0
)
...
version 1
end declare
Layer anisotropic glossy reflection on top of glossy transmission
This Phenomenon layers an anisotropic glossy reflection on top of a glossy transmission, both using the same tint color. The glossy reflection layer is directionally weighted using a fresnel index of refraction (ior) to determine the directionally-dependent weight. Adds anisotropic control for both the glossy reflection and transmission, and uses the same ior for transmission redirection (refraction).
mila_layer_transmissive
declare phenomenon color
"mila_layer_transmissive" (
color "tint" default 1.0 1.0 1.0 1.0,
# Glossy
scalar "reflective_weight" default 1.0, #: min 0 max 1
scalar "roughness" default 0.4, #: min 0 max 1
scalar "ior" default 1.5, #: min 0 softmin 1 max 10 softmax 2
# Additional Glossy
scalar "anisotropy" default 1.0,
scalar "aniso_angle" default 0.0,
integer "aniso_channel" default -1,
# Transmission reuses ior, roughness, anisotropy
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the color for glossy reflection and transmission components.
- reflective_weight
- weight of the glossy reflection layered over the glossy transmission component between 0 and 1. Multiplies by the directional weight.
- roughness
- is the roughness of the glossy reflection component of this combination. It ranges from 0.0 (flat like a mirror) to 1.0 (like diffuse).
- ior
- is the fresnel index of refraction (ior) used for directionally-dependent weighting multiplied by the reflective_weight.
- anisotropy
- is 1.0 for isotropic reflections. The actual value is the ratio of U reflectivity to V reflectivity, meaning, both values above and below 1.0 are valid, i.e. it is the "U vector scale factor" of reflections.
- aniso_angle
- defines the rotation of the anisotropy in the UV space, and aniso_channel defines from which texture mapping channel the U and V directions are derived. If set to -1, a default canonical direction based on object space is computed (does NOT relate to any of the texture coordinate spaces).
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Layer glossy reflection on top of glossy transmission with color absorption
This Phenomenon layers a glossy reflection on top of a glossy transmission, using the tint color for the max distance color when specifying absorption with max distance. The glossy reflection layer is directionally weighted using a fresnel index of refraction (ior) to determine the directionally-dependent weight.
mila_layer_transmissive_distance
declare phenomenon color
"mila_layer_transmissive_distance" (
color "tint" default 1.0 1.0 1.0 1.0,
scalar "max_dist" default 2.0, #: min 0 softmax 5
# Glossy
scalar "reflective_weight" default 1.0, #: min 0 max 1
scalar "roughness" default 0.4, #: min 0 max 1
scalar "ior" default 1.5, #: min 0 softmin 1 max 10 softmax 2
# Transmission reuses ior, roughness, anisotropy
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is used for coloring through the transmissive material, like thick colored glass. It is the color at max_distance.
- max_distance
- is used with tint to color transmission through geometry.
- reflective_weight
- weight of the glossy reflection layered over the glossy transmission component between 0 and 1. Multiplies by the directional weight.
- roughness
- is the roughness of the glossy reflection component of this combination. It ranges from 0.0 (flat like a mirror) to 1.0 (like diffuse).
- ior
- is the fresnel index of refraction (ior) used for directionally-dependent weighting multiplied by the reflective_weight.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Layer specular reflection on top of specular transmission with color absorption
This Phenomenon layers a specular reflection on top of a specular transmission, both using the tint color. The specular reflection layer is directionally weighted using a fresnel index of refraction (ior) to determine the directionally-dependent weight. The same ior is used to determine the transmission re-direction (refraction).
mila_layer_transmissive_clear
declare phenomenon color
"mila_layer_transmissive_clear" (
color "tint" default 1.0 1.0 1.0 1.0,
# Specular
scalar "reflective_weight" default 1.0, #: min 0 max 1
scalar "ior" default 1.5, #: min 0 softmin 1 max 10 softmax 2
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is used for coloring the specular reflection and transmission.
- reflective_weight
- weight of the specular reflection layered over the specular transmission component between 0 and 1. Multiplies by the directional weight.
- ior
- is the fresnel index of refraction (ior) used for directionally-dependent weighting multiplied by the reflective_weight.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Mix diffuse reflection with a scatter component.
This Phenomenon combines diffuse reflection with subsurface scattering, and simplifies the control of the subsurface scattering. The tint color applies to the diffuse as well as the front and back scatter tint colors. The front and back colors apply to how the light is scattered. The scale_conversion can affect the distance the scatter color uses. The default values for distance is 20 units, and scale conversion affects that distance..
mila_mix_subsurface_scatter
declare phenomenon color
"mila_mix_subsurface_scatter" (
# diffuse
color "tint" default 0.7 0.7 0.7 1.0,
scalar "roughness" default 0.0,
scalar "diffuse_weight" default 0.1, #: min 0 max 1
# scatter
scalar "front_weight" default 1.0,
color "front_color" default 1.0 0.5 0.25,
scalar "back_weight" default 1.0,
color "back_color" default 1.0 0.5 0.25,
scalar "back_depth", # unassigned (zero) means "same as radius"
scalar "sampling_dist_mult" default 2.0,
scalar "scale_conversion" default 1.0,
integer "resolution" default 1,
#
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the tint applied to the front and back scatter, as well as diffuse reflection component.
- roughness
- sets the (Oren-Nayar) diffuse component roughness in the range 0 to 1, where 0 is standard Lambertian shading. Higher roughness values yield a more "powdery" look to the surface.
- diffuse_weight
- is the weight of the diffuse component, typically very small, as it defaults to 0.1
- front_weight
- is the weight (amount) of "front" scattering. The value for weight is generally left at 1.0
- front_color
- is a color allowing the modification of the scatter radii which are set to 20. Effectively scatters using this color in ratio for r, g, b. Use scale conversion to scale its effect
- back_weight
- is the weight (amount) of "back" scattering. The value for weight is generally left at 1.0
- back_color
- is a color allowing the modification of the scatter radii which are set to 20. Effectively scatters using this color in ratio for r, g, b. Use scale conversion to scale its effect
- back_depth
- defines how "deep" the scattering goes. By default it is 0.0 and means the scattering is uniform (reaches the same distance both in depth and side-to-side)
- sampling_dist_mult
- is a multiplier for the largest radii set in either of the front_radius and back_radius for within which any samples are actually taken. So if the largest of any these radii is e.g. 20 units, setting this parameter to 2.0 will cause samples to actually be taken within 40 units distance, completely ignoring any light outside that radius. Setting this value too small, can yield a visible hard cutoff to the scattering. Setting it too large, and too many samples are wasted in far away samples with extremely small contribution; since the falloff is exponential, and the scattering radii parameters are defined as "distance until 10 percent contribution" the furthest samples would have a weight of 10 percent raised to the power of this parameter (2 = 1 percent, 3 = 0.1 percent, 4 = 0.01 percent etc)
- scale_conversion
- is a divider applied on the given color * radii (20) measurements, to map the values given to actual scene units. So setting e.g. the front_color to 0.5, 0.25, 0.1 when multipled by 20 becomes 10,5,2 and with a scale_conversion to 10 makes the effective radii used 1, 0.5, 0.2
- resolution
- defines the actual resolution of the light storage. The storage is done roughly in screen space, and 1 means "same resolution as render", 2 means "half resolution", 3 means "third resolution" etc, with 0 the special case meaning "double resolution". The default is 2 (half resolution) and is often plenty. New in 3.13, the special value of -1, means brute force calculation each intersection without interpolation from previously stored values. It is useful for extreme close-ups.
- direct
- is a multiplier applied to any direct light reaching the shader
- indirect
- is a multiplier applied to any indirect light reaching the shader
Mix diffuse reflection with diffuse transmission.
This Phenomenon combines diffuse reflection with diffuse transmission. The tint color applies to both the reflection and the transmission..
mila_mix_translucent
declare phenomenon color
"mila_mix_translucent" (
color "tint" default 0.7 0.7 0.7 1.0,
scalar "roughness" default 0.0, #: min 0 max 1
scalar "diffuse_weight" default 0.1, #: min 0 max 1
#
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is used for coloring the diffuse reflection and transmission.
- roughness
- sets the (Oren-Nayar) roughness in the range 0 to 1, where 0 is standard Lambertian shading. Higher roughness values yield a more "powdery" look to the surface.
- diffuse_weight
- weight of the diffuse reflection mixed with the diffuse transmission between 0 and 1.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Mix three glossy reflection components.
This Phenomenon combines three glossy reflection components. The tint color applies to all the reflection components. Each component has a weight and a roughness separate from the others.
mila_mix_glossy_reflection
declare phenomenon color
"mila_mix_glossy_reflection" (
color "tint" default 1.0 1.0 1.0 1.0,
#
scalar "weight1" default 0.3, #: min 0 max 1
scalar "roughness1" default 0.3, #: min 0 max 1 #
scalar "weight2" default 0.3, #: min 0 max 1
scalar "roughness2" default 0.4, #: min 0 max 1 #
scalar "weight3" default 0.4, #: min 0 max 1
scalar "roughness3" default 0.5, #: min 0 max 1 #
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is used for coloring all three glossy reflection components.
- weight1,2,3
- weight of the glossy reflection mixed with the other glossy reflections between 0 and 1. All must add up to below 1, or will be cut off. In other words, it uses a mila_mix with clamp on.
- roughness1,2,3
- sets the glossy reflection roughness in the range 0 to 1, where 0 is perfect mirror reflection and 1 is diffuse.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)
Layer components for hair model.
This Phenomenon models hair as it combines a glossy reflection, transmission/transparency, and another set of glossy reflection components to model the primary reflection (R), the transmission (TT), and the secondary reflection (TRT) in hair. The tint color applies to the color coming out of the secondary reflection, as that component models the light going into a hair strand bouncing off the inside surface and transmitting back out of the hair. The half distance calculation for that color (sqrt) is used for the transmission color. The primary reflection is not tinted. The primary and secondary reflections are spread by the shift representing the normal shift applied to those components.
mila_layer_hair
declare phenomenon color "mila_layer_hair" (
color "tint" default 0.6 0.4 0.1,
scalar "shift" default 0.15,
scalar "r_weight" default 1.0, # multiplied by 1.55 ior directional
scalar "tt_weight" default 0.4,
scalar "glint_weight" default 0.6,
scalar "direct" default 1.0, #: min 0 max 1
scalar "indirect" default 1.0 #: min 0 max 1
)
...
version 1
end declare
- tint
- is the color for secondary glossy reflection component. Also used to calculate the transmission color.
- shift
- is the shift of the normal direction for both the primary and secondary reflections. The larger the shift the more the reflections spread away from each other. A value of 0 aligns them, and 0.15, the default represents a typical hair reflection spread.
- r_weight
- weight of the primary glossy reflection component. Multiplies by the directional weight using fresnel ior of 1.55.
- tt_weight
- weight of the transparent component. If set to 1, no secondary reflections will occur. The weight represents the percentage of the energy used before the secondary reflection. The leftover energy will go to the secondary reflection.
- glint_weight
- is the weight of the glint portion of the secondary reflection taken out of the regular secondary reflection. The glints are the sharper lobes that are caused by the flattened cylinder model of hair. The leftover energy becomes the energy of the regular secondary glossy reflection.
- direct
- is a multiplier for the direct light (normally 1.0)
- indirect
- is a multiplier for the indirect light (normally 1.0)