material asset type
A shader and its values, or kiss3d's own surface and its values. shader names a .wesl file, [features] sets its @if flags, [params] fills its Params…
Files live in materials/. Used by boolean2d · material, boolean3d · material, material · source, mesh · material, multimesh2d · material, multimesh3d · material, particles2d · material, particles3d · material, polygon · material, shape2d · material, shape3d · material, sprite · material, text2d · material, text3d · material, tilemap · material.
A shader and its values, or kiss3d's own surface and its values. shader names a .wesl file, [features] sets its @if flags, [params] fills its Params struct by field name. A material with no shader draws a 3D node with kiss3d's own material, and its [params] are that material's; on a 2D node it draws as if none were named.
[[assets]]
id = "water"
type = "material"
shader = "shaders/water.wesl"
features = { lit = true }
# a number is an f32, [x, y] a vec2, [x, y, z] a vec3, [x, y, z, w] or "#rrggbb"/"#rrggbbaa" a vec4
params = { speed = 0.4, tint = "#3aa0ff" }
# How a node drawing it rasterizes, rather than what colour it comes out.
[surface]
alpha = "blend" # opaque, mask (a cutout), blend, or premultiplied, a blend
# whose colour carries its alpha (a shader draws it as blend)
alpha_cutoff = 0.5 # what a mask drops a fragment below
double_sided = true
transmission = 0.9 # above zero is glass: it refracts the scene behind it
ior = 1.5 # how sharply it bends light
thickness = 0.2 # how far light travels inside it, in world units
attenuation_color = "#dff0ea"
attenuation_distance = 2.0
mirror = true # show the scene reflected in this surface's own plane
mirror_intensity = 1.0
mirror_falloff = 0.0 # above zero fades the reflection as the surface turns away
mirror_normal = [0.0, 1.0, 0.0] # which way the plane faces in the node's own space
mirror_resolution_scale = 1.0 # the mirror's picture against the viewport, 0.01 to 4
mirror_render_layers = 3 # what the mirror draws, by render_layers; unset follows the camera
trace_surface = "glass" # what the path tracer takes it for: opaque, glass, metal or light
ssr = true # take screen-space reflections, while the camera's post has `ssr`;
# a node with a shader material writes none yet
ssr_intensity = 1.0
ssr_infinite_thickness = false # count every depth crossing as a hit, for thin geometry
ssr_distance_fade = true
ssr_fresnel = false # stronger at a glancing angle
With no shader, [params] takes kiss3d's surface values and the texture slots:
[[assets]]
id = "lacquer"
type = "material"
# view = "normals" # or "uvs": draw kiss3d's debug material instead of the surface
[params]
metallic = 0.0
roughness = 0.5
emission_color = "#000000"
specular_tint = "#ffffff"
reflectance = 0.5 # 0.5 is the 4% a common dielectric reflects head-on
clearcoat = 1.0 # a thin glossy layer on top, as car paint has
clearcoat_roughness = 0.05
anisotropy = 0.0 # -1 to 1 stretches the highlight across or along the tangent
anisotropy_rotation_degrees = 0.0
subsurface = 0.0 # read by the path tracer only
subsurface_radius = 0.0 # read by nothing yet
normal = "art/panel_n.png" # albedo, normal, metallic_roughness, occlusion, emissive, height
height = "art/panel_h.png"
parallax_scale = 0.1 # how deep the height map reads, in UV units
parallax_layers = 16
parallax_method = "relief" # occlusion, or relief refined by parallax_relief_steps
parallax_relief_steps = 8