react-three-fiber

द्वारा vercel

React Three Fiber 3D रेंडरर json-render के लिए। @json-render/react-three-fiber के साथ काम करते समय, JSON स्पेक्स से 3D दृश्य बनाने, रेंडर करने…

npx skills add https://github.com/vercel-labs/json-render --skill react-three-fiber

@json-render/react-three-fiber

React Three Fiber renderer for json-render. 19 built-in 3D components.

Two Entry Points

Entry PointExportsUse For
@json-render/react-three-fiber/catalogthreeComponentDefinitionsCatalog schemas (no R3F dependency, safe for server)
@json-render/react-three-fiberthreeComponents, ThreeRenderer, ThreeCanvas, schemasR3F implementations and renderer

Usage Pattern

Pick the 3D components you need from the standard definitions:

import { defineCatalog } from "@json-render/core";
import { schema } from "@json-render/react/schema";
import { threeComponentDefinitions } from "@json-render/react-three-fiber/catalog";
import { defineRegistry } from "@json-render/react";
import { threeComponents, ThreeCanvas } from "@json-render/react-three-fiber";

// Catalog: pick definitions
const catalog = defineCatalog(schema, {
  components: {
    Box: threeComponentDefinitions.Box,
    Sphere: threeComponentDefinitions.Sphere,
    AmbientLight: threeComponentDefinitions.AmbientLight,
    DirectionalLight: threeComponentDefinitions.DirectionalLight,
    OrbitControls: threeComponentDefinitions.OrbitControls,
  },
  actions: {},
});

// Registry: pick matching implementations
const { registry } = defineRegistry(catalog, {
  components: {
    Box: threeComponents.Box,
    Sphere: threeComponents.Sphere,
    AmbientLight: threeComponents.AmbientLight,
    DirectionalLight: threeComponents.DirectionalLight,
    OrbitControls: threeComponents.OrbitControls,
  },
});

Rendering

ThreeCanvas (convenience wrapper)

<ThreeCanvas
  spec={spec}
  registry={registry}
  shadows
  camera={{ position: [5, 5, 5], fov: 50 }}
  style={{ width: "100%", height: "100vh" }}
/>

Manual Canvas setup

import { Canvas } from "@react-three/fiber";
import { ThreeRenderer } from "@json-render/react-three-fiber";

<Canvas shadows>
  <ThreeRenderer spec={spec} registry={registry}>
    {/* Additional R3F elements */}
  </ThreeRenderer>
</Canvas>

Available Components (19)

Primitives (7)

  • Box -- width, height, depth, material
  • Sphere -- radius, widthSegments, heightSegments, material
  • Cylinder -- radiusTop, radiusBottom, height, material
  • Cone -- radius, height, material
  • Torus -- radius, tube, material
  • Plane -- width, height, material
  • Capsule -- radius, length, material

All primitives share: position, rotation, scale, castShadow, receiveShadow, material.

Lights (4)

  • AmbientLight -- color, intensity
  • DirectionalLight -- position, color, intensity, castShadow
  • PointLight -- position, color, intensity, distance, decay
  • SpotLight -- position, color, intensity, angle, penumbra

Other (8)

  • Group -- container with position/rotation/scale, supports children
  • Model -- GLTF/GLB loader via url prop
  • Environment -- HDRI environment map (preset, background, blur, intensity)
  • Fog -- linear fog (color, near, far)
  • GridHelper -- reference grid (size, divisions, color)
  • Text3D -- SDF text (text, fontSize, color, anchorX, anchorY)
  • PerspectiveCamera -- camera (position, fov, near, far, makeDefault)
  • OrbitControls -- orbit controls (enableDamping, enableZoom, autoRotate)

Shared Schemas

Reusable Zod schemas for custom 3D catalog definitions:

import { vector3Schema, materialSchema, transformProps, shadowProps } from "@json-render/react-three-fiber";
import { z } from "zod";

// Custom 3D component
const myComponentDef = {
  props: z.object({
    ...transformProps,
    ...shadowProps,
    material: materialSchema.nullable(),
    myCustomProp: z.string(),
  }),
  description: "My custom 3D component",
};

