reveal-3d
cognitedata/builder-skills
Embed interactive Cognite Reveal 3D CAD viewer in Flows apps with local bundled source.
What is reveal-3d?
Integrates a local Cognite Reveal 3D CAD viewer bundle into Flows applications by copying app-local source code. Use this skill when you need to add 3D visualization, CAD model rendering, model browsing, or FDM-linked asset 3D display to a React/TypeScript Flows app.
- Copies bundled Reveal 3D viewer source into app-local feature folder for direct integration
- Renders CAD models from CDF with support for direct model/revision IDs or FDM-linked assets
- Provides RevealProvider, RevealCanvas, and Reveal3DResources components for 3D rendering
- Includes model browser and asset visualization patterns for different use cases
- Handles Three.js singleton, polyfills, and Vite configuration for browser compatibility
How to install reveal-3d
npx skills add https://github.com/cognitedata/builder-skills --skill reveal-3d- React + TypeScript app wrapped in @cognite/dune auth (Flows auth)
- QueryClientProvider from @tanstack/react-query configured in app
- CDF project with 3D models or direct model/revision IDs available
- For FDM-linked 3D: instance linked through Core DM (CogniteVisualizable.object3D → CogniteCADNode)
How to use reveal-3d
- 1.Inspect target app's package.json, vite.config.ts, src/main.tsx, and folder/alias conventions
- 2.Install missing dependencies listed in Dependencies section, reusing existing pinned versions where possible
- 3.Copy all files from skills/reveal-3d/code/reveal/ into app-local folder (typically src/features/reveal-3d/)
- 4.Update imports to use local folder path (e.g., @/features/reveal-3d) instead of external package
- 5.Configure Vite and main.tsx with process polyfill, manual aliases for process/util/assert/three, dedupe settings, and worker.format: 'es'
- 6.Choose implementation pattern: Pattern B for model browser/direct model ID, or FDM pattern if you have confirmed Core DM 3D linkage
- 7.Mount CacheProvider and RevealKeepAlive at page/app level; mount RevealProvider conditionally when model is selected
- 8.Run typecheck and build to verify all imports and dependencies resolve correctly
Use cases
- Display 3D CAD models from CDF in a Flows dashboard with model selection
- Visualize FDM-linked assets as interactive 3D models in an application
- Build a model browser interface allowing users to select and view different CAD revisions
- Embed 3D asset inspection views in equipment or facility management apps
- Add interactive 3D visualization to data-driven Flows applications
- React/TypeScript developers building Flows applications
- Teams managing 3D CAD content in Cognite Data Fusion
- Application developers needing interactive 3D visualization of industrial assets
- Engineers building asset management or facility inspection interfaces
reveal-3d FAQ
Use reveal-3d only for interactive Cognite Reveal 3D/CAD content from CDF. Do not use for static diagrams, graph visualizations, or custom Three.js scenes unrelated to Cognite models.
No. The skill copies the bundled Reveal source directly into your app-local folder. You install runtime dependencies like @cognite/sdk, @tanstack/react-query, and three, but not @cognite/reveal as an external package.
Defer to the app's existing pinned versions. The skill's suggested versions are starting points; compatibility is more important than exact version matching.
Ensure the FDM instance is linked through Core DM (CogniteVisualizable.object3D → CogniteCADNode). Use the FDM-linked implementation pattern documented in references/implementation.md, passing the instance variable name as the skill argument.
RevealCanvas fills its parent container. Without explicit height, the parent collapses and the viewer becomes invisible. Set height on the wrapper div (e.g., style={{ height: '70vh' }}).
Full instructions (SKILL.md)
Source of truth, from cognitedata/builder-skills.
name: reveal-3d description: "Integrates a local Cognite Reveal 3D CAD viewer bundle into Flows apps by copying app-local source code. Use when adding 3D viewer, 3D visualization, Reveal, CAD model, RevealProvider, RevealCanvas, Reveal3DResources, FDM 3D mapping, asset 3D model, model browser, or Cognite 3D content to a Flows application." metadata: argument-hint: "[FDM instance variable name or description, e.g. 'asset' or 'selectedEquipment']"
Reveal 3D Viewer
Add a Cognite Reveal 3D viewer to a Flows app by copying the bundled source into the target app. Renders CAD models from CDF, with support for model browsing, direct model/revision IDs, or FDM-linked assets.
FDM instance to visualize: $ARGUMENTS
Use This When
The user wants to embed an interactive Cognite Reveal viewer for CDF 3D/CAD content in a Flows app.
Do not use this skill for static diagrams, graph visualizations, or unrelated custom Three.js scenes.
Prerequisites
- The app uses React + TypeScript and is wrapped in
@cognite/duneauth (Flows auth). - The app has a
QueryClientProviderfrom@tanstack/react-query. - The CDF project has 3D models, or the user has supplied direct model/revision IDs.
- For FDM-linked 3D, the instance must be linked through Core DM (
CogniteVisualizable.object3D->CogniteCADNode).
Integration Workflow
Follow these steps in order. Adapt paths to the target app's conventions instead of inventing new ones.
-
Inspect the target app. Read
package.json,vite.config.ts,src/main.tsx, and the app's folder/alias conventions. -
Install missing dependencies with the app's package manager. See Dependencies. Reuse existing pinned React, Flows, SDK, and React Query versions.
-
Copy the bundle into the app. Copy every file from
skills/reveal-3d/code/reveal/into an app-local feature folder, typically:src/features/reveal-3d/ -
Import from the local folder, never from the skill directory or the old external package. With a typical
@/*alias:import { CacheProvider, RevealKeepAlive, RevealProvider } from '@/features/reveal-3d'; -
Configure Vite and
main.tsx. Read vite-config.md and apply the process polyfill, manualprocess/util/assertaliases,threealias, dedupe settings, andworker.format: 'es'. -
Choose the implementation pattern. Use Pattern B (model browser or direct model ID) unless you already have a
DMInstanceRefand confirmed Core DM 3D linkage. For full examples, read implementation.md. -
Keep provider placement stable.
CacheProviderandRevealKeepAliveare always mounted at page/app level.RevealProvideris conditional, only when a model is selected or linked. -
Run typecheck and build (
tsc --noEmit,pnpm build, etc.) and fix any copied-import or dependency issues.
Minimal Example
import { useCallback, useMemo } from 'react';
import type { CogniteClient } from '@cognite/sdk';
import {
CacheProvider,
Reveal3DResources,
RevealCanvas,
RevealKeepAlive,
RevealProvider,
type AddCadResourceOptions,
} from '@/features/reveal-3d';
type SelectedModel = { modelId: number; revisionId: number };
function ViewerContent({ modelId, revisionId }: SelectedModel) {
const resources = useMemo<AddCadResourceOptions[]>(
() => [{ modelId, revisionId }],
[modelId, revisionId]
);
const onLoaded = useCallback(() => {}, []);
return (
<RevealCanvas>
<Reveal3DResources resources={resources} onModelsLoaded={onLoaded} />
</RevealCanvas>
);
}
export function ViewerPage({
sdk,
selected,
}: {
sdk: CogniteClient;
selected: SelectedModel | null;
}) {
const memoizedSdk = useMemo(() => sdk, [sdk.project]);
return (
<CacheProvider>
<RevealKeepAlive>
<div style={{ width: '100%', height: '70vh', position: 'relative' }}>
{selected && (
<RevealProvider sdk={memoizedSdk}>
<ViewerContent
modelId={selected.modelId}
revisionId={selected.revisionId}
/>
</RevealProvider>
)}
</div>
</RevealKeepAlive>
</CacheProvider>
);
}
Dependencies
Suggested versions are starting points. If the target app already pins compatible versions, defer to the app.
| Package | Suggested version | Purpose |
|---|---|---|
react / react-dom | app version | UI framework |
@cognite/dune | app version | Authenticated SDK via useDune() |
@cognite/reveal | ^4.30.0 | Reveal viewer runtime |
@cognite/sdk | ^10.0.0 | CDF API client |
@tanstack/react-query | ^5.90.21 | Reveal/FDM data fetching hooks |
three | ^0.180.0 | Three.js singleton used by Reveal |
process, util, assert | latest | Browser polyfills for Reveal dependencies |
ajv | ^8 | Avoids older transitive AJV resolution in monorepos |
@types/three | latest dev dep | TypeScript types |
Example install (pnpm; adapt to the app's package manager):
pnpm add @cognite/reveal @cognite/sdk @tanstack/react-query three process util assert ajv
pnpm add -D @types/three
After install, check @cognite/reveal's three peer requirement and align three if needed.
Do not install vite-plugin-node-polyfills; use the explicit Vite aliases in vite-config.md.
Critical Rules
ViewerContentcontains onlyRevealCanvasandReveal3DResources; no providers.resourcespassed toReveal3DResourcesmust be memoized withuseMemo.onModelsLoaded,onSelect, and similar callbacks must be memoized withuseCallback.- The SDK passed to
RevealProvidermust be memoized withuseMemokeyed onclient.project. RevealCanvasfills its parent; the parent must have an explicit height.- Lazy-load canvas-heavy viewer content with
React.lazy+Suspensewhen adding a route/page.
Advanced Reference
For the copied bundle API and exports, read code/README.md.
For model browser and FDM-linked implementations, read references/implementation.md.
For Vite, worker, polyfill, and troubleshooting details, read references/vite-config.md.
Verification Checklist
- All files from
skills/reveal-3d/code/reveal/were copied into an app-local feature folder. - Imports point to the app-local folder (e.g.
@/features/reveal-3d). - The app does not import Reveal helpers from the old external package.
- Required dependencies are present in
package.json. -
main.tsxstarts with theprocesspolyfill before other imports. -
vite.config.tsuses manual aliases, dedupe,threesingleton alias, andworker.format: 'es'. -
CacheProviderandRevealKeepAliveare always mounted;RevealProvideris conditional when model selection is conditional. - The viewer container has an explicit height.
- Typecheck and build pass.
Related skills
More from cognitedata/builder-skills and the wider catalog.

security
Find and fix security issues in Flows apps before shipping—handles credentials, input validation, XSS, injection, and auth gaps.

setup-flows-auth
Wire a React app for Flows authentication to connect to CDF inside Fusion.

setup-python-tools
Add client-side Python tool execution via Pyodide to Flows apps with automatic hook setup and chat integration.

skill-creator
Create, improve, and evaluate AI agent skills with iterative testing and performance benchmarking.

test-coverage
Find and fix test coverage gaps to meet the 80% line coverage hard gate for Flows apps.

use-topbar
Wire Aura Topbar into Flows/Fusion apps as the compliant single top navigation bar with breadcrumbs, theme switching, and utility strip.