Communitygithub.com

SJbuilds04/vybe-cinematic-3d

确定性 Three.js / WebGL技能,专为HyperFrames视频打造——创建3D场景、粒子系统、程序化几何体、产品转盘、科学模型(分子、行星、黑洞)、照明装置、相机路径与镜头切换,严格按HyperFrames时间逐帧渲染。当VYBE分镜需要3D效果、深度感、粒子、太空场景、旋转产品、数据雕塑,或当Three.js图层渲染为黑色、闪烁或不同时,请使用此技能。

vybe-cinematic-3d 是什么?

该技能为VYBE系统提供确定性3D渲染能力,基于Three.js (v0.181.2) 和WebGL,专为HyperFrames视频的逐帧渲染而设计。其核心设定是:每一帧都是时间的纯函数,完全放弃 `requestAnimationFrame`、时钟和增量(deltas),仅通过 `hf-seek` 事件驱动渲染,确保在不同环境下获得一致、可重现的画面。该技能支持构建粒子系统、程序化地形、行星、黑洞、分子结构、产品转盘以及数据雕塑等多种3D场景,并内置了一套完善的光照(三点布光)和相机(平滑步进+剪辑)方案。它适用于任何需要确定性3D效果的VYBE项目,尤其适合处理Three.js图层渲染异常的问题。虽然性能受限于headless Chrome的软件GL,但通过约束多边形和粒子数量、模拟发光效果等技巧,仍能产出高质量的电影感画面。使用方法为在宿主HTML或场景文件中嵌入Canvas和渲染逻辑,严格遵循给定的代码模板和契约。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/SJbuilds04/VYBE/tree/HEAD/skills/vybe-cinematic-3d

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

VYBE 电影感 3D

HyperFrames 视频中的 3D 是一个 <canvas>,其每一帧都是时间的纯函数。 HyperFrames 的 three 适配器发布时间;你来渲染它。 权威参考:/hyperframes-animation → adapters/three.md(安装后)。

契约(不可协商)

  • 导入固定:import * as THREE from "https://cdn.jsdelivr.net/npm/[email protected]/+esm"; (或者使用importmap固定相同版本用于附加组件)。
  • 在加载时同步构建场景、相机、渲染器、材质;在渲染临界寻找前加载任何模型/纹理(Three 的 DefaultLoadingManager 会自动等待)。对于繁重的 CPU 设置,注册 window.__hf.buildReady["<name>"] = promise。
  • 仅从时间渲染:window.addEventListener("hf-seek", e => renderAt(e.detail.time)); renderAt(window.__hfThreeTime || 0);
  • 无需 requestAnimationFrame 循环、时钟、增量(deltas)或未种子化的 Math.random()。
  • renderer.setPixelRatio(1); renderer.setSize(W, H, false),其中 W/H 来自根元素的 data-width/height。根元素必须包含 data-duration。
  • 标记全出血画布 data-layout-allow-overflow。

骨架代码

<canvas id="gl" width="1920" height="1080" data-layout-allow-overflow></canvas>
<script type="module">
  import * as THREE from "https://cdn.jsdelivr.net/npm/[email protected]/+esm";
  const root = document.getElementById("vybe-root");
  const W = +root.dataset.width, H = +root.dataset.height, D = +root.dataset.duration;
  const css = getComputedStyle(document.documentElement);
  const tok = (n, f) => css.getPropertyValue(n).trim() || f;           // 读取 VYBE 令牌
  const renderer = new THREE.WebGLRenderer({ canvas: document.getElementById("gl"), antialias: true });
  renderer.setPixelRatio(1); renderer.setSize(W, H, false);
  renderer.setClearColor(new THREE.Color(tok("--vy-bg", "#000")), 1);
  const scene = new THREE.Scene();
  const camera = new THREE.PerspectiveCamera(W > H ? 40 : 60, W / H, 0.1, 200); // 竖屏时使用更宽的 FOV
  // … 构建 …
  function renderAt(t) { const p = t / D; /* 根据 t 更新相机 + 对象 */ renderer.render(scene, camera); }
  window.addEventListener("hf-seek", (e) => renderAt(e.detail.time));
  renderAt(window.__hfThreeTime || 0);
</script>

当 3D 世界跨越多个场景时(例如相机在影片中弧线运动),将画布放在宿主(index.html)中;仅当 3D 内容仅存在于单个场景时,才将其放在场景文件中。 在其上方叠加 HTML 类型;当 DOM 文本可用时,绝不在 WebGL 中渲染文本。

技巧与配方

  • 粒子 / 尘埃 / 星星: 使用 THREE.Points,结合带种子的伪随机数生成器(PRNG)生成位置、从调色板获取顶点颜色,并使用圆形精灵(CanvasTexture 径向渐变作为 map)——默认点是方形——AdditiveBlending,depthWrite: false。确保每个粒子都超出相机最近的 z 值,否则当相机穿过它时,它会膨胀成一个巨大的精灵(这是真实的 VYBE 缺陷)。
  • 英雄球体 / 行星: SphereGeometry(r, 96, 64) + MeshStandardMaterial(金属度/粗糙度) + 发光光晕 TorusGeometry 环;随时间点亮它。
  • 黑洞: 暗色球体 + 吸积盘 = 使用画布渐变纹理的 RingGeometry,倾斜 70–80°,旋转;透镜环 = 第二个面向相机的薄圆环;恒星弯曲 = 在径向方向上靠近中心缩放背景点图层。
  • 分子: 原子位置上的球体(使用 InstancedMesh 大量实例化),它们之间的圆柱体(使用 quaternion.setFromUnitVectors 定向);相机环绕。
  • 产品转盘: 通过 GLTFLoader(importmap)加载 GLTF,使用 AnimationMixer.setTime(t) 处理创作好的动画片段;下方放置工作室灯光;在镜头中缓慢旋转 20–35°。
  • 数据雕塑: 使用 InstancedMesh 盒子,其高度来自数据,并随时间通过 smoothstep 函数生长。
  • 程序化地形/波浪: 在 JS 中根据 t 置换 PlaneGeometry(每帧重新计算位置,适用于 ≤40k 顶点)或在 ShaderMaterial 中使用在 renderAt 中设置的 uTime uniform。

光照

加载 references/lighting.md。最小灯光配置:主光(点光/方向光)、对比色补光/逆光,以及一个 HemisphereLight 环境光——一个只有一盏光源的网格会在其暗面显示为黑色剪影。以固定的比例,从相同的时间函数驱动灯光强度。

相机

从归一化进度 p = t / D 推导位置,每一幕使用带有 smoothstep 片段的摄影机路径(参见电影模板的 renderAt)。对于剪辑,声明 const CUT_B = 23 一次,并同时用于相机镜头选择器和对象可见性;检查剪辑前后的帧(snapshot --at 22.9667,23)。

性能(headless Chrome 可能使用软件 GL)

  • ≤ 100k 三角形,≤ 20k 粒子,无需需要帧历史的后处理通道。辉光效果:使用加法混合的精灵/光晕模拟。
  • 在低内存机器上避免为 4K 超大画布启用 antialias;测试草稿渲染。
  • 如果 WebGL 在渲染环境中失败,画布会变黑:质量检查(QC)会检测到黑帧;此时应回退到 2D 画布或场景的 CSS-3D 版本。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

SJbuilds04/vybe-audio-design

Sound design and music direction for VYBE / HyperFrames videos — choosing music by mood and arc, spotting sound effects to picture, voiceover direction and provider choice (HeyGen, ElevenLabs, Kokoro, Gemini), ducking, loudness targets, beat-synced editing and caption sync. Use when planning or fixing the audio of a video, when a video feels silent, cheap, cluttered or out of sync, or when choosing a voice or music provider.

SJbuilds04/vybe-image-to-motion

Animate a still image into video. Analyzes the image, plans the motion, and picks the right technique — programmatic 2.5D (camera moves, depth-map parallax, subject/background layer separation, particles, fog, light) or AI image-to-video (Runway Gen-4.5 / Veo 3.1 / Kling 3.0, Luma Ray 3.2, Gemini Omni Flash) for organic motion like walking, faces, water or hair — then composes the result in HyperFrames with music, SFX and text. Use when someone supplies an image and asks to animate it, bring it

SJbuilds04/vybe-motion-design

Motion design craft for VYBE / HyperFrames videos — animation principles, easing and timing, choreography and staggering, scene transitions, camera movement, and visual effects (blur, glow, masks, grain, light leaks), written as seek-safe GSAP recipes. Use when designing or fixing how things move in a video — entrances, exits, transitions between scenes, camera moves, rhythm, or when motion feels generic, floaty, stiff or repetitive.

SJbuilds04/vybe-typography

Typography for motion — type systems, font pairing with bundled OFL fonts, scale and readability rules for video, kinetic typography techniques, per-letter/word animation, captions design and safe zones, in HyperFrames compositions. Use when choosing fonts, sizing or animating text in a VYBE video, building kinetic type or lyric videos, styling captions, or when text overlaps, clips, is unreadable or looks generic.

相关技能