@@ -47,7 +51,7 @@ const shown = computed(() => (view === 'result' ? take.url : clip))
class="max-h-full max-w-full"
/>
{{ rc('reshoot.warpNote', locale) }}
@@ -71,7 +75,14 @@ const shown = computed(() => (view === 'result' ? take.url : clip))
- {{ rc('reshoot.generatingHelp', locale) }}
+ {{
+ rc(
+ take.phase === 'starting'
+ ? 'reshoot.stage.starting'
+ : 'reshoot.generatingHelp',
+ locale
+ )
+ }}
+
+
+
+ {{ rc('reshoot.take.failed', locale) }}
+
+
{{ take.note }}
+
depth: DepthState
+ stage?: ReshootRunPhase
+ notice?: string
aimable: boolean
locale?: Locale
}>()
@@ -35,8 +40,15 @@ const ready = computed(() => aimable && depth === 'ready')
const transform = computed(() =>
ready.value ? viewTransform(camera) : undefined
)
-const notice = computed(() =>
- depth === 'stale' ? rc('reshoot.stale', locale) : undefined
+const analyzing = computed(() =>
+ rc(
+ stage === 'starting'
+ ? 'reshoot.stage.starting'
+ : stage === 'queued'
+ ? 'reshoot.stage.queued'
+ : 'reshoot.analyzing',
+ locale
+ )
)
const dragFrom = ref<{ x: number; y: number; tilts: boolean }>()
@@ -121,7 +133,7 @@ const DOLLY_BUTTONS = [
class="size-4 text-primary-comfy-yellow motion-safe:animate-spin"
aria-hidden="true"
/>
- {{ rc('reshoot.analyzing', locale) }}
+ {{ analyzing }}
({ reshootTransport: vi.fn() })
+)
+vi.mock(
+ import('../lib/workshop/cinematic-studio/reshoot-engine/cvgeo'),
+ () => ({ readGeometry: vi.fn() })
+)
+
+let transport: ReshootTransport
+
+function start() {
+ let reshoot: ReturnType | undefined
+ render(
+ defineComponent({
+ setup() {
+ reshoot = useReshoot()
+ return () => null
+ }
+ })
+ )
+ if (!reshoot) throw new Error('not mounted')
+ return reshoot
+}
+
+async function readScene(reshoot: ReturnType) {
+ reshoot.pick()
+ await vi.advanceTimersByTimeAsync(2_500)
+}
+
+beforeEach(() => {
+ vi.useFakeTimers()
+ transport = fakeTransport()
+ vi.mocked(reshootTransport).mockReturnValue(transport)
+ vi.mocked(readGeometry).mockResolvedValue(fakeGeometry())
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async () => new Response(new Blob(['clip'], { type: 'video/mp4' })))
+ )
+ signIn()
+})
+
+describe('useReshoot', () => {
+ it('adds no take until depth has been read', async () => {
+ const reshoot = start()
+ const before = reshoot.takes.value.length
+
+ await reshoot.generate()
+ expect(reshoot.takes.value).toHaveLength(before)
+
+ await readScene(reshoot)
+ void reshoot.generate()
+ expect(reshoot.takes.value).toHaveLength(before + 1)
+ })
+
+ it('reads the scene, then generates a take from the aimed camera', async () => {
+ const reshoot = start()
+ await vi.advanceTimersByTimeAsync(0)
+ expect(reshoot.priceNote.value).toBe('Free · 3 of 5 left this week')
+
+ await readScene(reshoot)
+ expect(reshoot.depth.value).toBe('ready')
+ expect(reshoot.frames.value).toBe(97)
+ expect(transport.upload).toHaveBeenCalledWith(
+ expect.objectContaining({ name: 'input_crossviewwarp-1.mp4' }),
+ expect.any(AbortSignal)
+ )
+
+ reshoot.aim({ azimuth: 25 })
+ void reshoot.generate()
+ expect(reshoot.current.value?.status).toBe('rendering')
+ await vi.advanceTimersByTimeAsync(2_500)
+
+ const take = reshoot.current.value
+ expect(take).toMatchObject({ status: 'done', n: 1 })
+ expect(take?.url).toMatch(/^blob:/)
+ expect(take?.originalUrl).toMatch(/^blob:/)
+ const [, [generate]] = vi.mocked(transport.submit).mock.calls
+ expect(JSON.stringify(generate)).toContain('"azimuth":25')
+ expect(transport.quote).toHaveBeenCalledTimes(2)
+ expect(refreshWorkshopCredits).toHaveBeenCalledWith({ force: true })
+ })
+
+ it('reuses a scene it already read instead of analyzing again', async () => {
+ const reshoot = start()
+ await readScene(reshoot)
+ reshoot.size.value = '768p'
+ await vi.advanceTimersByTimeAsync(2_500)
+ reshoot.size.value = '480p'
+ await vi.advanceTimersByTimeAsync(2_500)
+
+ const analyses = vi
+ .mocked(transport.submit)
+ .mock.calls.filter(([workflow]) =>
+ JSON.stringify(workflow).includes('CrossViewGeometryExport')
+ )
+ expect(analyses).toHaveLength(2)
+ expect(reshoot.depth.value).toBe('ready')
+ })
+
+ it('keeps Generate off while the price could not be fetched', async () => {
+ vi.mocked(transport.quote).mockRejectedValue(new Error('network down'))
+ const reshoot = start()
+ await readScene(reshoot)
+
+ expect(reshoot.depth.value).toBe('ready')
+ expect(reshoot.priceNote.value).toBe(
+ 'Couldn’t get the price yet. Trying again…'
+ )
+ expect(reshoot.canGenerate.value).toBe(false)
+ })
+
+ it('asks for the price again once the scene is read', async () => {
+ vi.mocked(transport.quote).mockRejectedValueOnce(new Error('network down'))
+ const reshoot = start()
+ await vi.advanceTimersByTimeAsync(0)
+ expect(reshoot.canGenerate.value).toBe(false)
+
+ await readScene(reshoot)
+ expect(reshoot.priceNote.value).toBe('Free · 3 of 5 left this week')
+ expect(reshoot.canGenerate.value).toBe(true)
+ })
+
+ it('retries a failed quote on its own after a short wait', async () => {
+ vi.mocked(transport.quote).mockRejectedValueOnce(new Error('network down'))
+ const reshoot = start()
+ await vi.advanceTimersByTimeAsync(0)
+ expect(transport.quote).toHaveBeenCalledTimes(1)
+
+ await vi.advanceTimersByTimeAsync(5_000)
+ expect(transport.quote).toHaveBeenCalledTimes(2)
+ expect(reshoot.priceNote.value).toBe('Free · 3 of 5 left this week')
+ })
+
+ it('does not retry a quote for an app that does not exist', async () => {
+ vi.mocked(transport.quote).mockRejectedValue(new ReshootError('not_found'))
+ const reshoot = start()
+ await vi.advanceTimersByTimeAsync(120_000)
+
+ expect(transport.quote).toHaveBeenCalledTimes(1)
+ expect(reshoot.priceNote.value).toBeUndefined()
+ })
+
+ it('lets the unmetered dev transport generate with no quote', async () => {
+ vi.mocked(transport.quote).mockResolvedValue(undefined)
+ const reshoot = start()
+ await readScene(reshoot)
+
+ expect(reshoot.priceNote.value).toBeUndefined()
+ expect(reshoot.canGenerate.value).toBe(true)
+ })
+
+ it('keeps only the most recent scenes it read', async () => {
+ const reshoot = start()
+ await readScene(reshoot)
+ for (const aspect of [
+ '16:9',
+ '9:16',
+ '1:1',
+ '4:3',
+ 'source',
+ '4:3'
+ ] as const) {
+ reshoot.aspect.value = aspect
+ await vi.advanceTimersByTimeAsync(2_500)
+ }
+
+ const analyses = vi
+ .mocked(transport.submit)
+ .mock.calls.filter(([workflow]) =>
+ JSON.stringify(workflow).includes('CrossViewGeometryExport')
+ )
+ // The fifth read pushed out 'source', so it is read again; '4:3' is reused.
+ expect(analyses).toHaveLength(6)
+ expect(reshoot.depth.value).toBe('ready')
+ })
+
+ it('keeps the newest workspace quote when an older one answers last', async () => {
+ const credential = ref(RESHOOT_CREDENTIAL)
+ useWorkshopSession().session = computed(() => credential.value)
+ let answerFirst: (quote: typeof FREE_QUOTE) => void = () => {}
+ vi.mocked(transport.quote)
+ .mockReturnValueOnce(new Promise((resolve) => (answerFirst = resolve)))
+ .mockResolvedValueOnce({ ...FREE_QUOTE, next_run: 'paid' })
+ const reshoot = start()
+
+ credential.value = {
+ ...RESHOOT_CREDENTIAL,
+ workspace: { ...RESHOOT_CREDENTIAL.workspace, id: 'team' }
+ }
+ await vi.advanceTimersByTimeAsync(0)
+ answerFirst(FREE_QUOTE)
+ await vi.advanceTimersByTimeAsync(0)
+
+ expect(reshoot.priceNote.value).toBe('40 credits')
+ })
+
+ it('does not upload an error response in place of the example clip', async () => {
+ const fetchMock = vi.fn(
+ async () => new Response('missing', { status: 404 })
+ )
+ vi.stubGlobal('fetch', fetchMock)
+ const reshoot = start()
+
+ reshoot.pick()
+ await vi.advanceTimersByTimeAsync(0)
+ expect(reshoot.depth.value).toBe('failed')
+ expect(transport.upload).not.toHaveBeenCalled()
+
+ reshoot.pick()
+ await vi.advanceTimersByTimeAsync(0)
+ expect(fetchMock).toHaveBeenCalledTimes(2)
+ })
+
+ it('downloads outputs only once their job has succeeded', async () => {
+ const reshoot = start()
+ await readScene(reshoot)
+ void reshoot.generate()
+ await vi.advanceTimersByTimeAsync(2_500)
+
+ const order = (fn: { mock: { invocationCallOrder: number[] } }) =>
+ fn.mock.invocationCallOrder
+ for (const id of ['job-1', 'job-2']) {
+ const polled = vi
+ .mocked(transport.job)
+ .mock.calls.flatMap(([jobId], i) =>
+ jobId === id ? [order(vi.mocked(transport.job))[i]] : []
+ )
+ const downloads = vi
+ .mocked(transport.output)
+ .mock.calls.flatMap(([job], i) =>
+ job.id === id ? [order(vi.mocked(transport.output))[i]] : []
+ )
+ expect(downloads.length).toBeGreaterThan(0)
+ expect(Math.min(...downloads)).toBeGreaterThan(Math.max(...polled))
+ }
+ expect(transport.output).toHaveBeenCalledTimes(4)
+ })
+
+ it('says a server is starting while the deployment is not ready', async () => {
+ vi.mocked(transport.submit).mockRejectedValueOnce(
+ new ReshootError('deployment_not_ready')
+ )
+ const reshoot = start()
+ reshoot.pick()
+ await vi.advanceTimersByTimeAsync(1)
+
+ expect(reshoot.stage.value).toBe('starting')
+ await vi.advanceTimersByTimeAsync(12_500)
+ expect(reshoot.depth.value).toBe('ready')
+ })
+
+ it('asks a signed-out visitor to sign in before reading the scene', async () => {
+ useWorkshopSession().session = computed(() => undefined)
+ const reshoot = start()
+ reshoot.pick()
+ await vi.advanceTimersByTimeAsync(2_500)
+
+ expect(transport.upload).not.toHaveBeenCalled()
+ expect(reshoot.depth.value).toBe('none')
+ expect(reshoot.gate.value).toBe('signedOut')
+ expect(reshoot.notice.value).toBe('Sign in to read the scene.')
+ expect(reshoot.priceNote.value).toBeUndefined()
+ })
+
+ it('is unavailable when this Cloud has no Re-shoot app', async () => {
+ vi.mocked(reshootTransport).mockReturnValue(undefined)
+ const reshoot = start()
+ reshoot.pick()
+ await vi.advanceTimersByTimeAsync(2_500)
+
+ expect(reshoot.gate.value).toBe('unavailable')
+ expect(reshoot.depth.value).toBe('none')
+ expect(reshoot.notice.value).toBe(
+ 'Re-shoot is not available right now. Try again later.'
+ )
+ })
+
+ it.for<{
+ name: string
+ error: ReshootError
+ role?: 'member'
+ note: string
+ gate?: string
+ }>([
+ {
+ name: 'an owner out of credits',
+ error: new ReshootError('insufficient_credits'),
+ note: 'Not enough credits in Personal.',
+ gate: 'noCredits'
+ },
+ {
+ name: 'a member out of credits',
+ error: new ReshootError('insufficient_credits'),
+ role: 'member',
+ note: 'Personal has used all its credits. Ask the workspace owner to add more, or run this on your personal workspace.',
+ gate: 'memberNoCredits'
+ },
+ {
+ name: 'no free runs left',
+ error: new ReshootError('free_runs_exhausted', 7200),
+ note: 'No free runs left; next one in 2 hours · 40 credits'
+ },
+ {
+ name: 'the app unavailable for this attempt',
+ error: new ReshootError('app_unavailable'),
+ note: 'Re-shoot is not available right now. Try again later.',
+ gate: 'ready'
+ }
+ ])('explains a refused take: $name', async ({ error, role, note, gate }) => {
+ if (role) signIn({ ...RESHOOT_CREDENTIAL, role })
+ const reshoot = start()
+ await readScene(reshoot)
+ vi.mocked(transport.submit).mockRejectedValueOnce(error)
+ if (error.code === 'insufficient_credits')
+ vi.mocked(transport.quote).mockResolvedValue({
+ ...FREE_QUOTE,
+ next_run: 'blocked',
+ blocked_reason: 'insufficient_credits'
+ })
+
+ await reshoot.generate()
+ await vi.advanceTimersByTimeAsync(0)
+
+ expect(reshoot.current.value).toMatchObject({ status: 'failed', note })
+ if (gate) expect(reshoot.gate.value).toBe(gate)
+ })
+
+ it('runs again after a take the app could not serve', async () => {
+ const reshoot = start()
+ await readScene(reshoot)
+ vi.mocked(transport.submit).mockRejectedValueOnce(
+ new ReshootError('app_unavailable')
+ )
+ await reshoot.generate()
+ await vi.advanceTimersByTimeAsync(0)
+ const submits = vi.mocked(transport.submit).mock.calls.length
+
+ void reshoot.generate()
+ await vi.advanceTimersByTimeAsync(2_500)
+
+ expect(transport.submit).toHaveBeenCalledTimes(submits + 1)
+ expect(reshoot.current.value?.status).toBe('done')
+ })
+})
diff --git a/apps/website/src/composables/useReshoot.ts b/apps/website/src/composables/useReshoot.ts
new file mode 100644
index 00000000000..496eee43756
--- /dev/null
+++ b/apps/website/src/composables/useReshoot.ts
@@ -0,0 +1,532 @@
+import { useMounted, useObjectUrl } from '@vueuse/core'
+import { computed, onScopeDispose, reactive, ref, shallowRef, watch } from 'vue'
+
+import { refreshWorkshopCredits } from '../config/workshop-credits'
+import { useWorkshopSession } from '../config/workshop-session-state'
+import type { Locale } from '../i18n/translations'
+import { t } from '../i18n/translations'
+import { studioGate } from '../lib/workshop/cinematic-studio/gate'
+import type {
+ CameraKey,
+ ReshootAspect,
+ ReshootCamera,
+ ReshootMotion,
+ ReshootSize
+} from '../lib/workshop/cinematic-studio/reshoot'
+import {
+ DEFAULT_CAMERA,
+ RESHOOT_EXAMPLE,
+ RESHOOT_FRAMES,
+ withKey
+} from '../lib/workshop/cinematic-studio/reshoot'
+import { rc } from '../lib/workshop/cinematic-studio/reshoot-copy'
+import {
+ estimatePivot,
+ focalPx
+} from '../lib/workshop/cinematic-studio/reshoot-engine/camera'
+import type { Geometry } from '../lib/workshop/cinematic-studio/reshoot-engine/cvgeo'
+import { readGeometry } from '../lib/workshop/cinematic-studio/reshoot-engine/cvgeo'
+import type { ReshootRun } from '../lib/workshop/cinematic-studio/reshoot-engine/notes'
+import {
+ failureNote,
+ quoteNote,
+ runPrice
+} from '../lib/workshop/cinematic-studio/reshoot-engine/notes'
+import type { ReshootRunPhase } from '../lib/workshop/cinematic-studio/reshoot-engine/run'
+import {
+ downloadOutput,
+ runJob
+} from '../lib/workshop/cinematic-studio/reshoot-engine/run'
+import type {
+ ReshootQuote,
+ ReshootTransport
+} from '../lib/workshop/cinematic-studio/reshoot-engine/transport'
+import { ReshootError } from '../lib/workshop/cinematic-studio/reshoot-engine/transport'
+import { reshootTransport } from '../lib/workshop/cinematic-studio/reshoot-engine/transport-config'
+import type { ReshootClip } from '../lib/workshop/cinematic-studio/reshoot-engine/workflow'
+import {
+ analyzeWorkflow,
+ generateSeconds,
+ generateWorkflow
+} from '../lib/workshop/cinematic-studio/reshoot-engine/workflow'
+import { useWorkshopAuthFlag } from '../scripts/posthog'
+
+/** Waits before asking for the price again after a failed quote. */
+const QUOTE_RETRY_MS = [5_000, 15_000, 30_000, 60_000]
+/** Quote failures that waiting cannot fix: no such app, or signed out. */
+const QUOTE_FINAL = new Set(['not_found', 'unauthorized'])
+
+/** Read scenes kept for reuse: the 480p and 768p reads of two clips. */
+const MAX_READ_SCENES = 4
+
+export type DepthState = 'none' | 'analyzing' | 'ready' | 'failed'
+
+export interface ReshootTake {
+ readonly id: string
+ readonly n: number
+ readonly camera: Readonly
+ readonly keys: number
+ readonly status: 'rendering' | 'done' | 'cancelled' | 'failed'
+ readonly startedAt: number
+ readonly phase?: ReshootRunPhase
+ readonly url?: string
+ readonly warpUrl?: string
+ /** The same take with the clip's own sound instead of the generated one. */
+ readonly originalUrl?: string
+ readonly note?: string
+}
+
+/** Reading the scene: the clip's depth, which aiming and generating need. */
+type Scene =
+ | { readonly phase: 'none' }
+ | {
+ readonly phase: 'analyzing'
+ readonly stage?: ReshootRunPhase
+ }
+ | {
+ readonly phase: 'ready'
+ readonly clip: ReshootClip
+ readonly geometry: Geometry
+ }
+ | { readonly phase: 'failed'; readonly note: string }
+
+const EXAMPLE_TAKE: ReshootTake = {
+ id: 'example',
+ n: 0,
+ camera: DEFAULT_CAMERA,
+ keys: 0,
+ status: 'done',
+ startedAt: 0,
+ url: RESHOOT_EXAMPLE.result
+}
+
+/**
+ * The Re-shoot app's state and runs. Picking a clip, or changing its framing,
+ * reads its depth again on the deployment (free, but signed in); Generate is
+ * the metered run, priced by the app proxy's quote.
+ */
+export function useReshoot({ locale = 'en' }: { locale?: Locale } = {}) {
+ const { user, session, sessionFailure, settled, ensureFresh } =
+ useWorkshopSession()
+ const authEnabled = useWorkshopAuthFlag()
+ const mounted = useMounted()
+ const transport = reshootTransport(async () => {
+ const credential = await ensureFresh()
+ if (credential?.status !== 'ok') throw new ReshootError('unauthorized')
+ return credential.session.token
+ })
+
+ const upload = shallowRef()
+ const uploadUrl = useObjectUrl(upload)
+ const clip = computed(() => uploadUrl.value ?? RESHOOT_EXAMPLE.clip)
+ const clipName = computed(() => upload.value?.name ?? RESHOOT_EXAMPLE.name)
+ const isExample = computed(() => upload.value === undefined)
+ const picked = ref(false)
+
+ const aspect = ref('source')
+ const size = ref('480p')
+ const scene = shallowRef({ phase: 'none' })
+ const step = ref<1 | 2>(1)
+ const camera = reactive({ ...DEFAULT_CAMERA })
+ const keepAim = ref(true)
+ const frame = ref(0)
+ const keys = ref([])
+ const motion = ref('smooth')
+ const prompt = ref('')
+ const seed = ref(42)
+ const takes = ref([EXAMPLE_TAKE])
+ const selected = ref('example')
+ const quote = shallowRef()
+ /**
+ * The last quote request answered. A metered transport answers with the
+ * price, the unmetered dev transport with nothing; one that failed leaves
+ * the price unknown, so Generate waits rather than run without showing it.
+ */
+ const quoteSettled = ref(false)
+ const unavailable = ref(transport === undefined)
+
+ const depth = computed(() => scene.value.phase)
+ const rendering = computed(() =>
+ takes.value.some((take) => take.status === 'rendering')
+ )
+ const current = computed(() =>
+ takes.value.find((take) => take.id === selected.value)
+ )
+ const frames = computed(() =>
+ scene.value.phase === 'ready' ? scene.value.geometry.frames : RESHOOT_FRAMES
+ )
+
+ const quoteRefusesCredit = computed(
+ () =>
+ !rendering.value && quote.value?.blocked_reason === 'insufficient_credits'
+ )
+ const gate = computed(() =>
+ studioGate({
+ runEnabled: !unavailable.value,
+ modelRunnable: true,
+ mounted: mounted.value,
+ authAvailable: authEnabled.value && !sessionFailure.value,
+ sessionSettled: settled.value && !(user.value && !session.value),
+ role: session.value?.role,
+ credits: quoteRefusesCredit.value ? 0 : undefined
+ })
+ )
+ const canGenerate = computed(
+ () =>
+ gate.value === 'ready' &&
+ depth.value === 'ready' &&
+ !rendering.value &&
+ quoteSettled.value &&
+ quote.value?.next_run !== 'blocked'
+ )
+ const run = computed(() => ({
+ size: size.value,
+ seconds:
+ scene.value.phase === 'ready'
+ ? generateSeconds(scene.value.geometry.frames, scene.value.geometry.fps)
+ : undefined
+ }))
+ /** The last quote request failed, so the price is unknown and Generate waits. */
+ const quoteFailed = ref(false)
+ const priceNote = computed(() => {
+ if (quote.value) return quoteNote(quote.value, locale, run.value)
+ return quoteFailed.value ? rc('reshoot.quote.failed', locale) : undefined
+ })
+ /** Why the viewport cannot show a read scene, if it cannot. */
+ const notice = computed(() => {
+ if (!picked.value) return undefined
+ if (unavailable.value) return rc('reshoot.unavailable', locale)
+ if (scene.value.phase === 'failed') return scene.value.note
+ if (gate.value === 'signedOut') return rc('reshoot.signIn', locale)
+ return undefined
+ })
+ const stage = computed(() =>
+ scene.value.phase === 'analyzing' ? scene.value.stage : undefined
+ )
+
+ let quoteRequest = 0
+ let quoteRetry: ReturnType | undefined
+ let quoteFailures = 0
+ function settleQuote(next: ReshootQuote | undefined, settled: boolean) {
+ quote.value = next
+ quoteSettled.value = settled
+ quoteFailed.value = false
+ quoteFailures = 0
+ }
+ /** A failed quote: the price is unknown, so ask again unless waiting cannot help. */
+ function quoteFailedWith(error: unknown) {
+ const code = error instanceof ReshootError ? error.code : ''
+ const final = QUOTE_FINAL.has(code)
+ quote.value = undefined
+ quoteSettled.value = false
+ quoteFailed.value = !final
+ if (code === 'app_unavailable') unavailable.value = true
+ if (final) return
+ const delay =
+ QUOTE_RETRY_MS[Math.min(quoteFailures, QUOTE_RETRY_MS.length - 1)]
+ quoteFailures += 1
+ quoteRetry = setTimeout(() => void refreshQuote(), delay)
+ }
+ async function refreshQuote() {
+ const request = ++quoteRequest
+ clearTimeout(quoteRetry)
+ if (!transport || !session.value) return settleQuote(undefined, false)
+ try {
+ const next = await transport.quote()
+ if (request !== quoteRequest) return
+ settleQuote(next, true)
+ unavailable.value = false
+ } catch (error) {
+ if (request === quoteRequest) quoteFailedWith(error)
+ }
+ }
+
+ function noCreditsNote() {
+ const key =
+ session.value?.role === 'member'
+ ? 'workshop.error.memberNoCredits'
+ : 'workshop.error.noCreditsCloud'
+ return t(key, locale).replace(
+ '{workspace}',
+ session.value?.workspace.name ?? ''
+ )
+ }
+
+ function noteFor(error: unknown): string {
+ if (error instanceof ReshootError && error.code === 'insufficient_credits')
+ return noCreditsNote()
+ return failureNote(
+ error,
+ locale,
+ quote.value ? runPrice(quote.value, run.value) : undefined
+ )
+ }
+
+ const uploads = new WeakMap()
+ let example: Promise | undefined
+ function exampleFile(): Promise {
+ example ??= fetch(RESHOOT_EXAMPLE.clip)
+ .then((response) => {
+ if (!response.ok)
+ throw new Error(`example clip: HTTP ${response.status}`)
+ return response.blob()
+ })
+ .then(
+ (blob) =>
+ new File([blob], RESHOOT_EXAMPLE.name, {
+ type: blob.type || 'video/mp4'
+ })
+ )
+ example.catch(() => (example = undefined))
+ return example
+ }
+
+ /**
+ * Scenes already read, by clip and settings: analyses are rate limited.
+ * Each holds depth and frame images, so only the most recent few are kept.
+ */
+ const reads = new Map()
+ function remember(key: string, geometry: Geometry) {
+ reads.delete(key)
+ reads.set(key, geometry)
+ for (const oldest of reads.keys()) {
+ if (reads.size <= MAX_READ_SCENES) break
+ reads.delete(oldest)
+ }
+ }
+ async function readScene(
+ via: ReshootTransport,
+ clip: ReshootClip,
+ signal: AbortSignal
+ ) {
+ const job = await runJob(
+ via,
+ analyzeWorkflow(clip),
+ (stage) => {
+ if (!signal.aborted) scene.value = { phase: 'analyzing', stage }
+ },
+ signal
+ )
+ const bytes = await downloadOutput(via, job, '.cvgeo', signal)
+ return readGeometry(await bytes.arrayBuffer())
+ }
+
+ /** The chosen clip, uploaded once, and its scene, read once per settings. */
+ async function clipScene(via: ReshootTransport, signal: AbortSignal) {
+ const file = upload.value ?? (await exampleFile())
+ const video = uploads.get(file) ?? (await via.upload(file, signal))
+ uploads.set(file, video)
+ const clip = { video, aspect: aspect.value, size: size.value }
+ const key = `${video}|${clip.aspect}|${clip.size}`
+ const geometry = reads.get(key) ?? (await readScene(via, clip, signal))
+ remember(key, geometry)
+ return { clip, geometry }
+ }
+
+ let analysis: AbortController | undefined
+ async function analyze() {
+ analysis?.abort()
+ const controller = new AbortController()
+ analysis = controller
+ selected.value = 'aim'
+ if (!transport || unavailable.value || !session.value) {
+ scene.value = { phase: 'none' }
+ return
+ }
+ const { signal } = controller
+ scene.value = { phase: 'analyzing' }
+ try {
+ const { clip, geometry } = await clipScene(transport, signal)
+ if (signal.aborted) return
+ scene.value = { phase: 'ready', clip, geometry }
+ frame.value = Math.min(frame.value, geometry.frames - 1)
+ step.value = 2
+ if (!quoteSettled.value) void refreshQuote()
+ } catch (error) {
+ if (!signal.aborted)
+ scene.value = { phase: 'failed', note: noteFor(error) }
+ }
+ }
+
+ watch([aspect, size], () => {
+ if (picked.value) void analyze()
+ })
+ watch(
+ upload,
+ () => {
+ keys.value = []
+ scene.value = { phase: 'none' }
+ if (picked.value) void analyze()
+ },
+ { flush: 'sync' }
+ )
+ watch(
+ () => [session.value?.uid, session.value?.workspace.id],
+ () => {
+ void refreshQuote()
+ if (picked.value && depth.value === 'none') void analyze()
+ },
+ { immediate: true }
+ )
+
+ function pick(file?: File) {
+ picked.value = true
+ if (upload.value === file) void analyze()
+ else upload.value = file
+ }
+
+ function updateTake(id: string, patch: Partial) {
+ takes.value = takes.value.map((take) =>
+ take.id === id ? { ...take, ...patch } : take
+ )
+ }
+
+ const runs = new Map()
+ const objectUrls: string[] = []
+ const objectUrl = (blob?: Blob) => {
+ if (!blob) return undefined
+ const url = URL.createObjectURL(blob)
+ objectUrls.push(url)
+ return url
+ }
+
+ async function generate() {
+ const read = scene.value
+ if (!canGenerate.value || !transport || read.phase !== 'ready') return
+ const n = takes.value.length
+ const id = `take-${n}`
+ takes.value = [
+ ...takes.value,
+ {
+ id,
+ n,
+ camera: { ...camera },
+ keys: keys.value.length,
+ status: 'rendering',
+ startedAt: Date.now()
+ }
+ ]
+ selected.value = id
+ const controller = new AbortController()
+ runs.set(id, controller)
+ const { signal } = controller
+ const { geometry } = read
+ try {
+ const job = await runJob(
+ transport,
+ generateWorkflow({
+ clip: read.clip,
+ seconds: generateSeconds(geometry.frames, geometry.fps),
+ camera,
+ keepAim: keepAim.value,
+ pivot: estimatePivot(
+ geometry.depth[0],
+ geometry.width,
+ geometry.height,
+ focalPx(geometry.width, camera.fov)
+ ),
+ keys: keys.value,
+ motion: motion.value,
+ prompt: prompt.value,
+ seed: seed.value
+ }),
+ (phase) => updateTake(id, { phase }),
+ signal
+ )
+ const optional = (part: string) =>
+ downloadOutput(transport, job, part, signal).catch(() => undefined)
+ const [video, warp, original] = await Promise.all([
+ downloadOutput(transport, job, 'result', signal),
+ optional('warp'),
+ optional('original-audio')
+ ])
+ if (signal.aborted) return
+ updateTake(id, {
+ status: 'done',
+ url: objectUrl(video),
+ warpUrl: objectUrl(warp),
+ originalUrl: objectUrl(original)
+ })
+ } catch (error) {
+ if (!signal.aborted)
+ updateTake(id, { status: 'failed', note: noteFor(error) })
+ } finally {
+ runs.delete(id)
+ void refreshQuote()
+ void refreshWorkshopCredits({ force: true })
+ }
+ }
+
+ function cancel() {
+ runs.forEach((controller) => controller.abort())
+ takes.value = takes.value.map((take) =>
+ take.status === 'rendering' ? { ...take, status: 'cancelled' } : take
+ )
+ }
+
+ function aim(patch: Partial) {
+ Object.assign(camera, patch)
+ selected.value = 'aim'
+ }
+
+ function addKey() {
+ keys.value = withKey(keys.value, {
+ frame: frame.value,
+ camera: { ...camera }
+ })
+ }
+
+ function removeKey(at: number) {
+ keys.value = keys.value.filter((key) => key.frame !== at)
+ }
+
+ function reuse(id: string) {
+ const take = takes.value.find((entry) => entry.id === id)
+ if (take) aim(take.camera)
+ }
+
+ onScopeDispose(() => {
+ clearTimeout(quoteRetry)
+ quoteRequest += 1
+ analysis?.abort()
+ runs.forEach((controller) => controller.abort())
+ objectUrls.forEach((url) => URL.revokeObjectURL(url))
+ })
+
+ return {
+ upload,
+ clip,
+ clipName,
+ isExample,
+ picked,
+ aspect,
+ size,
+ depth,
+ stage,
+ notice,
+ frames,
+ step,
+ camera,
+ keepAim,
+ frame,
+ keys,
+ motion,
+ prompt,
+ seed,
+ takes,
+ selected,
+ current,
+ rendering,
+ gate,
+ canGenerate,
+ priceNote,
+ session,
+ pick,
+ generate,
+ cancel,
+ aim,
+ addKey,
+ removeKey,
+ reuse
+ }
+}
diff --git a/apps/website/src/composables/useReshootDemo.test.ts b/apps/website/src/composables/useReshootDemo.test.ts
deleted file mode 100644
index b83f025eaa5..00000000000
--- a/apps/website/src/composables/useReshootDemo.test.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { effectScope } from 'vue'
-
-import { useReshootDemo } from './useReshootDemo'
-
-describe('useReshootDemo', () => {
- beforeEach(() => vi.useFakeTimers())
-
- it('adds no take until depth has been read', () => {
- const scope = effectScope()
- const demo = scope.run(() => useReshootDemo())
- if (!demo) throw new Error('No demo')
-
- const before = demo.takes.value.length
- demo.generate()
- expect(demo.takes.value).toHaveLength(before)
-
- demo.prepare()
- vi.runAllTimers()
- demo.generate()
- expect(demo.takes.value).toHaveLength(before + 1)
- scope.stop()
- })
-})
diff --git a/apps/website/src/composables/useReshootDemo.ts b/apps/website/src/composables/useReshootDemo.ts
deleted file mode 100644
index 0157cd86120..00000000000
--- a/apps/website/src/composables/useReshootDemo.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-import { useObjectUrl } from '@vueuse/core'
-import { computed, onScopeDispose, reactive, ref, shallowRef, watch } from 'vue'
-
-import type {
- CameraKey,
- ReshootAspect,
- ReshootCamera,
- ReshootMotion,
- ReshootSize
-} from '../lib/workshop/cinematic-studio/reshoot'
-import {
- DEFAULT_CAMERA,
- RESHOOT_EXAMPLE,
- withKey
-} from '../lib/workshop/cinematic-studio/reshoot'
-
-export type DepthState = 'none' | 'analyzing' | 'ready' | 'stale'
-
-export interface ReshootTake {
- readonly id: string
- readonly n: number
- readonly camera: Readonly
- readonly keys: number
- readonly status: 'rendering' | 'done' | 'cancelled'
- readonly startedAt: number
- readonly url?: string
-}
-
-const ANALYZE_MS = 2500
-const GENERATE_MS = 6000
-
-const EXAMPLE_TAKE: ReshootTake = {
- id: 'example',
- n: 0,
- camera: DEFAULT_CAMERA,
- keys: 0,
- status: 'done',
- startedAt: 0,
- url: RESHOOT_EXAMPLE.result
-}
-
-/**
- * The Re-shoot mock's whole state. Analysis and generation are timers: the
- * page shows the flow of the CrossView app without its deployment, and every
- * take plays the worked example's result. With `autoRead`, picking a clip or
- * changing its format reads the depth again without asking.
- */
-export function useReshootDemo({ autoRead = false } = {}) {
- const upload = shallowRef()
- const uploadUrl = useObjectUrl(upload)
- const clip = computed(() => uploadUrl.value ?? RESHOOT_EXAMPLE.clip)
- const clipName = computed(() => upload.value?.name ?? RESHOOT_EXAMPLE.name)
- const isExample = computed(() => upload.value === undefined)
- const picked = ref(false)
-
- const aspect = ref('source')
- const size = ref('480p')
- const depth = ref('none')
- const step = ref<1 | 2>(1)
- const camera = reactive({ ...DEFAULT_CAMERA })
- const keepAim = ref(true)
- const frame = ref(0)
- const keys = ref([])
- const motion = ref('smooth')
- const prompt = ref('')
- const seed = ref(42)
- const takes = ref([EXAMPLE_TAKE])
- const selected = ref('example')
-
- const timers = new Set>()
- function later(ms: number, run: () => void) {
- const timer = setTimeout(() => {
- timers.delete(timer)
- run()
- }, ms)
- timers.add(timer)
- return timer
- }
- let analysis: ReturnType | undefined
- onScopeDispose(() => timers.forEach(clearTimeout))
-
- watch([aspect, size], () => {
- if (depth.value !== 'ready') return
- if (autoRead) analyze()
- else depth.value = 'stale'
- })
- watch(
- upload,
- () => {
- depth.value = 'none'
- keys.value = []
- if (autoRead && picked.value) analyze()
- },
- { flush: 'sync' }
- )
-
- const rendering = computed(() =>
- takes.value.some((take) => take.status === 'rendering')
- )
- const current = computed(() =>
- takes.value.find((take) => take.id === selected.value)
- )
-
- function analyze() {
- clearTimeout(analysis)
- if (analysis) timers.delete(analysis)
- depth.value = 'analyzing'
- selected.value = 'aim'
- analysis = later(ANALYZE_MS, () => {
- depth.value = 'ready'
- step.value = 2
- })
- }
-
- function prepare() {
- if (depth.value === 'ready') step.value = 2
- else analyze()
- }
-
- function pick(file?: File) {
- picked.value = true
- if (upload.value === file) analyze()
- else upload.value = file
- }
-
- function back() {
- step.value = 1
- selected.value = 'aim'
- }
-
- function updateTake(id: string, patch: Partial) {
- takes.value = takes.value.map((take) =>
- take.id === id ? { ...take, ...patch } : take
- )
- }
-
- function generate() {
- if (depth.value !== 'ready') return
- const n = takes.value.length
- const id = `take-${n}`
- takes.value = [
- ...takes.value,
- {
- id,
- n,
- camera: { ...camera },
- keys: keys.value.length,
- status: 'rendering',
- startedAt: Date.now()
- }
- ]
- selected.value = id
- later(GENERATE_MS, () => {
- if (takes.value.find((take) => take.id === id)?.status === 'rendering')
- updateTake(id, { status: 'done', url: RESHOOT_EXAMPLE.result })
- })
- }
-
- function cancel() {
- takes.value = takes.value.map((take) =>
- take.status === 'rendering' ? { ...take, status: 'cancelled' } : take
- )
- }
-
- function aim(patch: Partial) {
- Object.assign(camera, patch)
- selected.value = 'aim'
- }
-
- function addKey() {
- keys.value = withKey(keys.value, {
- frame: frame.value,
- camera: { ...camera }
- })
- }
-
- function removeKey(at: number) {
- keys.value = keys.value.filter((key) => key.frame !== at)
- }
-
- function reuse(id: string) {
- const take = takes.value.find((entry) => entry.id === id)
- if (take) aim(take.camera)
- }
-
- return {
- upload,
- clip,
- clipName,
- isExample,
- picked,
- aspect,
- size,
- depth,
- step,
- camera,
- keepAim,
- frame,
- keys,
- motion,
- prompt,
- seed,
- takes,
- selected,
- current,
- rendering,
- prepare,
- pick,
- back,
- generate,
- cancel,
- aim,
- addKey,
- removeKey,
- reuse
- }
-}
diff --git a/apps/website/src/config/workshop-env.ts b/apps/website/src/config/workshop-env.ts
index 50ebd956ec5..c31981e7dd6 100644
--- a/apps/website/src/config/workshop-env.ts
+++ b/apps/website/src/config/workshop-env.ts
@@ -106,3 +106,16 @@ const TURNSTILE_SITE_KEYS: Record = {
export const WORKSHOP_TURNSTILE_SITE_KEY =
TURNSTILE_SITE_KEYS[WORKSHOP_CLOUD_ENV]
+
+/**
+ * Re-shoot's app proxy id in each family's comfy-api catalog
+ * (`services/comfy-api/appproxy/apps/*.yaml` in the cloud repo). Public: the
+ * proxy still requires a signed-in caller and meters them.
+ */
+const RESHOOT_PROXY_IDS: Record = {
+ prod: '82be5491-e1a0-494f-a913-4d7fe1ad4c12',
+ staging: '134a601f-c481-4af6-90d5-baeb18973abf',
+ test: 'f470a58e-bd04-4204-a8b2-2012b7266e74'
+}
+
+export const WORKSHOP_RESHOOT_PROXY_ID = RESHOOT_PROXY_IDS[WORKSHOP_CLOUD_ENV]
diff --git a/apps/website/src/env.d.ts b/apps/website/src/env.d.ts
index 16aa8794ae2..e30e25f1aa0 100644
--- a/apps/website/src/env.d.ts
+++ b/apps/website/src/env.d.ts
@@ -22,6 +22,8 @@ declare global {
readonly PUBLIC_WORKSHOP_APPS_ENABLED?: string
readonly PUBLIC_WORKSHOP_ROUTER_RUN?: string
readonly PUBLIC_WORKSHOP_SAVE_ASSETS?: string
+ /** `astro dev` only: the local CrossView dev proxy, e.g. http://127.0.0.1:4329. */
+ readonly PUBLIC_CROSSVIEW_PROXY?: string
/** Optional Turnstile mode override: off, shadow, or enforce. */
readonly PUBLIC_WORKSHOP_TURNSTILE_MODE?: string
readonly PUBLIC_POSTHOG_KEY?: string
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts b/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts
index 7ddd1a9d4a3..073053817a6 100644
--- a/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-copy.ts
@@ -247,6 +247,65 @@ const copy = {
},
'reshoot.take.cancelled': { en: 'Cancelled', 'zh-CN': '已取消' },
'reshoot.download': { en: 'Download', 'zh-CN': '下载' },
+ 'reshoot.take.failed': {
+ en: 'This take did not finish',
+ 'zh-CN': '这条镜头未能完成'
+ },
+ 'reshoot.stage.starting': {
+ en: 'Starting a server…',
+ 'zh-CN': '正在启动服务器…'
+ },
+ 'reshoot.stage.queued': {
+ en: 'Waiting for a server…',
+ 'zh-CN': '正在等待服务器…'
+ },
+ 'reshoot.signIn': {
+ en: 'Sign in to read the scene.',
+ 'zh-CN': '登录后即可读取场景。'
+ },
+ 'reshoot.unavailable': {
+ en: 'Re-shoot is not available right now. Try again later.',
+ 'zh-CN': '重拍功能暂不可用,请稍后再试。'
+ },
+ 'reshoot.quote.free': {
+ en: 'Free · {left} of {runs} left {period}',
+ 'zh-CN': '免费 · {period}剩余 {left}/{runs} 次'
+ },
+ 'reshoot.quote.freeOnly': { en: 'Free', 'zh-CN': '免费' },
+ 'reshoot.quote.paid': { en: '{price} credits', 'zh-CN': '{price} 积分' },
+ 'reshoot.quote.perSecond': {
+ en: '{rate} credits per second',
+ 'zh-CN': '每秒 {rate} 积分'
+ },
+ 'reshoot.quote.failed': {
+ en: 'Couldn’t get the price yet. Trying again…',
+ 'zh-CN': '暂时无法获取价格,正在重试…'
+ },
+ 'reshoot.quote.priceUnknown': {
+ en: 'Price not available',
+ 'zh-CN': '暂无价格'
+ },
+ 'reshoot.quote.exhausted': {
+ en: 'No free runs left; next one {when}',
+ 'zh-CN': '免费次数已用完,下一次{when}可用'
+ },
+ 'reshoot.quote.later': { en: 'later', 'zh-CN': '稍后' },
+ 'reshoot.period.day': { en: 'today', 'zh-CN': '今天' },
+ 'reshoot.period.week': { en: 'this week', 'zh-CN': '本周' },
+ 'reshoot.period.days': { en: 'per {n} days', 'zh-CN': '每 {n} 天' },
+ 'reshoot.period.hours': { en: 'per {n} hours', 'zh-CN': '每 {n} 小时' },
+ 'reshoot.error.busy': {
+ en: 'One take at a time: wait for this one to finish.',
+ 'zh-CN': '一次只能生成一条镜头,请等待当前镜头完成。'
+ },
+ 'reshoot.error.rateLimited': {
+ en: 'Too many tries for now. Try again {when}.',
+ 'zh-CN': '尝试次数过多,请{when}再试。'
+ },
+ 'reshoot.error.failed': {
+ en: 'Something went wrong. Try again.',
+ 'zh-CN': '出了点问题,请重试。'
+ },
'reshoot.demoNote': {
en: 'Preview: takes play the example result for now.',
'zh-CN': '预览版:目前镜头播放示例结果。'
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/__fixtures__/reshootFakes.ts b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/__fixtures__/reshootFakes.ts
new file mode 100644
index 00000000000..1d48623976b
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/__fixtures__/reshootFakes.ts
@@ -0,0 +1,85 @@
+/**
+ * A Re-shoot deployment that answers at once: every job runs for one poll,
+ * then succeeds with the outputs its stage produces.
+ */
+import { vi } from 'vitest'
+import { computed } from 'vue'
+
+import type { AccountCredential } from '@comfyorg/account-core/session'
+
+import { useWorkshopSession } from '../../../../../config/workshop-session-state'
+import type { Geometry } from '../cvgeo'
+import type { ReshootJob, ReshootQuote, ReshootTransport } from '../transport'
+
+export const FREE_QUOTE: ReshootQuote = {
+ free_runs_allowance: { runs: 5, period: 'P7D', period_seconds: 604_800 },
+ free_runs_remaining: 3,
+ resets_at: null,
+ price_credits: 40,
+ next_run: 'free'
+}
+
+function outputsOf(workflow: object): ReshootJob['outputs'] {
+ return JSON.stringify(workflow).includes('CrossViewGeometryExport')
+ ? [{ id: 'geo', filename: 'crossview/geometry.cvgeo' }]
+ : [
+ { id: 'res', filename: 'crossview/result_00001_.mp4' },
+ { id: 'warp', filename: 'crossview/warp_00001_.mp4' },
+ { id: 'orig', filename: 'crossview/original-audio_00001_.mp4' }
+ ]
+}
+
+export function fakeTransport(): ReshootTransport {
+ const jobs = new Map()
+ return {
+ quote: vi.fn(async () => FREE_QUOTE),
+ upload: vi.fn(async () => 'clip.mp4'),
+ submit: vi.fn(async (workflow: object) => {
+ const id = `job-${jobs.size + 1}`
+ jobs.set(id, { id, status: 'succeeded', outputs: outputsOf(workflow) })
+ return { id, status: 'running', outputs: [] }
+ }),
+ job: vi.fn(async (id: string) => {
+ const job = jobs.get(id)
+ if (!job) throw new Error(`no job ${id}`)
+ return job
+ }),
+ output: vi.fn(async () => new Blob(['bytes'])),
+ cancel: vi.fn(async () => {})
+ }
+}
+
+export function fakeGeometry(frames = 97): Geometry {
+ const plane = new Float32Array(16).fill(2)
+ return {
+ frames,
+ width: 4,
+ height: 4,
+ fps: 24,
+ sourceWidth: 864,
+ sourceHeight: 480,
+ fxNorm: null,
+ jpegs: [],
+ depth: [plane],
+ depthHalf: [new Uint16Array(16)]
+ }
+}
+
+export const RESHOOT_CREDENTIAL: AccountCredential = {
+ token: 'workspace-jwt',
+ expiresAt: Date.now() + 60_000,
+ uid: 'user-1',
+ workspace: { id: 'workspace-1', name: 'Personal', type: 'personal' },
+ role: 'owner',
+ permissions: []
+}
+
+/** Needs `vi.mock` of workshop-session-state in the calling suite. */
+export function signIn(credential: AccountCredential = RESHOOT_CREDENTIAL) {
+ const session = useWorkshopSession()
+ session.session = computed(() => credential)
+ vi.mocked(session.ensureFresh).mockResolvedValue({
+ status: 'ok',
+ session: credential
+ })
+}
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/analyze.api.json b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/analyze.api.json
new file mode 100644
index 00000000000..911670f5ad6
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/analyze.api.json
@@ -0,0 +1,62 @@
+{
+ "1": {
+ "class_type": "LoadVideo",
+ "_meta": {
+ "title": "Source video"
+ },
+ "inputs": {
+ "file": "input.mp4"
+ }
+ },
+ "2": {
+ "class_type": "CrossViewPrepareClip",
+ "_meta": {
+ "title": "Prepare clip (24 fps, whole clip, aspect, size)"
+ },
+ "inputs": {
+ "video": ["1", 0],
+ "duration": 5.0,
+ "aspect_ratio": "source",
+ "megapixels": 0.5,
+ "multiple": 32
+ }
+ },
+ "3": {
+ "class_type": "LoadMoGeModel",
+ "_meta": {
+ "title": "MoGe model"
+ },
+ "inputs": {
+ "model_name": "moge_2_vitl_normal_fp16.safetensors"
+ }
+ },
+ "4": {
+ "class_type": "MoGeInference",
+ "_meta": {
+ "title": "Depth estimation (MoGe)"
+ },
+ "inputs": {
+ "moge_model": ["3", 0],
+ "image": ["2", 0],
+ "resolution_level": 2,
+ "fov_x_degrees": 0,
+ "batch_size": 4,
+ "force_projection": true,
+ "apply_mask": true,
+ "refine_steps": 3
+ }
+ },
+ "5": {
+ "class_type": "CrossViewGeometryExport",
+ "_meta": {
+ "title": "Geometry for the browser preview"
+ },
+ "inputs": {
+ "frames": ["2", 0],
+ "moge_geometry": ["4", 0],
+ "preview_size": 384,
+ "jpeg_quality": 88,
+ "filename_prefix": "crossview/geometry"
+ }
+ }
+}
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.fixtures.json b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.fixtures.json
new file mode 100644
index 00000000000..9d7be62f21b
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.fixtures.json
@@ -0,0 +1,1079 @@
+{
+ "orbit": [
+ {
+ "az": -30,
+ "el": 15,
+ "dist": 1.0,
+ "pivot": [0, 0, 4.2],
+ "keepAim": false,
+ "C": [
+ 0.8660254028878632, 0.0, -0.4999999994823618, 0.0, -0.12940952238647394,
+ 0.9659258250590859, -0.22414386775659498, 0.0, 0.48296291302954286,
+ 0.25881904504089714, 0.8365163035386374, 0.0, -2.028444235207043,
+ -1.087039989430587, 0.6866315243012067, 1.0
+ ]
+ },
+ {
+ "az": 45,
+ "el": -10,
+ "dist": 1.4,
+ "pivot": [0.3, -0.2, 6.0],
+ "keepAim": true,
+ "C": [
+ 0.7249195509791381, -0.0, 0.6888335376384274, 0.0, -0.12312131964843871,
+ 0.983896548705633, 0.1295712924511445, 0.0, -0.6777409416928075,
+ -0.17873885767894448, 0.7132458457474503, 0.0, 5.818094185478495,
+ 1.5343908632456331, -0.11206388167519687, 1.0
+ ]
+ },
+ {
+ "az": 90,
+ "el": 30,
+ "dist": 0.5,
+ "pivot": [0, 0, 12.41],
+ "keepAim": true,
+ "C": [
+ 0.0, -0.0, 0.9999999988452994, 0.0, 0.49999999934206946,
+ 0.8660254026448698, 0.0, 0.0, -0.8660254036448698, 0.49999999991941974,
+ 0.0, 0.0, 5.373687630482443, -3.1024999999999996, 12.41, 1.0
+ ]
+ },
+ {
+ "az": 0,
+ "el": 90,
+ "dist": 1,
+ "pivot": [0, 0, 3],
+ "keepAim": false,
+ "C": [
+ -0.9999999989999999, 0.0, 0.0, 0.0, 0.0, -0.0, 0.9999999986666666, 0.0,
+ 0.0, 0.9999999996666666, 0.0, 0.0, 0.0, -3.0, 3.0, 1.0
+ ]
+ },
+ {
+ "az": 170,
+ "el": 5,
+ "dist": 2.0,
+ "pivot": [1, 0.5, 8],
+ "keepAim": false,
+ "C": [
+ -0.9553255051693476, 0.0, 0.29555570904766243, 0.0, 0.04373627011315347,
+ 0.9889903848354881, 0.14136886231939913, 0.0, -0.2923017550224846,
+ 0.14797978443414334, -0.9448077409112412, 0.0, 5.722279372924508,
+ -1.8906865820542764, 23.26383618853522, 1.0
+ ]
+ }
+ ],
+ "paths": [
+ {
+ "motion": "linear",
+ "samples": {
+ "1": {
+ "az": -30.0,
+ "el": 20.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "10": {
+ "az": -66.92307692307693,
+ "el": 16.53846153846154,
+ "dist": 1.0461538461538462,
+ "vs": 0.023076923076923078,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "40": {
+ "az": 170.0,
+ "el": 5.0,
+ "dist": 1.2,
+ "vs": 0.1,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "55": {
+ "az": 176.0,
+ "el": 0.5,
+ "dist": 1.08,
+ "vs": 0.07,
+ "px": 0.06,
+ "py": 0.0,
+ "pz": 5.3
+ },
+ "89": {
+ "az": -170.4,
+ "el": -9.7,
+ "dist": 0.808,
+ "vs": 0.0020000000000000018,
+ "px": 0.196,
+ "py": 0.0,
+ "pz": 5.98
+ },
+ "90": {
+ "az": -170.0,
+ "el": -10.0,
+ "dist": 0.8,
+ "vs": 0.0,
+ "px": 0.2,
+ "py": 0.0,
+ "pz": 6.0
+ },
+ "100": {
+ "az": 147.3529411764706,
+ "el": -4.117647058823529,
+ "dist": 0.8588235294117648,
+ "vs": 0.0,
+ "px": 0.1411764705882353,
+ "py": 0.0,
+ "pz": 5.705882352941177
+ },
+ "124": {
+ "az": -315.0,
+ "el": 10.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ }
+ }
+ },
+ {
+ "motion": "ease_in",
+ "samples": {
+ "1": {
+ "az": -30.0,
+ "el": 20.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "10": {
+ "az": -38.52071005917159,
+ "el": 19.201183431952664,
+ "dist": 1.0106508875739646,
+ "vs": 0.005325443786982249,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "40": {
+ "az": 170.0,
+ "el": 5.0,
+ "dist": 1.2,
+ "vs": 0.1,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "55": {
+ "az": 171.8,
+ "el": 3.6500000000000004,
+ "dist": 1.164,
+ "vs": 0.09100000000000001,
+ "px": 0.018,
+ "py": 0.0,
+ "pz": 5.09
+ },
+ "89": {
+ "az": -170.792,
+ "el": -9.405999999999999,
+ "dist": 0.8158400000000001,
+ "vs": 0.003960000000000005,
+ "px": 0.19208,
+ "py": 0.0,
+ "pz": 5.9604
+ },
+ "90": {
+ "az": -170.0,
+ "el": -10.0,
+ "dist": 0.8,
+ "vs": 0.0,
+ "px": 0.2,
+ "py": 0.0,
+ "pz": 6.0
+ },
+ "100": {
+ "az": 177.4567474048443,
+ "el": -8.269896193771626,
+ "dist": 0.8173010380622838,
+ "vs": 0.0,
+ "px": 0.1826989619377163,
+ "py": 0.0,
+ "pz": 5.913494809688581
+ },
+ "124": {
+ "az": -315.0,
+ "el": 10.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ }
+ }
+ },
+ {
+ "motion": "ease_out",
+ "samples": {
+ "1": {
+ "az": -30.0,
+ "el": 20.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "10": {
+ "az": -95.32544378698226,
+ "el": 13.875739644970412,
+ "dist": 1.0816568047337278,
+ "vs": 0.040828402366863914,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "40": {
+ "az": 170.0,
+ "el": 5.0,
+ "dist": 1.2,
+ "vs": 0.1,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "55": {
+ "az": -179.8,
+ "el": -2.6500000000000004,
+ "dist": 0.996,
+ "vs": 0.049,
+ "px": 0.10200000000000001,
+ "py": 0.0,
+ "pz": 5.51
+ },
+ "89": {
+ "az": -170.008,
+ "el": -9.994,
+ "dist": 0.80016,
+ "vs": 3.999999999999837e-5,
+ "px": 0.19992000000000001,
+ "py": 0.0,
+ "pz": 5.9996
+ },
+ "90": {
+ "az": -170.0,
+ "el": -10.0,
+ "dist": 0.8,
+ "vs": 0.0,
+ "px": 0.2,
+ "py": 0.0,
+ "pz": 6.0
+ },
+ "100": {
+ "az": 117.24913494809687,
+ "el": 0.03460207612457111,
+ "dist": 0.9003460207612457,
+ "vs": 0.0,
+ "px": 0.0996539792387543,
+ "py": 0.0,
+ "pz": 5.498269896193771
+ },
+ "124": {
+ "az": -315.0,
+ "el": 10.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ }
+ }
+ },
+ {
+ "motion": "ease_in_out",
+ "samples": {
+ "1": {
+ "az": -30.0,
+ "el": 20.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "10": {
+ "az": -50.119140146311906,
+ "el": 18.11383061128326,
+ "dist": 1.0251489251828898,
+ "vs": 0.012574462591444947,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "40": {
+ "az": 170.0,
+ "el": 5.0,
+ "dist": 1.2,
+ "vs": 0.1,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "55": {
+ "az": 174.12214747707526,
+ "el": 1.9083893921935484,
+ "dist": 1.1175570504584946,
+ "vs": 0.07938926261462366,
+ "px": 0.04122147477075269,
+ "py": 0.0,
+ "pz": 5.206107373853763
+ },
+ "89": {
+ "az": -170.01973271571728,
+ "el": -9.985200463212037,
+ "dist": 0.8003946543143458,
+ "vs": 9.86635785864276e-5,
+ "px": 0.19980267284282716,
+ "py": 0.0,
+ "pz": 5.999013364214136
+ },
+ "90": {
+ "az": -170.0,
+ "el": -10.0,
+ "dist": 0.8,
+ "vs": 0.0,
+ "px": 0.2,
+ "py": 0.0,
+ "pz": 6.0
+ },
+ "100": {
+ "az": 161.1910111374961,
+ "el": -6.026346363792564,
+ "dist": 0.8397365363620743,
+ "vs": 0.0,
+ "px": 0.16026346363792565,
+ "py": 0.0,
+ "pz": 5.8013173181896285
+ },
+ "124": {
+ "az": -315.0,
+ "el": 10.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ }
+ }
+ },
+ {
+ "motion": "smooth",
+ "samples": {
+ "1": {
+ "az": -30.0,
+ "el": 20.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "10": {
+ "az": -70.60992262175695,
+ "el": 16.53846153846154,
+ "dist": 1.0584433318161128,
+ "vs": 0.027173418297678654,
+ "px": -0.0040964952207555765,
+ "py": 0.0,
+ "pz": 4.979517523896222
+ },
+ "40": {
+ "az": 170.0,
+ "el": 5.0,
+ "dist": 1.2000000000000002,
+ "vs": 0.09999999999999999,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ },
+ "55": {
+ "az": 167.96749999999997,
+ "el": -0.6025,
+ "dist": 1.1052,
+ "vs": 0.08155000000000001,
+ "px": 0.0579,
+ "py": 0.0,
+ "pz": 5.2895
+ },
+ "89": {
+ "az": -168.85062000000002,
+ "el": -10.03614,
+ "dist": 0.8023551999999996,
+ "vs": 0.0010788000000000464,
+ "px": 0.1998024,
+ "py": 0.0,
+ "pz": 5.9990120000000005
+ },
+ "90": {
+ "az": -170.0,
+ "el": -10.0,
+ "dist": 0.7999999999999998,
+ "vs": 2.7755575615628914e-17,
+ "px": 0.19999999999999996,
+ "py": 0.0,
+ "pz": 6.0
+ },
+ "100": {
+ "az": 159.443313657643,
+ "el": -6.682271524526766,
+ "dist": 0.8148585385711379,
+ "vs": -0.007327498473437819,
+ "px": 0.17048646448198657,
+ "py": 0.0,
+ "pz": 5.852432322409933
+ },
+ "124": {
+ "az": -315.0,
+ "el": 10.0,
+ "dist": 1.0,
+ "vs": 0.0,
+ "px": 0.0,
+ "py": 0.0,
+ "pz": 5.0
+ }
+ }
+ }
+ ],
+ "pivot": {
+ "width": 32,
+ "height": 18,
+ "fx": 34.31211072815294,
+ "depth": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 5.5225,
+ 3.9165,
+ 5.22,
+ 2.7736,
+ 9.7426,
+ 3.72,
+ 7.3741,
+ 4.4034,
+ 8.9926,
+ 7.2977,
+ 3.0529,
+ 8.7606,
+ 9.5596,
+ 9.2313,
+ 6.5578,
+ 3.1637,
+ 3.5397,
+ 9.4232,
+ 6.4186,
+ 3.4444,
+ 9.0725,
+ 7.1326,
+ 6.5576,
+ 5.0103,
+ 5.2876,
+ 3.9159,
+ 2.3045,
+ 9.0098,
+ 5.7418,
+ 6.3811,
+ 4.5773,
+ 8.0106,
+ 2.2016,
+ 4.9775,
+ 2.2428,
+ 2.9831,
+ 9.7372,
+ 7.2621,
+ 5.4258,
+ 6.1899,
+ 8.9825,
+ 4.7537,
+ 6.7223,
+ 7.4695,
+ 4.8433,
+ 6.1528,
+ 8.122,
+ 9.2734,
+ 3.2085,
+ 9.4674,
+ 2.0414,
+ 8.0238,
+ 8.4842,
+ 3.0941,
+ 5.3512,
+ 8.522,
+ 2.1142,
+ 7.0277,
+ 8.3442,
+ 6.104,
+ 7.8068,
+ 3.8114,
+ 3.5882,
+ 4.905,
+ 3.4352,
+ 4.7685,
+ 9.585,
+ 6.5867,
+ 4.7205,
+ 4.1722,
+ 9.6163,
+ 5.5558,
+ 9.8432,
+ 6.1242,
+ 6.1693,
+ 9.1723,
+ 7.9421,
+ 6.6452,
+ 5.4132,
+ 9.0255,
+ 5.2932,
+ 9.3821,
+ 2.5497,
+ 5.44,
+ 6.1561,
+ 9.6075,
+ 4.008,
+ 8.4483,
+ 7.4118,
+ 7.7367,
+ 7.037,
+ 9.7725,
+ 4.6615,
+ 5.1862,
+ 3.6233,
+ 2.4056,
+ 3.7033,
+ 9.3237,
+ 8.7214,
+ 2.8992,
+ 6.8302,
+ 5.8336,
+ 6.7575,
+ 7.2742,
+ 4.4533,
+ 9.6908,
+ 5.7267,
+ 7.0248,
+ 7.0818,
+ 3.4711,
+ 2.4949,
+ 5.2921,
+ 8.1122,
+ 8.5218,
+ 7.8399,
+ 2.9056,
+ 9.3068,
+ 8.4163,
+ 9.0215,
+ 6.1864,
+ 9.3251,
+ 2.3732,
+ 2.2423,
+ 2.1617,
+ 4.0221,
+ 3.9886,
+ 3.5,
+ 6.5364,
+ 2.3119,
+ 6.7231,
+ 3.3281,
+ 7.423,
+ 2.1686,
+ 4.4846,
+ 9.5067,
+ 6.3072,
+ 8.4927,
+ 7.2642,
+ 6.886,
+ 3.53,
+ 6.5952,
+ 2.3175,
+ 8.4133,
+ 9.6806,
+ 8.8321,
+ 2.4057,
+ 4.7093,
+ 4.544,
+ 2.9017,
+ 7.0129,
+ 8.3797,
+ 4.5098,
+ 8.9025,
+ 8.377,
+ 3.0331,
+ 8.1349,
+ 9.061,
+ 3.5783,
+ 6.5891,
+ 7.11,
+ 6.8747,
+ 2.77,
+ 7.2895,
+ 7.0556,
+ 8.5911,
+ 8.4281,
+ 4.6173,
+ 7.7764,
+ 8.9382,
+ 9.1436,
+ 3.2921,
+ 2.2136,
+ 7.2065,
+ 3.7174,
+ 6.5097,
+ 9.5584,
+ 5.0346,
+ 4.0222,
+ 5.6521,
+ 7.258,
+ 2.8088,
+ 5.0447,
+ 3.0698,
+ 7.2996,
+ 8.6444,
+ 5.0148,
+ 4.9738,
+ 6.3162,
+ 3.7205,
+ 3.9793,
+ 4.6388,
+ 5.6594,
+ 2.6523,
+ 8.0219,
+ 6.6324,
+ 4.3976,
+ 2.6204,
+ 8.1054,
+ 3.0486,
+ 3.0657,
+ 3.0455,
+ 2.6501,
+ 9.2511,
+ 4.154,
+ 4.4513,
+ 8.6624,
+ 6.9594,
+ 3.4971,
+ 5.4785,
+ 9.0714,
+ 5.003,
+ 7.6871,
+ 2.7745,
+ 7.8186,
+ 8.2118,
+ 8.6061,
+ 7.3936,
+ 4.9659,
+ 2.5137,
+ 6.1502,
+ 8.0597,
+ 3.5267,
+ 4.1299,
+ 6.289,
+ 7.9867,
+ 9.1727,
+ 3.0059,
+ 3.4742,
+ 8.3963,
+ 7.1562,
+ 7.7678,
+ 9.9742,
+ 9.5134,
+ 8.7442,
+ 8.2169,
+ 5.1602,
+ 7.1298,
+ 3.4756,
+ 8.076,
+ 8.0615,
+ 7.7704,
+ 5.5584,
+ 5.0254,
+ 5.3582,
+ 2.2667,
+ 8.7546,
+ 6.339,
+ 5.1001,
+ 6.3842,
+ 7.7731,
+ 5.0517,
+ 8.6451,
+ 9.3557,
+ 5.0995,
+ 3.1025,
+ 8.083,
+ 9.9436,
+ 3.1839,
+ 7.7014,
+ 8.6026,
+ 9.3646,
+ 2.9871,
+ 2.7345,
+ 9.903,
+ 2.9341,
+ 3.4145,
+ 6.5996,
+ 5.5702,
+ 8.0031,
+ 3.5245,
+ 9.3154,
+ 3.7376,
+ 8.1529,
+ 2.5408,
+ 5.7872,
+ 2.2605,
+ 4.5105,
+ 4.4978,
+ 7.758,
+ 5.6401,
+ 2.4542,
+ 9.9629,
+ 9.1096,
+ 9.3306,
+ 3.9726,
+ 5.1529,
+ 3.8174,
+ 2.9993,
+ 2.2642,
+ 6.0267,
+ 2.9851,
+ 3.4104,
+ 8.8838,
+ 5.8739,
+ 3.4696,
+ 7.3589,
+ 4.1269,
+ 6.2155,
+ 4.2636,
+ 6.1293,
+ 7.0283,
+ 6.2897,
+ 5.1648,
+ 8.3265,
+ 8.9875,
+ 3.435,
+ 3.0905,
+ 2.9055,
+ 9.8368,
+ 9.5327,
+ 3.8453,
+ 9.7593,
+ 3.6625,
+ 6.0518,
+ 5.9791,
+ 9.3196,
+ 2.3242,
+ 4.5228,
+ 6.7998,
+ 2.5312,
+ 3.8924,
+ 5.7205,
+ 9.0469,
+ 8.0877,
+ 8.6318,
+ 8.0886,
+ 7.6618,
+ 8.7975,
+ 7.4518,
+ 7.8855,
+ 4.4132,
+ 3.3411,
+ 8.0522,
+ 3.3267,
+ 9.3556,
+ 6.7731,
+ 4.6355,
+ 9.4931,
+ 3.241,
+ 6.1157,
+ 2.7324,
+ 9.7234,
+ 6.603,
+ 8.4293,
+ 4.2554,
+ 8.4144,
+ 7.6227,
+ 7.1495,
+ 9.6045,
+ 5.4679,
+ 5.3207,
+ 7.537,
+ 8.6804,
+ 4.6806,
+ 7.3573,
+ 3.6723,
+ 6.4136,
+ 8.1534,
+ 2.5225,
+ 7.8227,
+ 2.1235,
+ 9.6668,
+ 5.7494,
+ 5.2726,
+ 7.7636,
+ 6.1864,
+ 7.8468,
+ 2.6781,
+ 6.5023,
+ 6.4649,
+ 9.4569,
+ 2.3168,
+ 5.6226,
+ 7.0486,
+ 6.406,
+ 2.5933,
+ 6.7458,
+ 3.7776,
+ 3.5644,
+ 9.0295,
+ 3.5827,
+ 5.6343,
+ 8.0023,
+ 7.6585,
+ 6.4277,
+ 8.4564,
+ 5.7265,
+ 6.9631,
+ 8.5513,
+ 7.4247,
+ 7.1346,
+ 5.249,
+ 6.4666,
+ 5.1687,
+ 7.9543,
+ 5.0434,
+ 5.733,
+ 8.0437,
+ 6.0292,
+ 4.7043,
+ 8.6146,
+ 5.0477,
+ 8.7578,
+ 8.2819,
+ 5.5783,
+ 7.7031,
+ 2.2751,
+ 5.1184,
+ 8.8827,
+ 6.6363,
+ 6.4626,
+ 7.3179,
+ 7.4214,
+ 6.6688,
+ 5.365,
+ 3.4679,
+ 4.3411,
+ 4.3434,
+ 5.446,
+ 9.9925,
+ 4.8204,
+ 5.579,
+ 4.973,
+ 6.6514,
+ 9.5832,
+ 9.1126,
+ 5.0171,
+ 4.1352,
+ 9.0752,
+ 5.9507,
+ 7.4843,
+ 2.5863,
+ 8.9325,
+ 4.5037,
+ 5.9562,
+ 3.5842,
+ 5.3619,
+ 8.6244,
+ 8.6206,
+ 5.7894,
+ 8.1433,
+ 5.6645,
+ 4.9869,
+ 6.3671,
+ 3.6107,
+ 4.5325,
+ 7.6522,
+ 8.1641,
+ 2.4537,
+ 7.8626,
+ 8.5394,
+ 5.5615,
+ 2.4996,
+ 7.4633,
+ 3.9693,
+ 7.1469,
+ 5.013,
+ 7.0973,
+ 4.0651,
+ 5.8123,
+ 6.1974,
+ 7.0481,
+ 3.6253,
+ 9.6964,
+ 4.3131,
+ 4.4482,
+ 4.0505,
+ 2.5398,
+ 5.3834,
+ 8.1747,
+ 7.6765,
+ 3.5646,
+ 3.0955,
+ 4.5714,
+ 8.146,
+ 5.9046,
+ 9.3855,
+ 7.2511,
+ 6.9673,
+ 8.1415,
+ 8.0021,
+ 4.7507,
+ 4.0561,
+ 5.501,
+ 5.914,
+ 3.1338,
+ 5.5307,
+ 7.1186,
+ 3.0857,
+ 3.1043,
+ 3.3898,
+ 4.2667,
+ 9.6937,
+ 2.2063,
+ 3.4699,
+ 3.3204,
+ 5.7948,
+ 2.1206,
+ 5.6654,
+ 3.3034,
+ 4.1571,
+ 8.3395,
+ 3.4725,
+ 6.937,
+ 5.2505,
+ 5.3408,
+ 8.5348,
+ 3.2873,
+ 9.3905,
+ 9.1479,
+ 7.3466,
+ 2.3956
+ ],
+ "expected": [-0.12717667049318546, -0.2203580554954398, 6.252599999999999]
+ },
+ "keyframes": [
+ {
+ "f": 1,
+ "az": -30,
+ "el": 20,
+ "dist": 1.0,
+ "vs": 0,
+ "px": 0,
+ "py": 0,
+ "pz": 5
+ },
+ {
+ "f": 40,
+ "az": 170,
+ "el": 5,
+ "dist": 1.2,
+ "vs": 0.1,
+ "px": 0,
+ "py": 0,
+ "pz": 5
+ },
+ {
+ "f": 90,
+ "az": -170,
+ "el": -10,
+ "dist": 0.8,
+ "vs": 0,
+ "px": 0.2,
+ "py": 0,
+ "pz": 6
+ },
+ {
+ "f": 124,
+ "az": 45,
+ "el": 10,
+ "dist": 1.0,
+ "vs": 0,
+ "px": 0,
+ "py": 0,
+ "pz": 5
+ }
+ ]
+}
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.test.ts b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.test.ts
new file mode 100644
index 00000000000..4fd4749dde7
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.test.ts
@@ -0,0 +1,61 @@
+import { describe, expect, it } from 'vitest'
+
+import type { Motion, Vec3 } from './camera'
+import {
+ estimatePivot,
+ orbitPose,
+ samplePath,
+ sourceAim,
+ zoneOf
+} from './camera'
+// Written by the node pack's own functions (_orbit_C_tgt, _sample_path and
+// build()'s pivot estimate), so these tests hold the port to the original.
+import fixtures from './camera.fixtures.json'
+
+describe('the CrossView camera port', () => {
+ it.for(fixtures.orbit)(
+ 'places the camera where the node does (az $az, el $el)',
+ ({ az, el, dist, pivot, keepAim, C }) => {
+ const p = pivot as unknown as Vec3
+ const pose = orbitPose(
+ az,
+ el,
+ dist,
+ p,
+ keepAim ? sourceAim(p) : undefined
+ )
+ Array.from(pose).forEach((value, i) => expect(value).toBeCloseTo(C[i], 4))
+ }
+ )
+
+ it.for(fixtures.paths)(
+ 'samples a $motion move as the node does',
+ ({ motion, samples }) => {
+ for (const [frame, expected] of Object.entries(samples)) {
+ const pose = samplePath(
+ fixtures.keyframes,
+ Number(frame),
+ motion as Motion
+ )
+ for (const [key, value] of Object.entries(expected))
+ expect(
+ pose[key as keyof typeof pose],
+ `${key} at ${frame}`
+ ).toBeCloseTo(value, 6)
+ }
+ }
+ )
+
+ it('finds the pivot build() would', () => {
+ const { width, height, fx, depth, expected } = fixtures.pivot
+ const plane = Float32Array.from(depth, (z) => (z === null ? NaN : z))
+ const pivot = estimatePivot(plane, width, height, fx)
+ pivot.forEach((value, i) => expect(value).toBeCloseTo(expected[i], 4))
+ })
+
+ it('marks the trained ranges', () => {
+ expect(zoneOf(-30, 15)).toBe('green')
+ expect(zoneOf(80, 0)).toBe('yellow')
+ expect(zoneOf(0, -40)).toBe('red')
+ })
+})
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.ts b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.ts
new file mode 100644
index 00000000000..36ee6078ddd
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/camera.ts
@@ -0,0 +1,242 @@
+/**
+ * The CrossView Warp camera, ported line for line from the node pack
+ * (comfyrob/ComfyUI-CrossViewWarp, crossview_warp_node.py) so the browser
+ * preview aims the camera exactly where the generation will.
+ *
+ * Frame: OpenCV-style, x right, y down, z forward. The source camera sits at
+ * the origin looking down +z; a pose is a 4x4 camera-to-world matrix whose
+ * columns are (right, down, forward, eye), stored column-major.
+ */
+
+export type Vec3 = readonly [number, number, number]
+/** Column-major 4x4, the layout WebGL uniforms expect. */
+export type Mat4 = Float32Array
+
+const DEG = Math.PI / 180
+
+export interface Pose {
+ readonly az: number
+ readonly el: number
+ readonly dist: number
+ readonly vs: number
+ readonly px: number
+ readonly py: number
+ readonly pz: number
+}
+
+export interface Keyframe extends Pose {
+ /** 1-based frame number, as the node counts. */
+ readonly f: number
+}
+
+export type Motion =
+ | 'linear'
+ | 'ease_in'
+ | 'ease_out'
+ | 'ease_in_out'
+ | 'smooth'
+
+const sub = (a: Vec3, b: Vec3): Vec3 => [a[0] - b[0], a[1] - b[1], a[2] - b[2]]
+const scale = (a: Vec3, s: number): Vec3 => [a[0] * s, a[1] * s, a[2] * s]
+const norm = (a: Vec3) => Math.hypot(a[0], a[1], a[2])
+const cross = (a: Vec3, b: Vec3): Vec3 => [
+ a[1] * b[2] - a[2] * b[1],
+ a[2] * b[0] - a[0] * b[2],
+ a[0] * b[1] - a[1] * b[0]
+]
+
+/** _look_at: a pose at `eye` facing `target`, world "down" = +y. */
+function lookAt(eye: Vec3, target: Vec3): Mat4 {
+ let f = sub(target, eye)
+ f = scale(f, 1 / (norm(f) + 1e-9))
+ let right = cross([0, 1, 0], f)
+ let rn = norm(right)
+ if (rn < 1e-6) {
+ right = cross([0, 0, 1], f)
+ rn = norm(right)
+ }
+ right = scale(right, 1 / (rn + 1e-9))
+ const down = cross(f, right)
+ // prettier-ignore
+ return new Float32Array([
+ right[0], right[1], right[2], 0,
+ down[0], down[1], down[2], 0,
+ f[0], f[1], f[2], 0,
+ eye[0], eye[1], eye[2], 1
+ ])
+}
+
+/**
+ * _orbit_C_tgt: orbit `pivot` by az/el (degrees; +az right, +el up) at
+ * `dist` times the pivot's own distance, looking at `aim` (default the pivot).
+ */
+export function orbitPose(
+ az: number,
+ el: number,
+ dist: number,
+ pivot: Vec3,
+ aim?: Vec3
+): Mat4 {
+ const a = -az * DEG
+ const e = -el * DEG
+ const [ca, sa, ce, se] = [Math.cos(a), Math.sin(a), Math.cos(e), Math.sin(e)]
+ // R = rotY(a) @ rotX(e), applied to -pivot
+ const [x, y, z] = [-pivot[0], -pivot[1], -pivot[2]]
+ const rx: Vec3 = [x, ce * y - se * z, se * y + ce * z]
+ const r: Vec3 = [ca * rx[0] + sa * rx[2], rx[1], -sa * rx[0] + ca * rx[2]]
+ const eye: Vec3 = [
+ pivot[0] + dist * r[0],
+ pivot[1] + dist * r[1],
+ pivot[2] + dist * r[2]
+ ]
+ return lookAt(eye, aim ?? pivot)
+}
+
+/** keep_source_aim: stay pointed down the source camera's axis, at the pivot's range. */
+export function sourceAim(pivot: Vec3): Vec3 {
+ return [0, 0, Math.max(norm(pivot), 1e-3)]
+}
+
+/** Focal length in pixels for a horizontal field of view across `width`. */
+export function focalPx(width: number, hfovDeg: number): number {
+ return width / (2 * Math.tan((hfovDeg * DEG) / 2))
+}
+
+/** numpy.percentile with its default linear interpolation, on a sorted array. */
+function percentileSorted(sorted: ArrayLike, q: number): number {
+ if (sorted.length === 0) return 0
+ const idx = ((sorted.length - 1) * q) / 100
+ const lo = Math.floor(idx)
+ const hi = Math.ceil(idx)
+ return sorted[lo] + (sorted[hi] - sorted[lo]) * (idx - lo)
+}
+
+function median(values: number[]): number {
+ values.sort((a, b) => a - b)
+ return percentileSorted(values, 50)
+}
+
+/**
+ * build()'s automatic pivot: the median 3D point of the central region of
+ * frame 0, with its farthest 5% trimmed. Scene-level aim, not the nearest blob.
+ */
+export function estimatePivot(
+ depth: Float32Array,
+ width: number,
+ height: number,
+ fx: number
+): Vec3 {
+ const [r0, r1] = [Math.floor(height / 8), Math.floor((4 * height) / 5)]
+ const [c0, c1] = [Math.floor(width / 5), Math.floor((4 * width) / 5)]
+ const zs: number[] = []
+ for (let v = r0; v < r1; v++)
+ for (let u = c0; u < c1; u++) {
+ const z = depth[v * width + u]
+ if (Number.isFinite(z) && z > 0) zs.push(z)
+ }
+ if (zs.length === 0) return [0, 0, 1.05]
+ const cut = percentileSorted(Float64Array.from(zs).sort(), 95)
+ const xs: number[] = []
+ const ys: number[] = []
+ const zz: number[] = []
+ const [cx, cy] = [width / 2, height / 2]
+ for (let v = r0; v < r1; v++)
+ for (let u = c0; u < c1; u++) {
+ const z = depth[v * width + u]
+ if (!(Number.isFinite(z) && z > 0 && z < cut)) continue
+ xs.push(((u - cx) / fx) * z)
+ ys.push(((v - cy) / fx) * z)
+ zz.push(z)
+ }
+ return [median(xs), median(ys), median(zz)]
+}
+
+// --- keyframed moves (_ease, _unwrap_seq, _catmull, _seg_value, _sample_path)
+
+const wrapDeg = (a: number) => ((((a + 180) % 360) + 360) % 360) - 180
+
+function ease(t: number, mode: Motion): number {
+ if (mode === 'ease_in_out') return 0.5 - 0.5 * Math.cos(Math.PI * t)
+ if (mode === 'ease_in') return t * t
+ if (mode === 'ease_out') return 1 - (1 - t) * (1 - t)
+ return t
+}
+
+function unwrap(degs: number[]): number[] {
+ const out = [degs[0]]
+ for (const d of degs.slice(1)) {
+ const last = out[out.length - 1]
+ out.push(last + wrapDeg(d - last))
+ }
+ return out
+}
+
+function segValue(vals: number[], seg: number, u: number, smooth: boolean) {
+ const [p1, p2] = [vals[seg], vals[seg + 1]]
+ if (!smooth || vals.length < 3) return p1 + (p2 - p1) * u
+ const p0 = seg > 0 ? vals[seg - 1] : p1 + (p1 - p2)
+ const p3 = seg + 2 < vals.length ? vals[seg + 2] : p2 + (p2 - p1)
+ return (
+ 0.5 *
+ (2 * p1 +
+ (-p0 + p2) * u +
+ (2 * p0 - 5 * p1 + 4 * p2 - p3) * u * u +
+ (-p0 + 3 * p1 - 3 * p2 + p3) * u * u * u)
+ )
+}
+
+const clamp = (v: number, lo: number, hi: number) =>
+ Math.min(hi, Math.max(lo, v))
+
+/** The pose a keyframed move holds at a 1-based frame. */
+export function samplePath(
+ keyframes: readonly Keyframe[],
+ frame: number,
+ motion: Motion
+): Pose {
+ const kfs = [...keyframes].sort((a, b) => a.f - b.f)
+ const ch = (key: keyof Pose) => kfs.map((k) => k[key])
+ const az = unwrap(ch('az'))
+ // Held, not extrapolated, before the first key and after the last; the
+ // node holds the unwrapped azimuth there, which is the same direction.
+ const hold = (i: number): Pose => ({ ...kfs[i], az: az[i] })
+ if (frame <= kfs[0].f) return hold(0)
+ if (frame >= kfs[kfs.length - 1].f) return hold(kfs.length - 1)
+ // `motion` carries both the easing and the spline, as the node's widget does
+ const smooth = motion === 'smooth'
+ const easing: Motion = smooth ? 'linear' : motion
+ let seg = 0
+ for (let i = 0; i < kfs.length - 1; i++)
+ if (kfs[i].f <= frame && frame <= kfs[i + 1].f) {
+ seg = i
+ break
+ }
+ const u = ease((frame - kfs[seg].f) / (kfs[seg + 1].f - kfs[seg].f), easing)
+ return {
+ az: wrapDeg(segValue(az, seg, u, smooth)),
+ el: clamp(segValue(ch('el'), seg, u, smooth), -90, 90),
+ dist: clamp(segValue(ch('dist'), seg, u, smooth), 0.1, 3),
+ vs: clamp(segValue(ch('vs'), seg, u, smooth), -1, 1),
+ px: segValue(ch('px'), seg, u, smooth),
+ py: segValue(ch('py'), seg, u, smooth),
+ pz: Math.max(segValue(ch('pz'), seg, u, smooth), 0.01)
+ }
+}
+
+/**
+ * Where the LoRA was trained, from the node's orbit picker: half-axes of an
+ * ellipse in (azimuth, elevation-up, elevation-down) degrees.
+ */
+const ZONE_GREEN = [45, 30, 20] as const
+const ZONE_YELLOW = [90, 45, 35] as const
+
+export function zoneOf(az: number, el: number): 'green' | 'yellow' | 'red' {
+ const inside = ([a, up, down]: readonly number[]) => {
+ const an = az / a
+ const en = el >= 0 ? el / up : el / down
+ return an * an + en * en <= 1
+ }
+ if (inside(ZONE_GREEN)) return 'green'
+ if (inside(ZONE_YELLOW)) return 'yellow'
+ return 'red'
+}
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/cvgeo.test.ts b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/cvgeo.test.ts
new file mode 100644
index 00000000000..d8c110774d3
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/cvgeo.test.ts
@@ -0,0 +1,105 @@
+import { describe, expect, it } from 'vitest'
+
+import { readGeometry } from './cvgeo'
+
+const encoder = new TextEncoder()
+
+interface FixtureOptions {
+ readonly headerLengthDelta?: number
+ readonly jpegLength?: number
+ readonly depthLengthDelta?: number
+ readonly shape?: [number, number, number]
+}
+
+async function deflate(bytes: Uint8Array): Promise {
+ const stream = new Blob([bytes])
+ .stream()
+ .pipeThrough(new CompressionStream('deflate'))
+ return new Uint8Array(await new Response(stream).arrayBuffer())
+}
+
+async function fixture({
+ headerLengthDelta = 0,
+ jpegLength = 1,
+ depthLengthDelta = 0,
+ shape = [1, 1, 1]
+}: FixtureOptions = {}): Promise {
+ const jpeg = Uint8Array.of(0xff)
+ const compressed = await deflate(Uint8Array.of(0x00, 0x3c))
+ const header = encoder.encode(
+ JSON.stringify({
+ version: 1,
+ frames: 1,
+ width: 1,
+ height: 1,
+ fps: 24,
+ source_width: 1,
+ source_height: 1,
+ fx_norm: null,
+ jpegs: [{ offset: 0, length: jpegLength }],
+ depth: {
+ offset: jpeg.length,
+ length: compressed.length + depthLengthDelta,
+ dtype: 'float16',
+ shape,
+ encoding: 'shuffle2+zlib'
+ }
+ })
+ )
+ const output = new Uint8Array(
+ 12 + header.length + jpeg.length + compressed.length
+ )
+ output.set(encoder.encode('CVGEO1\0\0'))
+ new DataView(output.buffer).setUint32(
+ 8,
+ header.length + headerLengthDelta,
+ true
+ )
+ output.set(header, 12)
+ output.set(jpeg, 12 + header.length)
+ output.set(compressed, 12 + header.length + jpeg.length)
+ return output.buffer
+}
+
+describe('CrossView geometry reader', () => {
+ it('reads bounded JPEG and depth data', async () => {
+ const geometry = await readGeometry(await fixture())
+ expect(geometry).toMatchObject({ frames: 1, width: 1, height: 1 })
+ expect(geometry.jpegs).toHaveLength(1)
+ expect(geometry.depth[0][0]).toBe(1)
+ })
+
+ it.for<{
+ name: string
+ options: FixtureOptions
+ message: string
+ }>([
+ {
+ name: 'truncated header',
+ options: { headerLengthDelta: 1_000 },
+ message: 'Truncated CrossView geometry header.'
+ },
+ {
+ name: 'out-of-bounds JPEG',
+ options: { jpegLength: 1_000 },
+ message: 'JPEG data is out of bounds.'
+ },
+ {
+ name: 'out-of-bounds depth',
+ options: { depthLengthDelta: 1_000 },
+ message: 'Depth data is out of bounds.'
+ },
+ {
+ name: 'mismatched depth shape',
+ options: { shape: [1, 1, 2] },
+ message: 'Depth data does not match its declared shape.'
+ },
+ {
+ name: 'unsafe depth shape',
+ options: { shape: [Number.MAX_SAFE_INTEGER, 2, 1] },
+ message: 'Depth data does not match its declared shape.'
+ }
+ ])('rejects $name', async ({ options, message }) => {
+ await expect(readGeometry(await fixture(options))).rejects.toThrow(message)
+ })
+})
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/cvgeo.ts b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/cvgeo.ts
new file mode 100644
index 00000000000..300f78fc3ed
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/cvgeo.ts
@@ -0,0 +1,145 @@
+/**
+ * Reader for the file CrossViewGeometryExport writes (comfyrob/
+ * ComfyUI-CrossViewWarp, crossview_demo_nodes.py): the prepared frames as
+ * JPEGs plus MoGe metric depth at the same preview scale.
+ */
+
+const MAGIC = 'CVGEO1\0\0'
+
+interface Header {
+ readonly version: number
+ readonly frames: number
+ readonly width: number
+ readonly height: number
+ readonly fps: number
+ readonly source_width: number
+ readonly source_height: number
+ readonly fx_norm: number | null
+ readonly jpegs: readonly { offset: number; length: number }[]
+ readonly depth: {
+ offset: number
+ length: number
+ dtype: 'float16'
+ shape: [number, number, number]
+ encoding: string
+ }
+}
+
+export interface Geometry {
+ readonly frames: number
+ readonly width: number
+ readonly height: number
+ readonly fps: number
+ /** Size of the frames the generation itself uses. */
+ readonly sourceWidth: number
+ readonly sourceHeight: number
+ /** MoGe's focal length as a fraction of width, if it produced intrinsics. */
+ readonly fxNorm: number | null
+ readonly jpegs: readonly Blob[]
+ /** Metres, NaN where MoGe had no geometry. One plane per frame. */
+ readonly depth: readonly Float32Array[]
+ /** The raw half floats, ready for an R16F texture. */
+ readonly depthHalf: readonly Uint16Array[]
+}
+
+let halfTable: Float32Array | undefined
+
+function halfToFloat(): Float32Array {
+ if (halfTable) return halfTable
+ const out = new Float32Array(65536)
+ for (let h = 0; h < 65536; h++) {
+ const sign = h & 0x8000 ? -1 : 1
+ const exp = (h >> 10) & 0x1f
+ const frac = h & 0x3ff
+ out[h] =
+ exp === 0
+ ? sign * 2 ** -14 * (frac / 1024)
+ : exp === 31
+ ? frac
+ ? NaN
+ : sign * Infinity
+ : sign * 2 ** (exp - 15) * (1 + frac / 1024)
+ }
+ return (halfTable = out)
+}
+
+async function inflate(bytes: Uint8Array): Promise {
+ const stream = new Blob([bytes])
+ .stream()
+ .pipeThrough(new DecompressionStream('deflate'))
+ return new Uint8Array(await new Response(stream).arrayBuffer())
+}
+
+function validRange(offset: number, length: number, total: number): boolean {
+ return (
+ Number.isSafeInteger(offset) &&
+ Number.isSafeInteger(length) &&
+ offset >= 0 &&
+ length >= 0 &&
+ offset <= total - length
+ )
+}
+
+export async function readGeometry(buffer: ArrayBuffer): Promise {
+ const bytes = new Uint8Array(buffer)
+ if (new TextDecoder().decode(bytes.subarray(0, 8)) !== MAGIC)
+ throw new Error('Not a CrossView geometry file.')
+ if (bytes.length < 12) throw new Error('Truncated CrossView geometry header.')
+ const headLength = new DataView(buffer).getUint32(8, true)
+ if (headLength > bytes.length - 12)
+ throw new Error('Truncated CrossView geometry header.')
+ const header = JSON.parse(
+ new TextDecoder().decode(bytes.subarray(12, 12 + headLength))
+ ) as Header
+ if (header.version !== 1 || header.depth.encoding !== 'shuffle2+zlib')
+ throw new Error(`Unsupported geometry file (v${header.version}).`)
+ const blobs = bytes.subarray(12 + headLength)
+
+ const jpegs = header.jpegs.map(({ offset, length }) => {
+ if (!validRange(offset, length, blobs.length))
+ throw new Error('JPEG data is out of bounds.')
+ return new Blob([blobs.subarray(offset, offset + length)], {
+ type: 'image/jpeg'
+ })
+ })
+
+ // Every low byte, then every high byte: interleave them back into halves.
+ const { offset, length, shape } = header.depth
+ if (!validRange(offset, length, blobs.length))
+ throw new Error('Depth data is out of bounds.')
+ const planes = await inflate(blobs.subarray(offset, offset + length))
+ const [n, h, w] = shape
+ const count = n * h * w
+ if (
+ ![n, h, w, count, 2 * count].every(
+ (value) => Number.isSafeInteger(value) && value > 0
+ ) ||
+ planes.length !== 2 * count
+ )
+ throw new Error('Depth data does not match its declared shape.')
+ const halves = new Uint16Array(count)
+ for (let i = 0; i < count; i++)
+ halves[i] = planes[i] | (planes[count + i] << 8)
+
+ const table = halfToFloat()
+ const depthHalf: Uint16Array[] = []
+ const depth: Float32Array[] = []
+ for (let f = 0; f < n; f++) {
+ const plane = halves.subarray(f * h * w, (f + 1) * h * w)
+ depthHalf.push(plane)
+ depth.push(Float32Array.from(plane, (x) => table[x]))
+ }
+
+ return {
+ frames: n,
+ width: w,
+ height: h,
+ fps: header.fps,
+ sourceWidth: header.source_width,
+ sourceHeight: header.source_height,
+ fxNorm: header.fx_norm,
+ jpegs,
+ depth,
+ depthHalf
+ }
+}
diff --git a/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/generate.api.json b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/generate.api.json
new file mode 100644
index 00000000000..90e922d5fb7
--- /dev/null
+++ b/apps/website/src/lib/workshop/cinematic-studio/reshoot-engine/generate.api.json
@@ -0,0 +1,303 @@
+{
+ "1": {
+ "class_type": "LoadVideo",
+ "_meta": {
+ "title": "Source video"
+ },
+ "inputs": {
+ "file": "input.mp4"
+ }
+ },
+ "2": {
+ "class_type": "CrossViewPrepareClip",
+ "_meta": {
+ "title": "Prepare clip (24 fps, whole clip, aspect, size)"
+ },
+ "inputs": {
+ "video": ["1", 0],
+ "duration": 5.0,
+ "aspect_ratio": "source",
+ "megapixels": 0.5,
+ "multiple": 32
+ }
+ },
+ "3": {
+ "class_type": "LoadMoGeModel",
+ "_meta": {
+ "title": "MoGe model"
+ },
+ "inputs": {
+ "model_name": "moge_2_vitl_normal_fp16.safetensors"
+ }
+ },
+ "4": {
+ "class_type": "MoGeInference",
+ "_meta": {
+ "title": "Depth estimation (MoGe)"
+ },
+ "inputs": {
+ "moge_model": ["3", 0],
+ "image": ["2", 0],
+ "resolution_level": 2,
+ "fov_x_degrees": 0,
+ "batch_size": 4,
+ "force_projection": true,
+ "apply_mask": true,
+ "refine_steps": 3
+ }
+ },
+ "5": {
+ "class_type": "CrossViewWarp",
+ "_meta": {
+ "title": "CrossView Warp (camera from the page)"
+ },
+ "inputs": {
+ "frames": ["2", 0],
+ "moge_geometry": ["4", 0],
+ "azimuth": -30.0,
+ "elevation": 20.0,
+ "distance": 1.0,
+ "hfov": 50.0,
+ "vertical_shift": 0.0,
+ "depth_ratio": 6.0,
+ "smooth_depth": false,
+ "invert_depth": false,
+ "roll_lock": false,
+ "pivot_override": false,
+ "pivot_x": 0.0,
+ "pivot_y": 0.0,
+ "pivot_z": 1.05,
+ "use_keyframes": false,
+ "frame_count": 0,
+ "keyframes": "",
+ "interp_motion": "linear",
+ "interpolation": "linear",
+ "keep_source_aim": true,
+ "preview_size": 384,
+ "frame_index": 1
+ }
+ },
+ "10": {
+ "class_type": "UNETLoader",
+ "_meta": {
+ "title": "H3 ref2va"
+ },
+ "inputs": {
+ "unet_name": "minimax_h3_ref2va_pruned_int8_convrot.safetensors",
+ "weight_dtype": "default"
+ }
+ },
+ "11": {
+ "class_type": "LoraLoaderModelOnly",
+ "_meta": {
+ "title": "Turbo LoRA (8 step)"
+ },
+ "inputs": {
+ "model": ["10", 0],
+ "lora_name": "minimax_h3_ref2v_turbo_8step_v1.0_768p_comfyui_bf16.safetensors",
+ "strength_model": 1.0
+ }
+ },
+ "12": {
+ "class_type": "MiniMaxH3SigmaShift",
+ "inputs": {
+ "model": ["11", 0],
+ "shift_video": 12.0,
+ "shift_audio": 3.0
+ }
+ },
+ "13": {
+ "class_type": "ModelAttentionBackend",
+ "inputs": {
+ "model": ["12", 0],
+ "attention": "comfy kitchen attention"
+ }
+ },
+ "14": {
+ "class_type": "LoraLoaderModelOnly",
+ "_meta": {
+ "title": "CrossView-Warp LoRA"
+ },
+ "inputs": {
+ "model": ["13", 0],
+ "lora_name": "MiniMax-H3_Ref2VA-LoRA-CrossView-Warp_v1_3500.safetensors",
+ "strength_model": 0.8
+ }
+ },
+ "15": {
+ "class_type": "CLIPLoader",
+ "_meta": {
+ "title": "Qwen3-VL text encoder"
+ },
+ "inputs": {
+ "clip_name": "qwen3vl_32b_minimax_h3_int8_convrot.safetensors",
+ "type": "minimax",
+ "device": "default"
+ }
+ },
+ "16": {
+ "class_type": "VAELoader",
+ "_meta": {
+ "title": "Video VAE"
+ },
+ "inputs": {
+ "vae_name": "minimax_h3_video_vae_int8_convrot.safetensors"
+ }
+ },
+ "17": {
+ "class_type": "VAELoader",
+ "_meta": {
+ "title": "Audio VAE"
+ },
+ "inputs": {
+ "vae_name": "minimax_h3_audio_vae_fp32.safetensors"
+ }
+ },
+ "20": {
+ "class_type": "MiniMaxH3ReferenceToVideo",
+ "_meta": {
+ "title": "Source as