Read the article Serverless 3D WebGL rendering with ThreeJS.
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
First, you'll need a .glTF (or .GLB) formatted 3D model to render. Here's one you can use.
https://serverless-3d-rendering.vercel.app?model={URL}
Example:
https://serverless-3d-rendering.vercel.app?model=/DamagedHelmet.glb
https://serverless-3d-rendering.vercel.app/api/render?model={URL}
Example:
https://serverless-3d-rendering.vercel.app/api/render?model=https://serverless-3d-rendering.vercel.app/DamagedHelmet.glb
This image below was rendered serverlessly when this page was loaded through the API listed above:
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!