Visualize 3D model in Jupyter notebook

Notebook example

How to do

With a 3D model saved as .obj we can show it in a jupyter notebook easily. The demo colab notebook is here.

! pip install obj2html
! wget https://gitlab.com/nicolalandro/obj2html/-/raw/main/test/assets/model.obj
from obj2html import obj2html
from IPython.display import display, HTML
obj2html('model.obj', 'index.html')
display(HTML('index.html'))

Conclusion

This lib is not perfect but do his work. In the future it is possible to add some option for camera position, light and other visualization specs. Also to include the three.js as static file is better than use a CDN.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nicola Landro

Nicola Landro

Linux user and Open Source fun. Deep learning PhD Student, Full stack web developer, Mobile developer, Musitian.