Skip to content

Instantly share code, notes, and snippets.

@bhouston
Created October 19, 2015 17:09
Show Gist options
  • Save bhouston/1189e3c5584d94187b2b to your computer and use it in GitHub Desktop.
Save bhouston/1189e3c5584d94187b2b to your computer and use it in GitHub Desktop.
MDL Specification Simplified
// source: http://www.mdlhandbook.com/pdf/mdl_handbook.150810.LTR.pdf
// Material definition:
- Surface properties of front-facing surfaces
- Reflection
- Transmission
- Emission
- Surface properties of back-facing surfaces
- Reflection
- Transmission
- Emission
- Volume properties
- Geometric properties
- Shared properties
- Index of refraction
- Surface treated as boundary or volume
struct material_emission {
edf emission = edf(); // Light emission DF
color intensity = color(0.0);
intensity_mode mode = intensity_radiant_exitance;
};
struct material_surface {
bsdf scattering = bsdf(); // Bidirectional scattering DF
material_emission emission = material_emission();
};
struct material_volume {
vdf scattering = vdf();
color absorption_coefficient = 0.0;
color scattering_coefficient = 0.0;
};
struct material_geometry {
float3 displacement = float3(0.0);
float cutout_opacity = 1.0;
float3 normal = state::normal();
};
struct material {
uniform bool thin_walled = false;
material_surface surface = material_surface();
material_surface backface = material_surface();
uniform color ior = color(1.0);
material_volume volume = material_volume();
material_geometry geometry = material_geometry();
};
// BSDF
diffuse_reflection_bsdf:
tint: color
roughness: float
diffuse_transmission_bsdf:
tint: color
specular_bsdf:
tint: color
mode: scatter_mode (scatter_reflect, scatter_transmit, scatter_reflect_transmit)
simple_glossy_bsdf:
tint: color
roughness_u: float
roughness_v: float
tangent_u: vector3
mode: scatter_mode (scatter_reflect, scatter_transmit, scatter_reflect_transmit)
backscattering_glossy_reflection_bsdf:
measured_bsdf:
// EDF
// Light emitted in all directions from the surface of the object,
// called Lambertian light distribution by analogy to
// Lambertian diffuse reflection.
diffuse_edf:
// Distribution of the emission based on the cosine between
// emission direction and surface normal (cosinek distribution)
spot_edf:
// Light distribution based on a measured light profile.
// Arbitrary geometric structure for light distribution from the
// emissive object can be specified based on standard industrial
// formats called light profiles
measured_edf:
// parametesr for all EDFs:
- intensity: color
- mode: intensity_mode (intensity_radiant_exitance, intensity_power)
// VDF
// Addition of absorption effects and subsurface scattering to
// the material’s volume
anisotropic_vdf
// custom IORs
abbe_number_ior
// Layers
weighted_layer:
weight: float
layer: bsdf
base: bsdf
// (layer * reflection-factor) + (base * (1.0 - reflection-factor))
fresnel_layer:
ior: float
weight: float
layer: bsdf
base: bsdf
normalized_mix:
components: [ weight, bsdf ]
clamped_mix:
components: [ weight, bsdf ]
custom_curve_layer:
weight: float
normal_reflectivity: float
grazing_reflectivity: float
exponent: float
layer: bsdf
base: bsdf
measured_curve_layer:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment