interior-mapping
Interior Mapping
Target: Three.js 0.187.0, three/webgpu and TSL node materials from three/tsl; WebGPU only, no WebGL fallback, no GLSL strings.
The companion file scripts/windowMaterial.tsl.js is the material. Copy it into the project; it imports only from three/webgpu and three/tsl.
What it is
A flat pane whose shader draws what you would see through a window: a frame and glazing bars, then blinds, curtains or net curtains a few centimetres behind the glass, then a blurred room behind them (a back wall with a doorway or far window, dark furniture masses on a middle plane). Each layer is shifted by the view ray times its depth, so the room moves with parallax as the viewer moves. The glass adds a Fresnel reflection of a fake sky, horizon and ground. At night a share of windows have their lights on, warm or cool, glowing through closed blinds. Every window picks its dressing, drop, colour, brightness and light from a seed, so no two are alike.
When to use it
- windows of buildings that cannot be entered
- many windows: a facade, a street, a city
- far cheaper than modelling rooms and lighting them, and cheaper than transmissive glass
Use real glass (the glass skill) for windows the viewer can look through into a modelled space. Model the reveal, sill and frame in geometry around the pane either way; the shader's own frame is the sash and glazing bars inside the opening.