Material Schema

materialSchema = z.object({
  color: z.string().nullable(),         // default "#ffffff"
  metalness: z.number().nullable(),     // default 0
  roughness: z.number().nullable(),     // default 1
  emissive: z.string().nullable(),      // default "#000000"
  emissiveIntensity: z.number().nullable(), // default 1
  opacity: z.number().nullable(),       // default 1
  transparent: z.boolean().nullable(),  // default false
  wireframe: z.boolean().nullable(),    // default false
});

Spec Format

3D specs use the standard json-render flat element format:

{
  "root": "scene",
  "elements": {
    "scene": {
      "type": "Group",
      "props": { "position": [0, 0, 0] },
      "children": ["light", "box"]
    },
    "light": {
      "type": "AmbientLight",
      "props": { "intensity": 0.5 },
      "children": []
    },
    "box": {
      "type": "Box",
      "props": {
        "position": [0, 0.5, 0],
        "material": { "color": "#4488ff", "metalness": 0.3, "roughness": 0.7 }
      },
      "children": []
    }
  }
}

Dependencies

Peer dependencies required:

  • @react-three/fiber >= 8.0.0
  • @react-three/drei >= 9.0.0
  • three >= 0.160.0
  • react ^19.0.0
  • zod ^4.0.0

vercel की और Skills

benchmark-sandbox
vercel
Vercel Sandboxes में vercel-plugin eval परिदृश्य चलाएँ, स्थानीय WezTerm पैनलों के बजाय। Claude Code + प्लगइन पूर्व-स्थापित के साथ अस्थायी microVMs प्रदान करता है,…
official
emil-design-eng
vercel
यह कौशल एमिल कोवाल्स्की के UI पॉलिश, कंपोनेंट डिज़ाइन, एनिमेशन निर्णयों और उन अदृश्य विवरणों पर दर्शन को एनकोड करता है जो सॉफ्टवेयर को शानदार महसूस कराते हैं।
official
vercel-react-best-practices
vercel
React और Next.js प्रदर्शन अनुकूलन दिशानिर्देश Vercel Engineering से। इस कौशल का उपयोग React/Next.js कोड लिखने, समीक्षा करने या रीफैक्टर करते समय किया जाना चाहिए…
official
vercel-react-best-practices
vercel
React और Next.js प्रदर्शन अनुकूलन दिशानिर्देश Vercel Engineering से। इस कौशल का उपयोग React/Next.js को लिखने, समीक्षा करने या रीफैक्टर करने के दौरान किया जाना चाहिए…
official
write-guide
vercel
एक तकनीकी गाइड तैयार करें जो प्रगतिशील उदाहरणों के माध्यम से एक वास्तविक दुनिया के उपयोग के मामले को सिखाता है। अवधारणाओं को केवल तब पेश किया जाता है जब पाठक को उनकी आवश्यकता होती है।
official
release
vercel
वर्सेल-प्लगइन जारी करें — गेट्स चलाएं, संस्करण बढ़ाएं, आर्टिफैक्ट्स उत्पन्न करें, कमिट करें और पुश करें। जब "रिलीज़ करें", "शिप करें", "बंप और पुश करें" या "कट अ रिलीज़" कहा जाए तो इसका उपयोग करें।
official
deepsec
vercel
dev3000 से Vercel प्रोजेक्ट चेकआउट पर DeepSec चलाएँ। एक-क्लिक DeepSec सेटअप, प्रोजेक्ट संदर्भ बूटस्ट्रैपिंग, सीमित प्रथम-पास प्रसंस्करण, और… के लिए उपयोग करें।
official
backport-pr
vercel
किसी मर्ज किए गए Next.js पुल रिक्वेस्ट को canary से पिछली रिलीज़ ब्रांच जैसे next-16-2 पर बैकपोर्ट करें। तब उपयोग करें जब उपयोगकर्ता बैकपोर्ट, चेरी-पिक, या खोलने के लिए कहे…
official