The face owns its placement, not the take that holds it
The source-to-stage mapping moves off :main's :face group and onto each face's own :place, above its head. `face-placement` computes exactly what it computed before, over every subject together, so two faces filmed side by side keep their filmed relation — it is written into each face instead of onto a group above them all. Same transform, same subtree, one level lower, and the composite is identical to the pixel: a digest over every op :main emits across the whole take is unchanged either way. THE OWNER IS THE POINT. A face carrying its own mapping is the right size wherever it is put — dropped into another symbol, or opened in its own tab to be drawn over — and the take that holds it needs to know nothing. On a group above the instances the scale belonged to the take, so a face taken out of it had no size at all and drew at a fraction of a pixel. The pool's thumbnails drop the workaround that knew about this: a symbol is rendered rooted at itself again, because a face now carries the placement that makes that honest, so the pool needs to know nothing about where a symbol happens to be used. `domain/node` and `arthur.export` leave its requires with it. The tests here were reading the placement off :main. The photo registration test changes shape rather than location: its premise was that face-1's head is its own root, so a photo sitting where it was filmed was image pixels over image height and nothing else. The head still cancels — that is what the test is about — but it now cancels against the face's own placement, which is why the photo comes with the face into its own tab instead of sitting at a fraction of a pixel beside it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
e6d0ededb1
commit
a4ce750be2
9 changed files with 106 additions and 85 deletions
|
|
@ -25,7 +25,8 @@
|
|||
oval's bbox and zooms until the face is 80% of the raster height, so every
|
||||
stored vertex carries a cropping decision made once, at analysis time, from one
|
||||
frame's landmarks. Here the geometry stays in the node's own local space and the
|
||||
framing is `[:xform :*]` on an authored `:face` node, which the stage clips.
|
||||
framing is `[:xform :*]` on each face's own authored `:place` node, which the
|
||||
stage clips.
|
||||
Project dimensions are therefore independent of the footage — see
|
||||
`face-placement`, and \"What space geometry is in\" in docs/animation-model.md.
|
||||
|
||||
|
|
@ -396,7 +397,8 @@
|
|||
The synthetic take uses the reference rigid configuration for its default.
|
||||
Real footage can request `:fit-motion?`: its default fits the observed mouth,
|
||||
eyes and brows in the stage across the shot.
|
||||
Both are ordinary editable transforms on :face, never baked into the geometry.
|
||||
Both are ordinary editable transforms on the face's own `:place`, never baked
|
||||
into the geometry.
|
||||
The face oval is not measured, because its only consumers in the prototype were
|
||||
the old baked framing transform and the placeholder plate outline.
|
||||
|
||||
|
|
@ -419,8 +421,18 @@
|
|||
leaves the jaw and the mouth on the stage. Whatever hangs off is clipped, which
|
||||
is not a feature to add: every fill in `domain/raster` clamps already.
|
||||
|
||||
All subjects share one source-to-stage mapping on the :face group. Each
|
||||
instance can then be placed independently with ordinary transform channels."
|
||||
ONE MAPPING, COMPUTED OVER EVERY SUBJECT AND WRITTEN INTO EACH FACE. It is
|
||||
measured across all of them together — which is what keeps two faces filmed
|
||||
side by side in their filmed relation — and then stored on each face's own
|
||||
`:place` rather than on a group above them all. Same transform, same subtree,
|
||||
one level lower: the composite is identical to the pixel.
|
||||
|
||||
THE OWNER IS THE POINT. A face carrying its own source-to-stage mapping is a
|
||||
face that is the right size wherever it is put — dropped into another symbol,
|
||||
or opened in its own tab to be drawn over — and the symbol that places it needs
|
||||
to know nothing. On a group above the instances the scale belonged to the take,
|
||||
so a face taken out of that take had no size at all and drew at a fraction of a
|
||||
pixel."
|
||||
[{:keys [stage fit-motion?]} subjects]
|
||||
(let [[w h] stage
|
||||
inputs (vals subjects)]
|
||||
|
|
@ -646,6 +658,17 @@
|
|||
;; ---------------------------------------------------------------------------
|
||||
;; the clip
|
||||
|
||||
(defn- place-in
|
||||
"Put the source-to-stage mapping on symbol `sym`'s own `:place`, above its head.
|
||||
|
||||
`:place` is the one authored node a freeze leaves on a face, and `face-placement`
|
||||
says why it is a default rather than a measurement."
|
||||
[sym channels]
|
||||
(-> sym
|
||||
(assoc-in [:nodes :place] {:id :place :name "source placement" :kind :group
|
||||
:z "a1" :channels channels})
|
||||
(assoc-in [:nodes :head :parent] :place)))
|
||||
|
||||
(defn- subject-part
|
||||
"A subject's drawing, metadata and blocks. Node names are symbol-local."
|
||||
[params subject {:keys [outer eyes brows teeth] :as inputs}]
|
||||
|
|
@ -727,10 +750,11 @@
|
|||
[{:keys [name fps stage expose] :as params} subjects]
|
||||
(when-not (and (map? subjects) (seq subjects)
|
||||
(every? keyword? (keys subjects))
|
||||
(not-any? #{:main :root :face} (keys subjects)))
|
||||
(throw (ex-info "a freeze needs subjects with ids distinct from :main, :root and :face" {})))
|
||||
(not-any? #{:main :root :place} (keys subjects)))
|
||||
(throw (ex-info "a freeze needs subjects with ids distinct from :main, :root and :place" {})))
|
||||
(let [ordered (sort-by (comp str key) subjects)
|
||||
parts (mapv (fn [[id inputs]] [id (subject-part params id inputs)]) ordered)
|
||||
placement (face-placement params subjects)
|
||||
lengths (distinct (map #(get-in % [1 :symbol :frames]) parts))
|
||||
_ (when-not (and (= 1 (count lengths)) (pos? (first lengths)))
|
||||
(throw (ex-info "subjects need the same positive frame count"
|
||||
|
|
@ -745,17 +769,16 @@
|
|||
(into {:main
|
||||
{:id :main :frames nf
|
||||
:nodes (into {:root {:id :root :name "clip" :kind :group :z "a1"
|
||||
:time {:mode :map :expose expose}}
|
||||
:face {:id :face :name "source placement" :kind :group
|
||||
:parent :root :z "a1"
|
||||
:channels (face-placement params subjects)}}
|
||||
:time {:mode :map :expose expose}}}
|
||||
(map-indexed
|
||||
(fn [i [id _]]
|
||||
[id {:id id :kind :instance :parent :face
|
||||
[id {:id id :kind :instance :parent :root
|
||||
:z (str "a" i)
|
||||
:source {:symbol id}}]))
|
||||
ordered)}}
|
||||
(map (fn [[id part]] [id (:symbol part)])) parts)}]
|
||||
(map (fn [[id part]]
|
||||
[id (place-in (:symbol part) placement)]))
|
||||
parts)}]
|
||||
(doseq [[subject inputs] ordered
|
||||
[id track] (:presence inputs)]
|
||||
(when-not (and (= nf (count track))
|
||||
|
|
|
|||
|
|
@ -45,9 +45,7 @@
|
|||
footage stay separate records on the server, so dropping the same file twice
|
||||
does not decode it twice."
|
||||
(:require [arthur.domain.clip :as clip]
|
||||
[arthur.domain.node :as node]
|
||||
[arthur.domain.raster :as raster]
|
||||
[arthur.export :as export]
|
||||
[arthur.events.footage :as footage]
|
||||
[arthur.events.playback :as pb]
|
||||
[arthur.events.project :as project]
|
||||
|
|
@ -74,35 +72,16 @@
|
|||
;; cache's.
|
||||
(atom {:clip nil :urls {}}))
|
||||
|
||||
(defn- placed-in
|
||||
"Where `sid` is placed, as `[host-symbol node-id]`, or nil for one nothing
|
||||
places. Lowest ids first, so a symbol placed several times gets one picture and
|
||||
the same one every time."
|
||||
[document sid]
|
||||
(first (for [h (sort-by str (keys (:symbols document)))
|
||||
n (sort-by str (keys (get-in document [:symbols h :nodes])))
|
||||
:when (contains? (node/sources (get-in document [:symbols h :nodes n])) sid)]
|
||||
[h n])))
|
||||
|
||||
(defn- draw-symbol
|
||||
"`sid`'s first frame as a PNG data URL, through the resolver and the rasteriser
|
||||
the stage uses — so the picture in the pool is the picture, not a sketch of it.
|
||||
|
||||
THROUGH THE PLACEMENT, WHERE THERE IS ONE, and this is the whole subtlety.
|
||||
Rooting at a symbol renders its DRAWING, in its own local space; a rotoscoped
|
||||
face is stored head-local in units of one image height, so its numbers are
|
||||
around 0..1 and the source-to-stage scale that turns them into stage pixels —
|
||||
several hundred — lives on the `:face` group of the symbol that PLACES it. See
|
||||
`freeze/face-placement` and \"What space geometry is in\" in
|
||||
docs/animation-model.md. Rendered rooted at itself, a face is therefore correct
|
||||
and under a pixel across, which is a true picture of nothing anybody wants to
|
||||
look at.
|
||||
|
||||
So a placed symbol is drawn where it is placed, with everything else in that
|
||||
host isolated away — `export/isolate`, whose docstring draws the same
|
||||
distinction for the same reason. A symbol nothing places has no placement to
|
||||
borrow and is rendered rooted at itself, which for the main timeline is exactly
|
||||
right because the stage is its own.
|
||||
ROOTED AT THE SYMBOL, which is only honest because a symbol carries its own
|
||||
placement. A face's geometry is head-local in units of one image height, and
|
||||
the source-to-stage mapping that turns those into stage pixels lives on the
|
||||
face's own `:place` — see `freeze/face-placement`. So a face drawn by itself is
|
||||
the size it is on the stage, and this needs to know nothing about where it
|
||||
happens to be used.
|
||||
|
||||
nil rather than a throw when the frame will not resolve — a cycle, a missing
|
||||
block, an instance naming a symbol that has gone. A pool is a list of names,
|
||||
|
|
@ -116,12 +95,8 @@
|
|||
[document sid store palette ramp]
|
||||
(try
|
||||
(when (clip/symbol document sid)
|
||||
(let [[host id] (placed-in document sid)
|
||||
document (cond-> document
|
||||
host (update-in [:symbols host] export/isolate id))
|
||||
root (or host sid)
|
||||
resolve (clip/resolver document root store palette {})
|
||||
[w h] (clip/stage document root)]
|
||||
(let [resolve (clip/resolver document sid store palette {})
|
||||
[w h] (clip/stage document sid)]
|
||||
(-> (raster/make w h)
|
||||
(raster/clear! (get palette :bg 0))
|
||||
(raster/draw-ops! (resolve 0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue