Using Three.js and React Three Fiber in Remotion
Follow React Three Fiber and Three.js best practices.Only the following Remotion-specific rules need to be followed:
Prerequisites
First, the@remotion/three package needs to be installed.If it is not, use the following command:
Using ThreeCanvas
You MUST wrap 3D content in<ThreeCanvas> and include proper lighting.<ThreeCanvas> MUST have a width and height prop.
No animations not driven by useCurrentFrame()
Shaders, models etc MUST NOT animate by themselves.No animations are allowed unless they are driven by
useCurrentFrame().Otherwise, it will cause flickering during rendering. Using
useFrame() from @react-three/fiber is forbidden.
Animate using useCurrentFrame()
Use useCurrentFrame() to perform animations.
Using <Sequence> inside <ThreeCanvas>
The layout prop of any <Sequence> inside a <ThreeCanvas> must be set to none.