-1

I want to display a 3d model into a react JS component, I made some research on how to use Three fiber or web GL but instruction were not clear for me and when I try simplified package like 3D viewer or model viewer from google it simply do not work or not matching the current react version which is 17

Jagarkin
  • 468
  • 1
  • 5
  • 14

1 Answers1

1

Loading models is very simple in react-three-fiber: https://codesandbox.io/s/hungry-easley-lwmpi

For more elaborate cases, when you want to actually alter the model, always use gltfjsx: https://github.com/pmndrs/gltfjsx here's a quick video recap as to how powerful and easy that workflow can be: https://twitter.com/0xca0a/status/1341811710081044483

You don't need model-viewer, which is very limited, and i would suggest you're not using plain threejs in react, that would be counterproductive. you'll write a ton of boiletplate first before you can even think about loading models. When you're finished, you have something that is the opposite of React: Three is imperative, not declarative.

hpalu
  • 1,357
  • 7
  • 12