Observed since 20 Oct, 19:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A professional 3D model renderer component for React using Three.js. Render GLTF/GLB models with interactive controls, lighting, camera adjustments, and responsive design.
A professional React component for rendering and interacting with 3D GLTF/GLB models using Three.js and React Three Fiber. Features 20+ interactive controls for camera, lights, model transforms, and automatic rotation speeds.
model objectUse npx to add the component to your project:
npx 3drenderer init
This will copy ModelsRenderer.jsx to your current directory.
Options:
npx 3drenderer init -y – Skip confirmation promptsnpx 3drenderer init --output ./src/components – Install to custom pathIf you prefer to install as a dependency:
npm install 3drenderer
You'll also need to install the peer dependencies:
npm install react react-dom three @react-three/fiber @react-three/drei leva
After running npx 3drenderer init, import and use the component:
import ModelRenderer from "./ModelsRenderer";
export default function App() {
const model = {
modelPath: "/models/my-model.glb",
editable: true, // Shows the Leva control panel
};
return <ModelRenderer model={model} />;
}
model (required)An object controlling the component state. Properties:
| Property | Type | Default | Description |
|---|---|---|---|
modelPath | string | — | Required. Path or URL to your GLTF/GLB model file |
editable | boolean | false | Show/hide the Leva control panel |
camX, camY, camZ | number | 0, 0, 25 | Camera position |
fov | number | 75 | Camera field of view (degrees) |
ambientIntensity | number | 0.2 | Ambient light strength |
dirIntensity | number | 0.9 | Directional light strength |
hemiIntensity | number | 0.2 | Hemisphere light strength |
lightX, lightY, lightZ | number | 10, 15, 10 | Directional light position |
posX, posY, posZ | number | 0, 0, 0 | Model position |
rotX, rotY, rotZ | number | 0, 0, 0 | Model rotation (radians) |
scale | number | 1 | Model scale factor |
rotSpeedX, rotSpeedY, rotSpeedZ | number | 0, 0.01, 0 | Automatic rotation speed per axis |
When model.editable is true, the component shows interactive Leva panels:
Control values are synced back to the model object. Save them:
const model = { modelPath: "/model.glb", editable: true };
// ... user adjusts controls ...
// Save state
const savedState = JSON.stringify(model);
localStorage.setItem("modelState", savedState);
// Restore state
const restored = JSON.parse(localStorage.getItem("modelState"));
<ModelRenderer model={restored} />;
const [modelPath, setModelPath] = useState("/models/default.glb");
return (
<>
<select onChange={(e) => setModelPath(e.target.value)}>
<option value="/models/car.glb">Car</option>
<option value="/models/house.glb">House</option>
</select>
<ModelRenderer model={{ modelPath, editable: true }} />
</>
);
model object is synced in a useEffect; avoid creating new objects every render# Initialize component in your project
npx 3drenderer init
# Skip confirmation prompts
npx 3drenderer init -y
# Install to custom directory
npx 3drenderer init --output ./src/components
# Show help
npx 3drenderer --help
MIT – See LICENSE for details
hema hemdan contact@ibrahim-hemdan.com
https://github.com/HEMA-HEMDAN/3drenderer
Found a bug? Have a feature request?
Please open an issue: https://github.com/HEMA-HEMDAN/3drenderer/issue
Download counts and popularity will appear here as the collector receives them.
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:dd5c98dd27438f216ba8f5ef99ce2fff64620457b321b2a5b50bdc7a5b1e2b5f