Observed since 20 Oct, 19:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
3drenderer
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.
| Package / target | Requirement | Relationship |
|---|---|---|
levaEnvironment{
"local_name": "leva",
"alias": false,
"peer_metadata": null
} | ^0.9.0 | runtime |
@react-three/dreiEnvironment{
"local_name": "@react-three/drei",
"alias": false,
"peer_metadata": null
} | ^9.0.0 | runtime |
@react-three/fiberEnvironment{
"local_name": "@react-three/fiber",
"alias": false,
"peer_metadata": null
} | ^8.0.0 | runtime |
reactEnvironment{
"local_name": "react",
"alias": false,
"peer_metadata": null
} | ^18.0.0 | peer |
threeEnvironment{
"local_name": "three",
"alias": false,
"peer_metadata": null
} | ^r128.0.0 | peer |
react-domEnvironment{
"local_name": "react-dom",
"alias": false,
"peer_metadata": null
} | ^18.0.0 | peer |
Source distribution
{
"shasum": "cf3dc0576bb03398a4ea945da527487740978046",
"tarball": "https://registry.npmjs.org/3drenderer/-/3drenderer-1.1.0.tgz",
"fileCount": 4,
"integrity": "sha512-rVd5/95u0sUeTtAsa2M1qEzEO0mu1gWoh+Te3V9R1lU/N6ToyoNewoq4BtuSYjPoi52PmRyRsdIhl81I+J5cUA==",
"signatures": [
{
"sig": "MEUCIQDKzNONybUlEZ1LESOrNSjVExP5GpSA/5zHXv2IdtZFGgIgF2H9OZUcmG22mxp9qTFWJPxMBCgQozmhMnt8CFQlVa8=",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"unpackedSize": 8290
}Observed since 20 Oct, 19:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:4be7a667df92a0efcd1b032ce5d13aa299ba2299e2f7031396714332e75e099f