an.ir.world_from_shot#
World members from a shot placed by hand (an#514): the projection inverted.
A scene placed by hand (every production written before ADR 0009) adopts a
world without being re-authored: each placed entity of a master shot is
stood at one depth Z in front of a camera at the origin looking down
+z, with its screen position and scale inverted through the pinhole
(an.ir.world):
x = sx · Z / f y = sy · Z / f height = scale · native · Z / f
so the world lowers back to exactly the placements the shot already has, and
the master’s own stage lines agree with it (the viewpoint check says
nothing). Z defaults to the depth at which the tallest placed character
(else the tallest placed entity) is DFLT_SUBJECT_HEIGHT tall. A thing
placed several times is ONE thing at several depths, its largest placement
at Z and the others farther by their scale (an#603), so a second viewpoint
sees them parallax; a thing placed once takes the depth the master’s drawing
order needs (listed first = farthest). When the copies’ depths contradict
that order, every member stands at Z and SeededMembers.flat says
why. The camera itself, the lens and the scene file are the stage’s
(an.stage.world.seed_world()).
>>> from an.ir.schema import AssetRef, Shot, StagePlacement
>>> shot = Shot(id="master", duration=1.0, entities=[
... AssetRef(kind="prop", id="lamp", store="props", ref="lamp",
... stage=StagePlacement(at=(100.0, 50.0), scale=0.5))])
>>> seeded = seed_members(shot, extents={"lamp": (-10.0, -200.0, 10.0, 0.0)}, focal=500.0)
>>> m = seeded.members[0]
>>> m.at, m.height, seeded.depth
((1.7, 0.85, 8.5), 1.7, 8.5)
Module Attributes
How tall the tallest placed character (else the tallest placed entity) is in the seeded world, by default: a person, in metres (the world's units are metres: |
Functions
|
The world members |
Classes
|
What |
- an.ir.world_from_shot.DFLT_SUBJECT_HEIGHT: float = 1.7#
How tall the tallest placed character (else the tallest placed entity) is in the seeded world, by default: a person, in metres (the world’s units are metres:
DFLT_WORLD_GRAVITY).
- class an.ir.world_from_shot.SeededMembers(members, depth, skipped=dict(), flat=None)[source]#
Bases:
objectWhat
seed_members()derived: the members (environments first, as listed), the depth the placed ones stand at, and the drawn entities it left out ({id: why}), which stay listed in the shot and placed by hand.
- an.ir.world_from_shot.seed_members(shot, *, extents, focal, depth=None, drawn=None)[source]#
The world members
shot’s hand placements are a view of, from a camera at the origin with focal lengthfocal(pixels): every entity with astage.atbecomes a member (_depths():depth, default where the tallest character, else the tallest thing, isDFLT_SUBJECT_HEIGHTtall), every environment a member as it is.extentsis each entity’s native box (None: unmeasured);drawnthe ids of the entities the stage draws (default: every oneextentsnames), the others (a voice) being no member of a picture.Raises
ValueErrorwhen nothing is placed by hand, for a non-positivedepthorfocal, and for a drawn entity left out (nostage.at, or unmeasured) that is listed before a member: a framed shot draws its members first, so it would move on top of them.- Return type: