Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: shader god rays

dev_wandryb0382cc38d67
diff --git a/content/docs/shaders/index.mdx b/content/docs/shaders/index.mdx
index b4f002d3..a1735fcc 100644
--- a/content/docs/shaders/index.mdx
+++ b/content/docs/shaders/index.mdx
@@ -125,3 +125,16 @@ Powered by [paper-design/shaders](https://github.com/paper-design/shaders) (Apac
},
]}
/>
+
+## Light
+
+<ComponentCardGrid
+ items={[
+ {
+ name: "ShaderGodRays",
+ description: "Volumetric light rays radiating from an off-screen source",
+ status: "stable",
+ href: "/docs/shaders/shader-god-rays",
+ },
+ ]}
+/>
diff --git a/content/docs/shaders/meta.json b/content/docs/shaders/meta.json
index 6eb659b2..f67448c4 100644
--- a/content/docs/shaders/meta.json
+++ b/content/docs/shaders/meta.json
@@ -16,6 +16,7 @@
"shader-simplex-noise",
"shader-voronoi",
"shader-dot-orbit",
- "shader-dithering"
+ "shader-dithering",
+ "shader-god-rays"
]
}
diff --git a/content/docs/shaders/shader-god-rays.mdx b/content/docs/shaders/shader-god-rays.mdx
new file mode 100644
index 00000000..1bd93f3d
--- /dev/null
+++ b/content/docs/shaders/shader-god-rays.mdx
@@ -0,0 +1,37 @@
+---
+title: Shader God Rays
+description: Volumetric light rays radiating from an off-screen source
+---
+
+<ComponentPreview name="shader-god-rays" />
+
+## Installation
+
+<InstallBlock name="shader-god-rays" />
+
+## Usage
+
+```tsx
+// src/Root.tsx
+import { Composition } from "remotion";
+import { ShaderGodRays } from "@/components/remocn/shader-god-rays";
+
+const ShaderGodRaysScene = () => (
+ <ShaderGodRays speed={1} intensity={0.8} density={0.3} />
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="ShaderGodRays"
+ component={ShaderGodRaysScene}
+ durationInFrames={150}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);
+```
+
+## Credits
+
+Shader by [paper-design/shaders](https://github.com/paper-design/shaders) (Apache-2.0).
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 828f63dd..27f95dea 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -89,6 +89,8 @@ import { ShaderDithering } from "@/registry/remocn/shader-dithering";
import { shaderDitheringConfig } from "@/registry/remocn/shader-dithering/config";
import { ShaderDotOrbit } from "@/registry/remocn/shader-dot-orbit";
import { shaderDotOrbitConfig } from "@/registry/remocn/shader-dot-orbit/config";
+import { ShaderGodRays } from "@/registry/remocn/shader-god-rays";
+import { shaderGodRaysConfig } from "@/registry/remocn/shader-god-rays/config";
import { ShaderLiquidMetal } from "@/registry/remocn/shader-liquid-metal";
import { shaderLiquidMetalConfig } from "@/registry/remocn/shader-liquid-metal/config";
import { ShaderMeshGradient } from "@/registry/remocn/shader-mesh-gradient";
@@ -392,6 +394,10 @@ const registry: Record<string, RegistryEntry> = {
Component: ShaderDithering,
config: shaderDitheringConfig,
},
+ "shader-god-rays": {
+ Component: ShaderGodRays,
+ config: shaderGodRaysConfig,
+ },
"dynamic-grid": { Component: DynamicGrid, config: dynamicGridConfig },
"simulated-cursor": {
Component: SimulatedCursor,
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index 2ad5cefe..e96658bc 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -711,6 +711,22 @@
}
]
},
+ {
+ "name": "shader-god-rays",
+ "type": "registry:component",
+ "title": "Shader God Rays",
+ "description": "Volumetric light rays radiating from an off-screen source.",
+ "dependencies": [
+ "@paper-design/shaders-react"
+ ],
+ "files": [
+ {
+ "path": "shader-god-rays/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shader-god-rays.tsx"
+ }
+ ]
+ },
{
"name": "dynamic-grid",
"type": "registry:component",
diff --git a/registry/remocn/shader-god-rays/config.ts b/registry/remocn/shader-god-rays/config.ts
new file mode 100644
index 00000000..be593dae
--- /dev/null
+++ b/registry/remocn/shader-god-rays/config.ts
@@ -0,0 +1,45 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const shaderGodRaysConfig: ComponentConfig = {
+ componentName: "ShaderGodRays",
+ importPath: "@/components/remocn/shader-god-rays",
+ controls: {
+ speed: {
+ type: "number",
+ default: 1,
+ min: 0.1,
+ max: 4,
+ step: 0.1,
+ label: "Speed",
+ },
+ intensity: {
+ type: "number",
+ default: 0.8,
+ min: 0,
+ max: 2,
+ step: 0.05,
+ label: "Intensity",
+ },
+ density: {
+ type: "number",
+ default: 0.3,
+ min: 0,
+ max: 1,
+ step: 0.05,
+ label: "Density",
+ },
+ bloom: {
+ type: "number",
+ default: 0.4,
+ min: 0,
+ max: 1,
+ step: 0.05,
+ label: "Bloom",
+ },
+ colorBack: { type: "color", default: "#12121a", label: "Background" },
+ },
+ durationInFrames: 150,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+};
diff --git a/registry/remocn/shader-god-rays/index.tsx b/registry/remocn/shader-god-rays/index.tsx
new file mode 100644
index 00000000..c6bdcbe0
--- /dev/null
+++ b/registry/remocn/shader-god-rays/index.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import { GodRays, type GodRaysProps } from "@paper-design/shaders-react";
+import { useCallback, useState } from "react";
+import {
+ continueRender,
+ delayRender,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+
+const NEUTRAL_COLORS = ["#5a5a7e", "#8a8a95", "#ffffff", "#3a3a5c"];
+
+export interface ShaderGodRaysProps
+ extends Omit<GodRaysProps, "frame" | "ref"> {}
+
+export function ShaderGodRays({
+ speed = 1,
+ colorBack = "#12121a",
+ colorBloom = "#3a3a5c",
+ colors = NEUTRAL_COLORS,
+ intensity = 0.8,
+ density = 0.3,
+ bloom = 0.4,
+ className,
+ ...rest
+}: ShaderGodRaysProps) {
+ const frame = useCurrentFrame();
+ const { fps, width, height } = useVideoConfig();
+
+ const [handle] = useState(() => delayRender("shader-god-rays"));
+ const gate = useCallback(
+ (element: HTMLDivElement | null) => {
+ if (!element) return;
+ requestAnimationFrame(() =>
+ requestAnimationFrame(() => continueRender(handle)),
+ );
+ },
+ [handle],
+ );
+
+ return (
+ <div
+ ref={gate}
+ className={className}
+ style={{ position: "absolute", inset: 0 }}
+ >
+ <GodRays
+ speed={0}
+ frame={(frame / fps) * speed * 1000}
+ colorBack={colorBack}
+ colorBloom={colorBloom}
+ colors={colors}
+ intensity={intensity}
+ density={density}
+ bloom={bloom}
+ fit="cover"
+ width={width}
+ height={height}
+ {...rest}
+ />
+ </div>
+ );
+}