organicFilm.shader
- .metadata15 B
- README.md1.4 KB
- preview.png28.3 KB
- properties.yaml1.3 KB
- shader.wgsl4.2 KB
README.md
organicFilm
Structural colour without metal, for organicMaterials' scalesFish and chitinBeetle. A fish's silver comes from guanine crystal stacks and a beetle's green-to-violet from stacked chitin layers. Both are non-metallic multilayer reflectors, so this shader keeps metallic at 0 and models the stack directly:
stack_white: the share every wavelength reflects face-on (the fish's silver), carried by the engine's own Fresnel, highlights and reflections through a raised effective index;stack_color: interference colour in highlights AND in everything the surface mirrors, R(λ) = (½ + ½ cos(2π · 2 n d cosθ / λ))^film_sharpnessat 650 / 550 / 450 nm, withfilm_iorn and a per-pixel layer thickness d =film_thickness+film_spread× (2a − 1) read from the base colour texture's alpha. A 335 nm chitin stack reflects green face-on and slides through blue to violet at a slant;- the base colour's rgb is the pigment under the stack (dark melanin for the beetle);
clearcoat/clearcoat_roughnessfor a hard varnish.
The engine's own thin-film lobe colours only direct highlights, so under soft light an iridescent surface showed just its dark base; this is why the shader exists. It hands its surface to zero_pbr_shade, so albedo, roughness, metallic (0) and normal passes read real data. Four sampled textures.