Skip to content

3D engine that AI agents drive

9.2 KB
Raw Blame
<!doctype html>
<html lang="en" data-theme="crucible">
  <head>
    <meta charset="UTF-8" /><script>try{var saved=localStorage.getItem("crucible-color");if(saved==="light"||saved==="dark")document.documentElement.dataset.color=saved}catch(error){}</script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="The figure keeps its size while the room behind it changes shape." />
    <link rel="canonical" href="https://crucible.codepawl.com/recipe-dolly-zoom.html" />
    <title>Field of view: a dolly zoom from FOV 75 to FOV 20 · Crucible</title>
    <link rel="icon" href="/favicon.svg?v=2" type="image/svg+xml" /><link rel="icon" href="/favicon.ico?v=2" sizes="48x48" /><link rel="apple-touch-icon" href="/apple-touch-icon.png" />
  </head>
  <body class="site recipes">
    <a class="skip-link" href="#content">Skip to content</a>
    <header class="navigation">
      <a class="brand" href="/" aria-label="Crucible home">Crucible</a>
      <nav aria-label="Library"><a href="/docs.html">Docs</a><a href="/recipes.html" aria-current="page">Recipes</a><a href="/marketplace.html">Marketplace</a><a href="/changelog.html">Changelog</a></nav>
      <a class="site-nav-cta" href="https://github.com/codepawl/crucible" aria-label="GitHub"><span class="package-logo package-logo-github" aria-hidden="true"></span><span class="site-nav-cta-label">GitHub</span></a>
    </header>
    <main id="content">
      <p class="recipe-back"><a href="/recipes.html"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m15 6-6 6 6 6"/></svg>Recipes</a></p>
      <h1>Field of view: a dolly zoom from FOV 75 to FOV 20</h1>
      <video class="recipe-clip" src="/recipes/dolly-zoom.mp4" poster="/recipes/dolly-zoom-before.webp" width="960" height="540" muted loop playsinline autoplay aria-label="Field of view: a dolly zoom from FOV 75 to FOV 20, rendered by Crucible"></video>
      <div class="recipe-pair"><figure><img src="/recipes/dolly-zoom-before.webp" width="960" height="540" alt="Field of view: a dolly zoom from FOV 75 to FOV 20: FOV 75" /><figcaption>FOV 75</figcaption></figure><figure><img src="/recipes/dolly-zoom-after.webp" width="960" height="540" alt="Field of view: a dolly zoom from FOV 75 to FOV 20: FOV 20" /><figcaption>FOV 20</figcaption></figure></div>
      <div class="recipe-why"><p>A wide lens up close and a long lens far away frame the subject the same, but the background does not agree: the colonnade is stretched at FOV 75 and squeezed flat at FOV 20.</p><p>Two camera tracks do it. One animates the FOV. The other moves the camera back to distance 1.35 / tan(FOV / 2) from the figure, so the frame always covers 2.7 m at the figure and the figure keeps its size.</p></div>
      <section class="recipe-code" aria-labelledby="scene-code-title">
        <div class="recipe-code-heading"><h2 id="scene-code-title">Scene code</h2><button type="button" data-copy-code="scene-code">Copy</button></div>
        <pre><code id="scene-code">{
  &quot;format&quot;: &quot;crucible.scene&quot;,
  &quot;schemaVersion&quot;: 1,
  &quot;geometries&quot;: [
    { &quot;id&quot;: &quot;post&quot;, &quot;type&quot;: &quot;cylinder&quot;, &quot;segments&quot;: 32 },
    { &quot;id&quot;: &quot;ball&quot;, &quot;type&quot;: &quot;sphere&quot;, &quot;segments&quot;: 48, &quot;rings&quot;: 32 },
    { &quot;id&quot;: &quot;floor&quot;, &quot;type&quot;: &quot;box&quot;, &quot;bevel&quot;: 0 }
  ],
  &quot;materials&quot;: [
    { &quot;id&quot;: &quot;subject&quot;, &quot;color&quot;: [0.9, 0.35, 0.12], &quot;metallic&quot;: 0, &quot;roughness&quot;: 0.45 },
    { &quot;id&quot;: &quot;stone&quot;, &quot;color&quot;: [0.62, 0.6, 0.56], &quot;metallic&quot;: 0, &quot;roughness&quot;: 0.8 },
    { &quot;id&quot;: &quot;ground&quot;, &quot;color&quot;: [0.3, 0.32, 0.34], &quot;metallic&quot;: 0, &quot;roughness&quot;: 0.9 }
  ],
  &quot;nodes&quot;: [
    { &quot;id&quot;: &quot;ground&quot;, &quot;geometry&quot;: &quot;floor&quot;, &quot;material&quot;: &quot;ground&quot;, &quot;translation&quot;: [0, -0.05, -8], &quot;scale&quot;: [14, 0.1, 30] },
    { &quot;id&quot;: &quot;figure-body&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;subject&quot;, &quot;translation&quot;: [0, 0.55, 0], &quot;scale&quot;: [0.28, 1.1, 0.28] },
    { &quot;id&quot;: &quot;figure-head&quot;, &quot;geometry&quot;: &quot;ball&quot;, &quot;material&quot;: &quot;subject&quot;, &quot;translation&quot;: [0, 1.3, 0], &quot;scale&quot;: [0.3, 0.3, 0.3] },
    { &quot;id&quot;: &quot;left-1&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [-2.2, 1.2, -2], &quot;scale&quot;: [0.35, 2.4, 0.35] },
    { &quot;id&quot;: &quot;left-2&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [-2.2, 1.2, -5], &quot;scale&quot;: [0.35, 2.4, 0.35] },
    { &quot;id&quot;: &quot;left-3&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [-2.2, 1.2, -8], &quot;scale&quot;: [0.35, 2.4, 0.35] },
    { &quot;id&quot;: &quot;left-4&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [-2.2, 1.2, -11], &quot;scale&quot;: [0.35, 2.4, 0.35] },
    { &quot;id&quot;: &quot;right-1&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [2.2, 1.2, -2], &quot;scale&quot;: [0.35, 2.4, 0.35] },
    { &quot;id&quot;: &quot;right-2&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [2.2, 1.2, -5], &quot;scale&quot;: [0.35, 2.4, 0.35] },
    { &quot;id&quot;: &quot;right-3&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [2.2, 1.2, -8], &quot;scale&quot;: [0.35, 2.4, 0.35] },
    { &quot;id&quot;: &quot;right-4&quot;, &quot;geometry&quot;: &quot;post&quot;, &quot;material&quot;: &quot;stone&quot;, &quot;translation&quot;: [2.2, 1.2, -11], &quot;scale&quot;: [0.35, 2.4, 0.35] }
  ],
  &quot;camera&quot;: { &quot;eye&quot;: [0, 0.8, 1.759],&quot;target&quot;: [0, 0.8, 0], &quot;fov&quot;: 75 },
  &quot;environment&quot;: { &quot;world&quot;: true, &quot;lightDirection&quot;: [-0.5, 1, 0.6], &quot;keyIntensity&quot;: 1.6, &quot;ambientIntensity&quot;: 0.5, &quot;skyTop&quot;: [0.55, 0.7, 0.9], &quot;skyBottom&quot;: [0.85, 0.88, 0.9] },
  &quot;motion&quot;: {
    &quot;duration&quot;: 4.8,
    &quot;loop&quot;: false,
    &quot;tracks&quot;: [
      {
        &quot;kind&quot;: &quot;camera&quot;, &quot;property&quot;: &quot;fov&quot;, &quot;interpolation&quot;: &quot;LINEAR&quot;,
        &quot;keyframes&quot;: [{ &quot;time&quot;: 0, &quot;value&quot;: 75 }, { &quot;time&quot;: 0.4, &quot;value&quot;: 70.42 }, { &quot;time&quot;: 0.8, &quot;value&quot;: 65.83 }, { &quot;time&quot;: 1.2, &quot;value&quot;: 61.25 }, { &quot;time&quot;: 1.6, &quot;value&quot;: 56.67 }, { &quot;time&quot;: 2, &quot;value&quot;: 52.08 }, { &quot;time&quot;: 2.4, &quot;value&quot;: 47.5 }, { &quot;time&quot;: 2.8, &quot;value&quot;: 42.92 }, { &quot;time&quot;: 3.2, &quot;value&quot;: 38.33 }, { &quot;time&quot;: 3.6, &quot;value&quot;: 33.75 }, { &quot;time&quot;: 4, &quot;value&quot;: 29.17 }, { &quot;time&quot;: 4.4, &quot;value&quot;: 24.58 }, { &quot;time&quot;: 4.8, &quot;value&quot;: 20 }]
      },
      {
        &quot;kind&quot;: &quot;camera&quot;, &quot;property&quot;: &quot;eye&quot;, &quot;interpolation&quot;: &quot;LINEAR&quot;,
        &quot;keyframes&quot;: [{ &quot;time&quot;: 0, &quot;value&quot;: [0, 0.8, 1.759] }, { &quot;time&quot;: 0.4, &quot;value&quot;: [0, 0.8, 1.913] }, { &quot;time&quot;: 0.8, &quot;value&quot;: [0, 0.8, 2.086] }, { &quot;time&quot;: 1.2, &quot;value&quot;: [0, 0.8, 2.28] }, { &quot;time&quot;: 1.6, &quot;value&quot;: [0, 0.8, 2.504] }, { &quot;time&quot;: 2, &quot;value&quot;: [0, 0.8, 2.763] }, { &quot;time&quot;: 2.4, &quot;value&quot;: [0, 0.8, 3.068] }, { &quot;time&quot;: 2.8, &quot;value&quot;: [0, 0.8, 3.434] }, { &quot;time&quot;: 3.2, &quot;value&quot;: [0, 0.8, 3.884] }, { &quot;time&quot;: 3.6, &quot;value&quot;: [0, 0.8, 4.45] }, { &quot;time&quot;: 4, &quot;value&quot;: [0, 0.8, 5.188] }, { &quot;time&quot;: 4.4, &quot;value&quot;: [0, 0.8, 6.197] }, { &quot;time&quot;: 4.8, &quot;value&quot;: [0, 0.8, 7.656] }]
      }
    ]
  }
}</code></pre>
      </section>
      <p class="recipe-file"><a href="/recipes/dolly-zoom.json" download>Download dolly-zoom.json</a><span>Paste it into <code>scene_create</code> as <code>recipe</code>.</span></p>
    </main>
    <footer class="site-footer" aria-label="Site footer">
      <p><a class="brand" href="/" aria-label="Crucible home">Crucible</a> by <a href="https://codepawl.com">CodePawl</a></p>
      <nav class="footer-links" aria-label="Project links"><a href="https://github.com/codepawl/crucible"><span class="package-logo package-logo-github" aria-hidden="true"></span>GitHub</a><a href="https://www.npmjs.com/package/@codepawlhq/crucible"><span class="package-logo package-logo-npm" aria-hidden="true"></span>npm</a><a href="/changelog.md">Changelog</a><a href="/license.txt">MIT license</a></nav>
    </footer>
    <script type="module" src="/src/recipes.js"></script>
  </body>
</html>