Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Constants

LAYER_BASE

#

LAYER_CLEARCOAT

#

CUBEMAP_TYPE_CROSS_VERTICAL

#

CUBEMAP_TYPE_CROSS_HORIZONTAL

#

CUBEMAP_TYPE_SEQUENCE_VERTICAL

#

CUBEMAP_TYPE_SEQUENCE_HORIZONTAL

#

X_PLUS

#

X_MINUS

#

Y_PLUS

#

Y_MINUS

#

Z_MINUS

#

Z_PLUS

#

Structures

LayerLightingInput

#

LightingInput

#

Input to a lighting function (point_light, spot_light, directional_light).

struct LightingInput {
layers: array<LayerLightingInput, 2>, STANDARD_MATERIAL_CLEARCOAT
layers: array<LayerLightingInput, 1>, !STANDARD_MATERIAL_CLEARCOAT
P: vec3<f32>,
V: vec3<f32>,
diffuse_color: vec3<f32>,
metallic: f32,
F0_dielectric: vec3<f32>,
F0_metallic: vec3<f32>,
F_ab: vec2<f32>,
clearcoat_strength: f32, STANDARD_MATERIAL_CLEARCOAT
anisotropy: f32, STANDARD_MATERIAL_ANISOTROPY
Ta: vec3<f32>, STANDARD_MATERIAL_ANISOTROPY
Ba: vec3<f32>, STANDARD_MATERIAL_ANISOTROPY
}

DerivedLightingInput

#

Functions

getDistanceAttenuation

#

light radius is a non-physical construct for efficiency purposes, because otherwise every light affects every fragment in the scene

fn getDistanceAttenuation (
distanceSquare: f32,
inverseRangeSquared: f32
) -> f32

getRangeFalloff

#

Falloff without the distance attenuation, for lights that have it baked-in (eg LTC lights)

fn getRangeFalloff (
distanceSquare: f32,
inverseRangeSquared: f32
) -> f32

D_GGX

#

D_GGX_anisotropic

#

V_SmithGGXCorrelated

#

Visibility function (Specular G) V(v,l,a) = G(v,l,α) / { 4 (n⋅v) (n⋅l) } such that f_r becomes f_r(v,l) = D(h,α) V(v,l,α) F(v,h,f0) where V(v,l,α) = 0.5 / { n⋅l sqrt((n⋅v)^2 (1−α2) + α2) + n⋅v sqrt((n⋅l)^2 (1−α2) + α2) } Note the two sqrt’s, that may be slow on mobile, see https://google.github.io/filament/Filament.md.html#listing_approximatedspecularv

fn V_SmithGGXCorrelated (
roughness: f32,
NdotV: f32,
NdotL: f32
) -> f32

V_GGX_anisotropic

#

ggx_vndf_pdf

#

sample_visible_ggx

#

G_Smith

#

V_Kelemen

#

F_Schlick_vec

#

F_Schlick

#

fresnel

#

specular_multiscatter

#

derive_lighting_input

#

compute_specular_layer_values_for_point_light

#

Returns L in the xyz components and the modified roughness in the w component.

fn compute_specular_layer_values_for_point_light (
input: ptr<function, LightingInput>,
layer: u32,
V: vec3<f32>,
light_to_frag: vec3<f32>,
light_radius: f32,
distance: f32
) -> vec4<f32>

specular

#

Cook-Torrance approximation of the microfacet model integration using Fresnel law F to model f_m f_r(v,l) = { D(h,α) G(v,l,α) F(v,h,f0) } / { 4 (n⋅v) (n⋅l) }

fn specular (
input: ptr<function, LightingInput>,
derived_input: ptr<function, DerivedLightingInput>,
roughness: f32,
specular_intensity: f32
) -> vec3<f32>

specular_clearcoat

#

specular_anisotropy

#

Fd_Burley

#

F_AB

#

EnvBRDFApprox

#

perceptualRoughnessToRoughness

#

cubemap_uv

#

specular_fix_remap

#

The ideal solution is to switch to Linearly Transformed Cosines, which is more accurate in all cases, and a popular choice for realtime.

fn specular_fix_remap (
a: f32
) -> f32

point_light

#

spot_light

#

directional_light

#

ltc_integrate_edge

#

Integrate one edge of the spherical polygon formed by the LTC-transformed quad. Implements Eq. 11 using a polynomial approximation based on https://advances.realtimerendering.com/s2016/s2016_ltc_rnd.pdf Using the equation as-is produces visible artifacts.

fn ltc_integrate_edge (
v1: vec3<f32>,
v2: vec3<f32>
) -> f32

ltc_integrate_quad

#

rect_light

#

sample_transmittance_lut

#
Contents