relight-windblown-portraits
| additional_license_urls | https://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/agent-skills/web-design/relight-windblown-portraits/demo/assets/THREE-LICENSE.txt |
|---|---|
| description | Create a portrait with Seedream 5.5, isolate a true transparent PNG, relight it on pointer movement and animate windblown strands with anchored roots. Use for interactive photo heroes and still character art. |
| import_scope | signals-cleared-supporting-files |
| license | MIT |
| license_url | https://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/LICENSE |
| name | relight-windblown-portraits |
| publisher | MengTo |
| repository_url | https://github.com/MengTo/Skills |
| source_url | https://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/agent-skills/web-design/relight-windblown-portraits/SKILL.md |
| upstream_copyright | Copyright (c) 2026 Meng To, Copyright © 2010-2025 three.js authors |
| upstream_revision | 2f8cb46167bec49ee3c4a6ca37972fc065b6b47e |
Relight Windblown Portraits
Treat the portrait as one photograph with a shallow relief. Move the illumination over the still image. Bend only loose hair and add tapered flyaways that share its gust.
Prepare the cutout
-
Start with an approved photo. When the original must remain exact, go straight to isolation. For a new look, use Seedream 5.5 image editing with the reference attached. In Fil select
seedream-5.5, a square 2K frame and one output. Use this starting prompt.Preserve this person’s features, expression, eye line and hairstyle. Make a chest-up editorial portrait against a uniform mid-gray studio backdrop. Leave space above the crown and beside the windward tips. Use a broad soft key and a narrow cool edge on individual hairs. Keep detail in dark hair and both eyes. No text, checkerboard or graphic overlays.
-
Select a faithful frame before removing the background. Use a matting pass such as Fil’s
remove-background, then export an RGBA PNG. A request for transparency in the generation prompt alone does not verify alpha. Inspect the decoded alpha channel for empty corners, solid interior and partially covered fine hair. Composite over white, black and the actual scene at 200% to catch fringes. Retain the photographic alpha all the way through the shoulders. -
Keep every map registered to the same crop. The included Silver Rain example predates the 5.5 recipe. Reuse its channel conventions, then author fresh maps for the new photo.
Author the maps
- Paint a smooth near-white, far-black depth field. Start with soft shapes for head, neck and shoulders, then lift nose, brow and glasses. Keep highlights out of depth. Save a grayscale elevation map.
- Take centered differences of the blurred depth field. Normalize
(-dx * gain, -dy * gain, 1)and pack XY into RG as0.5 + 0.5 * normal.xy. Account for image Y increasing downwards when computing shader Y. Put roughness in B, low on lenses and high on fabric. Check the normal direction by sweeping a light across the nose. - Pack local relief, specular material and lens masks in RGB. For the fiber map, trace the part and locks, paint their tangent angle θ, encode
(cos(2θ), sin(2θ)) * .5 + .5in RG and hair coverage in B. Double angles avoid a seam when the tangent flips. Load data maps without color conversion. Use a neutral normal and zero specular influence wherever a map is missing.
Light and animate
Use main.js for texture setup and relight.js for the shader. Map pointer coordinates to the displayed image, flip Y once, and damp toward the target with 1 − exp(−10 dt). Subtract the resting diffuse response from the new response. Scale the difference by about 0.4 before applying it to the original RGB. Let roughness soften specular highlights. Keep the strongest strip on glass and graze hair along the tangent.
Replace the demo’s left-edge hair window with a feathered mask around free ends. Keep UV displacement near 2% at the tips and zero at the scalp. In flyaways.js, each row gives a strand count followed by four cubic Bézier points in thousandths of the image from the top left. Trace each guide from inside a lock. Vary bend, width and phase once per strand. Multiply motion by squared distance along it. Use the same gust function on both layers. Taper alpha at both ends.
Check the result
Compare opposite light directions and a paused frame. The pupils, mouth and hairline should stay registered. If the silhouette swims, shrink the wind mask. If a strand floats free, move its root further under the lock. Keep the original image until the first good render, pause offscreen and on hidden tabs, and show a static portrait for reduced motion. Preserve vertical touch scrolling. Use a general surface relighting technique for flat artwork without separate hair guides.
Run the example
From this skill folder, run python3 -m http.server 4173 --bind 127.0.0.1 -d demo and open the local demo. The demo runs without a build or remote assets. See the preview and recreation prompts.
Adapted from the Stillhertz landing page. Keep the host project's typography, subject and layout. Bring over only the relevant technique. The sample is a single page. For a routed application, cancel animation frames, remove listeners, disconnect observers and dispose GPU resources on unmount.
Copyright (c) 2026 Meng To Copyright © 2010-2025 three.js authors
The license files are attached. MIT · MIT
The attached ZIP contains the pinned supporting files cleared for import. Applicable license notices are attached or included when cleared.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.