Turn one illustration into an animated 2D mesh avatar with a coding agent and a local editor
Document lighting
shinshin86e4f58de2f647
diff --git a/README.ja.md b/README.ja.mdindex 5e1b5d9..0a56d47 100644--- a/README.ja.md+++ b/README.ja.md@@ -78,6 +78,8 @@ npm run devどちらの画面もローカルの開発サーバー(`npm run dev`)で使います。操作画面からの更新が止まると、配信用画面は待機動作に戻ります。+「ライティング」を有効にすると、ドラッグで動かせる光源に合わせてアバターに陰影が付きます。初期状態はオフです。配信の操作画面の下のほう、またはエディタのプレビューの下にある欄で設定でき、設定はOBS用URLにも含まれます。詳しくは[リファレンス](docs/reference.md#lighting)(英語)を参照してください。+操作画面は専用のウィンドウで開いたままにしてください。OBS用URLはOBSの中か別のタブで開き、操作画面のタブには貼り付けないでください。画面が隠れて追跡が停止・低速になったという表示が出た場合は、操作画面のウィンドウを前面に戻してください。diff --git a/README.md b/README.mdindex c668d17..a0fce19 100644--- a/README.md+++ b/README.md@@ -109,6 +109,10 @@ directly in OBS. For other capture software, choose green and apply a chroma keyBoth pages use the local development server (`npm run dev`). The stream view shows idlemotion when the Live page stops sending updates.+Optional **Lighting** adds shading that follows a light you drag over the avatar. It is off+by default; open its section near the bottom of the Live page, or below the preview in the+editor. The OBS URL includes the lighting settings. See [Lighting](docs/reference.md#lighting).+Keep the Live page open in its own window. Open the OBS URL inside OBS or in anothertab; do not paste it into the tab running Live. If the page reports that tracking hasstopped or slowed while hidden, bring its window to the front.diff --git a/docs/reference.md b/docs/reference.mdindex a2002dd..ddbeb90 100644--- a/docs/reference.md+++ b/docs/reference.md@@ -120,6 +120,35 @@ need a writable project from the development server. The app keeps images local;Codex card discloses the image-generation upload before you copy its request; otherexternal services are excluded from that request.+## Lighting++**Lighting** is optional and off by default. Open the collapsed **Lighting** section below the+**Pose test** and **Lip sync** tabs, or near the bottom of the Live page, and choose **Enable lighting**.+While the section is open, a light handle appears over the preview; drag it, or focus it and+use the arrow keys (Shift moves further). The section title shows **ON** while lighting is enabled.++The shape used for shading is inferred from the single image: each layer's silhouette is+rounded, the head is treated as an ellipsoid, and dark painted strokes add shallow relief.+It is computed once per layer when lighting is first enabled. Painted shadows in the artwork+are kept; the light deepens colours on the far side and keeps the painted colour on the lit side.++| Control | Effect |+|---|---|+| Light height | Low values light from the side; high values light from the front |+| Light spread | How far the light reaches before it fades |+| Intensity / Ambient light | Direct light and the even base light |+| Light color / Ambient color | Colours of the direct and ambient light |+| Strength | Blend between the original artwork and the lit result |+| Shading smoothness | Width of the transition between lit and shaded areas |+| Gloss / Rim light | Small highlights, and light along edges facing the light |+| Stroke relief | Relief taken from painted strokes such as hair lines |+| Shading | **Soft** or **Cel** (stepped, anime style) |+| Drop shadow | A soft silhouette shadow behind the avatar, opposite the light |++**Reset lighting** restores the defaults. Settings are presentation only: they are not saved+in `rig.json`, but each project remembers them in this browser. With lighting off, the avatar+renders exactly as without the feature.+## Live and streamingTwo pages served by the development server (`npm run dev`):@@ -136,8 +165,20 @@ Two pages served by the development server (`npm run dev`):| `bg` | `transparent`, `green`, `blue` or a hex colour such as `#336699` | `transparent` || `fit` | `contain` (whole avatar) or `cover` (fill the frame) | `contain` || `idle` | `1` (idle motion, blinking, breathing, hair sway) or `0` | `1` |--Any other `bg` value falls back to transparent. In OBS, add the URL as a **Browser Source**+| `light` | `1` enables [lighting](#lighting); omit it for no lighting | off |+| `lx`, `ly` | Light position across and down the frame, `0`–`1` | `0.2`, `0.2` |+| `lz` | Light height, `0.1`–`2` | `0.45` |+| `lr` | Light spread, `0.2`–`3` | `1.2` |+| `li`, `la` | Intensity `0`–`2`, ambient light `0`–`1` | `0.8`, `0.4` |+| `lc`, `lac` | Light and ambient colours as six hex digits without `#` | `ffffff`, `eef0f8` |+| `ls`, `lf` | Strength and shading smoothness, `0`–`1` | `0.8`, `0.45` |+| `lsp`, `lrim`, `ld` | Gloss, rim light and stroke relief, `0`–`1` | `0.12`, `0.3`, `0.4` |+| `lm` | `soft` or `cel` | `soft` |+| `shadow` | `1` adds the drop shadow | `0` |++Any other `bg` value falls back to transparent. Out-of-range lighting values are clamped,+and invalid ones use the default. **Copy OBS URL** and **Open stream view** include the+Live page's current lighting settings. In OBS, add the URL as a **Browser Source**(for example 1080 × 1080); the transparent background needs no chroma key. Use green or bluefor software without transparency support.@@ -148,6 +189,8 @@ for software without transparency support.numeric messages and rebroadcasts them; each stream view applies only messages for its own`project`.- When updates stop for one second, the stream view eases back to idle motion.+- Lighting changes on the Live page reach matching stream views the same way. The server+ accepts only complete settings made of numbers and the listed options.- Tracking runs in a Web Worker, so it continues while the Live page is hidden: in anothertab, minimised, or behind another window. Frames come from `MediaStreamTrackProcessor` whereavailable, otherwise from `requestVideoFrameCallback` or a worker timer. If tracking still