{"job_id":"anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c","request_id":"test-physics-snell-1b2ba770-6450-4b1c-a815-8b28db3d7c87-1778704510421","status":"complete","asset":{"primary_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c/walkthrough.mp4","thumbnail_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c/thumb.jpg","transcript_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c/transcript.vtt","interactive_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c/index.html","scenefile_url":"https://storage.googleapis.com/pupiltree-animation-assets/anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c/scene-source.json","duration_seconds":15,"byte_size":520327,"renderer":"html_three_js_local","parameters":{"style":"auto","executor":"native_render_executor","localPath":"/app/storage/assets/anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c","interactivity":"none","renderer_style":"three_js","durationSeconds":15,"render_manifest":{"jobId":"anim-job-bf709529-1cc7-4d4c-9c61-5edb0814c90c","request":{"gap":{"topic":"snell-refraction-angle","severity":"moderate","error_type":"formula_misuse","memory_state":"fragile","display_topic":"Snell's Law — Refraction at an Interface","common_wrong_answer":"Refracted ray bends away from normal when going from rare to dense medium.","confidence_at_error":"high","correct_understanding":"Going from rare to dense medium (n1 < n2) the ray bends toward the normal: n1 sin θ1 = n2 sin θ2."},"target":{"style":"auto","render":{"fps":30,"format":"mp4","resolution":"1920x1080","include_thumbnail":true,"include_transcript":true},"audience":{"tone":"neutral_instructional","grade":"12","language":"en"},"interactivity":"none","duration_seconds":15},"context":{"chapter":{"name":"Ray Optics","ncert_class":12,"ncert_chapter_number":9},"sub_topics":[{"topic":"Refraction","key_concepts":["Snell's law","refractive index","critical angle","total internal reflection"]}]},"metadata":{"priority":"normal"},"exam_type":"neet","asset_type":"simulation","request_id":"test-physics-snell-1b2ba770-6450-4b1c-a815-8b28db3d7c87-1778704510421","subject_area":"physics"},"renderer":"html_three_js_local","storyboard":{"beats":[{"label":"Topic","visual":"Show the topic title and the key physical context.","narration":"Snell's Law — Refraction at an Interface"},{"label":"Mistake","visual":"Show the wrong approach and why it seems plausible.","narration":"Refracted ray bends away from normal when going from rare to dense medium."},{"label":"Correction","visual":"Show the right approach step by step.","narration":"Going from rare to dense medium (n1 < n2) the ray bends toward the normal: n1 sin θ1 = n2 sin θ2."},{"label":"Concept","visual":"Highlight the key formula and the governing relationship.","narration":"Snell's law. refractive index. critical angle"}],"title":"Snell's Law — Refraction at an Interface","sceneCode":"<!doctype html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\"/>\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n  <title>Snell's Law Refraction Remediation</title>\n  <style>\n    :root{--bg:#0f1418;--panel:#182228;--line:#2e3e46;--accent:#e5ba67;--text:#f4f1ea;--muted:#c8d4da;--blue:#63b3ff;--green:#87e8a8;--red:#de7f76;}\n    *{box-sizing:border-box;}\n    body{margin:0;font-family:\"Plus Jakarta Sans\",\"Manrope\",ui-sans-serif,system-ui,sans-serif;background:radial-gradient(120% 90% at 20% -5%,#24343d 0%,var(--bg) 55%);color:var(--text);}\n    main{min-height:100vh;display:grid;grid-template-columns:minmax(300px,380px) 1fr;}\n    aside{border-right:1px solid var(--line);background:linear-gradient(180deg,rgba(31,46,53,.86),rgba(24,34,40,.92));padding:24px;overflow:auto;backdrop-filter:blur(6px);}\n    section{padding:24px;display:grid;place-items:center;}\n    h1{margin:0 0 10px;font-size:1.65rem;line-height:1.15;}\n    .sub{margin:0 0 16px;color:var(--muted);}\n    .formula{margin:0 0 14px;padding:10px;border:1px solid var(--line);border-radius:10px;background:#11191e;color:var(--accent);font-family:ui-monospace,monospace;font-size:0.9rem;box-shadow:inset 0 0 28px rgba(229,186,103,.08);}\n    .mistake{margin:0 0 14px;padding:10px;border:1px solid #de7f76;border-radius:10px;background:#26181a;color:#de7f76;font-family:ui-monospace,monospace;font-size:0.9rem;box-shadow:inset 0 0 28px rgba(222,127,118,.08);}\n    .control{display:grid;gap:6px;margin:12px 0;}\n    .control input{width:100%;accent-color:var(--accent);}\n    ul{margin:14px 0 0 18px;padding:0;color:var(--muted);display:grid;gap:6px;}\n    .stage{width:min(1020px,95%);aspect-ratio:16/9;border:1px solid #445862;border-radius:14px;position:relative;overflow:hidden;background:radial-gradient(circle at 50% 38%,#2f4a57,#0f1418 72%);box-shadow:0 18px 60px rgba(0,0,0,.45), inset 0 0 90px rgba(255,255,255,.03);}\n    .stage::before{content:\"\";position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,255,255,.06),transparent 34%);pointer-events:none;}\n    .legend{position:absolute;right:12px;top:12px;padding:8px 10px;border-radius:10px;border:1px solid #465a64;background:rgba(9,14,18,.58);font-size:0.8rem;color:var(--muted);backdrop-filter:blur(4px);}\n    @media(max-width:900px){main{grid-template-columns:1fr;}aside{border-right:0;border-bottom:1px solid var(--line);}}\n  </style>\n</head>\n<body>\n<main>\n  <aside>\n    <h1>Snell's Law</h1>\n    <p class=\"sub\">Refraction at an Interface — Why the Ray Bends</p>\n    <p class=\"formula\">n₁ sin θ₁ = n₂ sin θ₂</p>\n    <p class=\"mistake\">❌ Wrong: ray bends AWAY from normal when going rare→dense</p>\n    <p class=\"formula\" style=\"color:#87e8a8; border-color:#87e8a8;\">✓ Correct: ray bends TOWARD normal when n₁ < n₂</p>\n    <label class=\"control\"><span>n₁ (Rarer Medium): <strong id=\"v-n1\">1.0</strong></span><input id=\"c-n1\" type=\"range\" min=\"1\" max=\"1.5\" step=\"0.1\" value=\"1.0\"/></label>\n    <label class=\"control\"><span>n₂ (Denser Medium): <strong id=\"v-n2\">1.5</strong></span><input id=\"c-n2\" type=\"range\" min=\"1\" max=\"2\" step=\"0.1\" value=\"1.5\"/></label>\n    <label class=\"control\"><span>Incident Angle θ₁: <strong id=\"v-theta1\">35</strong>°</span><input id=\"c-theta1\" type=\"range\" min=\"10\" max=\"80\" step=\"5\" value=\"35\"/></label>\n    <ul>\n      <li><strong>Light slows down</strong> in denser medium → wavelength ↓</li>\n      <li><strong>Snell's Law keeps flux constant:</strong> n₁ sin θ₁ = n₂ sin θ₂</li>\n      <li>Larger n₂ → larger denominator → smaller angle θ₂</li>\n      <li>Ray must bend <strong>TOWARD</strong> normal to satisfy the law</li>\n    </ul>\n  </aside>\n  <section>\n    <div class=\"stage\" id=\"stage\">\n      <div class=\"legend\" id=\"legend\">n₁=1.0 → n₂=1.5</div>\n      <canvas id=\"sim-cv\" style=\"position:absolute;inset:0;width:100%;height:100%;\"></canvas>\n    </div>\n  </section>\n</main>\n<script>\nconst controls=[\n  {\"key\":\"n1\",\"label\":\"n₁ (Rarer Medium)\",\"min\":1,\"max\":1.5,\"step\":0.1,\"value\":1.0,\"units\":\"\"},\n  {\"key\":\"n2\",\"label\":\"n₂ (Denser Medium)\",\"min\":1,\"max\":2,\"step\":0.1,\"value\":1.5,\"units\":\"\"},\n  {\"key\":\"theta1\",\"label\":\"Incident Angle\",\"min\":10,\"max\":80,\"step\":5,\"value\":35,\"units\":\"°\"}\n];\nfor(const c of controls){\n  const inp=document.getElementById('c-'+c.key);\n  const out=document.getElementById('v-'+c.key);\n  inp?.addEventListener('input',()=>{out.textContent=inp.value;window.updateModel?.();});\n}\n(function(){\n  const cv=document.getElementById('sim-cv');\n  const ctx=cv.getContext('2d');\n  function resize(){const r=cv.getBoundingClientRect();if(r.width>0){cv.width=r.width;cv.height=r.height;}}\n  resize();new ResizeObserver(resize).observe(cv);\n  \n  let lastTs=0;\n  let rayPhase=0;\n  let trailIncident=[];\n  let trailRefracted=[];\n  \n  function arrow(x1,y1,x2,y2,color){\n    const dx=x2-x1,dy=y2-y1,l=Math.sqrt(dx*dx+dy*dy);\n    if(l<2)return;\n    const nx=dx/l,ny=dy/l,s=10;\n    ctx.strokeStyle=color;ctx.lineWidth=2;\n    ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.stroke();\n    ctx.fillStyle=color;ctx.beginPath();\n    ctx.moveTo(x2,y2);\n    ctx.lineTo(x2-s*nx+s*0.4*ny,y2-s*ny-s*0.4*nx);\n    ctx.lineTo(x2-s*nx-s*0.4*ny,y2-s*ny+s*0.4*nx);\n    ctx.fill();\n  }\n  \n  function glowDot(x,y,r,color,a){\n    const g=ctx.createRadialGradient(x,y,0,x,y,r*2.6);\n    g.addColorStop(0,color.replace('ALPHA',String(a)));\n    g.addColorStop(1,color.replace('ALPHA','0'));\n    ctx.fillStyle=g;\n    ctx.beginPath();ctx.arc(x,y,r*2.6,0,Math.PI*2);ctx.fill();\n  }\n  \n  function tick(ts){\n    const dt=Math.min(0.04,(ts-lastTs)/1000);lastTs=ts;\n    const W=cv.width,H=cv.height;\n    \n    const n1=Number(document.getElementById('c-n1').value)||1.0;\n    const n2=Number(document.getElementById('c-n2').value)||1.5;\n    const theta1Deg=Number(document.getElementById('c-theta1').value)||35;\n    const theta1=theta1Deg*Math.PI/180;\n    \n    rayPhase=(rayPhase+dt*0.8)%6.28;\n    \n    ctx.fillStyle='#0f1418';\n    ctx.fillRect(0,0,W,H);\n    \n    // Gradient background layers\n    const g1=ctx.createLinearGradient(0,0,0,H);\n    g1.addColorStop(0,'rgba(47,74,87,0.4)');\n    g1.addColorStop(1,'rgba(15,20,24,0.2)');\n    ctx.fillStyle=g1;\n    ctx.fillRect(0,0,W,H);\n    \n    // Interface at middle\n    const interfaceY=H*0.5;\n    \n    // Top: rarer medium (n1)\n    ctx.fillStyle='rgba(99,179,255,0.08)';\n    ctx.fillRect(0,0,W,interfaceY);\n    ctx.fillStyle='rgba(99,179,255,0.02)';\n    for(let i=0;i<5;i++){\n      ctx.fillRect(0,i*interfaceY/5,W,2);\n    }\n    \n    // Bottom: denser medium (n2)\n    ctx.fillStyle='rgba(222,127,118,0.08)';\n    ctx.fillRect(0,interfaceY,W,H);\n    ctx.fillStyle='rgba(222,127,118,0.02)';\n    for(let i=0;i<5;i++){\n      ctx.fillRect(0,interfaceY+i*(H-interfaceY)/5,W,2);\n    }\n    \n    // Interface line with labels\n    ctx.strokeStyle='#445862';\n    ctx.lineWidth=3;\n    ctx.setLineDash([8,4]);\n    ctx.beginPath();ctx.moveTo(0,interfaceY);ctx.lineTo(W,interfaceY);ctx.stroke();\n    ctx.setLineDash([]);\n    \n    ctx.fillStyle='#c8d4da';\n    ctx.font=Math.round(H*0.035)+'px sans-serif';\n    ctx.fillText('n₁ = '+n1.toFixed(1),W*0.05,interfaceY-H*0.06);\n    ctx.fillText('n₂ = '+n2.toFixed(1),W*0.05,interfaceY+H*0.08);\n    \n    // Normal line (vertical)\n    const normalX=W*0.5;\n    ctx.strokeStyle='#e5ba67';\n    ctx.lineWidth=1.5;\n    ctx.setLineDash([3,3]);\n    ctx.beginPath();ctx.moveTo(normalX,0);ctx.lineTo(normalX,H);ctx.stroke();\n    ctx.setLineDash([]);\n    ctx.fillStyle='#e5ba67';\n    ctx.font=Math.round(H*0.03)+'px sans-serif';\n    ctx.fillText('Normal',normalX+H*0.02,H*0.08);\n    \n    // Incident ray animation\n    const rayStartDist=H*0.25;\n    const incidentX1=normalX-rayStartDist*Math.sin(theta1);\n    const incidentY1=interfaceY-rayStartDist*Math.cos(theta1);\n    \n    const incidentX2=normalX;\n    const incidentY2=interfaceY;\n    \n    // Draw incident ray with trail\n    ctx.strokeStyle='#63b3ff';\n    ctx.lineWidth=3;\n    ctx.setLineDash([]);\n    ctx.beginPath();\n    ctx.moveTo(incidentX1,incidentY1);\n    ctx.lineTo(incidentX2,incidentY2);\n    ctx.stroke();\n    \n    // Ray pulse glow\n    glowDot(incidentX2,incidentY2,8,'rgba(99,179,255,ALPHA)',0.6);\n    \n    // Incident angle arc\n    ctx.strokeStyle='#63b3ff';\n    ctx.lineWidth=1;\n    ctx.beginPath();\n    ctx.arc(normalX,interfaceY,H*0.08,Math.PI*1.5,Math.PI*1.5+theta1,false);\n    ctx.stroke();\n    ctx.fillStyle='#63b3ff';\n    ctx.font=Math.round(H*0.032)+'px sans-serif';\n    ctx.fillText('θ₁',normalX+H*0.095,interfaceY-H*0.035);\n    \n    // Draw incident angle value\n    ctx.fillStyle='#63b3ff';\n    ctx.fillText(theta1Deg+'°',normalX-H*0.12,interfaceY-H*0.12);\n    \n    // REFRACTED RAY (correct physics)\n    // Snell's law: n1*sin(theta1) = n2*sin(theta2)\n    const sinTheta2=(n1*Math.sin(theta1))/n2;\n    const theta2=Math.asin(Math.min(1,sinTheta2));\n    \n    const refractedDist=H*0.25;\n    const refractedX3=normalX+refractedDist*Math.sin(theta2);\n    const refractedY3=interfaceY+refractedDist*Math.cos(theta2);\n    \n    // Draw refracted ray (green = correct)\n    ctx.strokeStyle='#87e8a8';\n    ctx.lineWidth=3;\n    ctx.beginPath();\n    ctx.moveTo(incidentX2,incidentY2);\n    ctx.lineTo(refractedX3,refractedY3);\n    ctx.stroke();\n    \n    glowDot(refractedX3,refractedY3,8,'rgba(135,232,168,ALPHA)',0.6);\n    \n    // Refracted angle arc\n    ctx.strokeStyle='#87e8a8';\n    ctx.lineWidth=1;\n    ctx.beginPath();\n    ctx.arc(normalX,interfaceY,H*0.12,Math.PI*1.5,Math.PI*1.5+theta2,false);\n    ctx.stroke();\n    ctx.fillStyle='#87e8a8';\n    ctx.fillText('θ₂',normalX+H*0.14,interfaceY+H*0.05);\n    \n    // Draw refracted angle value\n    ctx.fillStyle='#87e8a8';\n    const theta2Deg=theta2*180/Math.PI;\n    ctx.fillText(theta2Deg.toFixed(1)+'°","remediationGoal":"Close formula_misuse for physics."},"rendererStyle":"three_js"}}},"metadata":{"rendered_at":"2026-05-13T20:45:12.534Z","cache_hit":false,"cost_usd":0},"error":null}