728x90
3D 관련해서 Python 라이브러리를 찾던 중 pyVista를 찾았다.
그래서, 예제를 다운 받아서 실행해봤다.
처음 실행시 3D 모델을 읽는다고 그렇지 많이 기다려야 화면이 열린다.
https://docs.pyvista.org/version/stable/examples/00-load/load-gltf.html#load-gltf
Working with glTF Files — PyVista 0.43.0 documentation
Working with glTF Files Import a glTF file directly into a PyVista plotting scene. For more details regarding the glTF format, see: https://www.khronos.org/gltf/ First, download the examples. Note that here we’re using a high dynamic range texture since
docs.pyvista.org
※ 설치
pip install pyVista
※ 소스
"""
.. _load_gltf:
Working with glTF Files
~~~~~~~~~~~~~~~~~~~~~~~
Import a glTF file directly into a PyVista plotting scene. For more
details regarding the glTF format, see:
First, download the examples. Note that here we're using a high
dynamic range texture since glTF files generally contain physically
based rendering and VTK v9 supports high dynamic range textures.
"""
import pyvista
from pyvista import examples
helmet_file = examples.gltf.download_damaged_helmet()
texture = examples.download_dikhololo_night()
###############################################################################
# Set up the plotter and enable environment textures. This works well
# for physically based rendering enabled meshes like the damaged
# helmet example.
pl = pyvista.Plotter()
pl.import_gltf(helmet_file)
pl.set_environment_texture(texture)
pl.camera.zoom(1.7)
pl.show()
###############################################################################
# You can also directly read in gltf files and extract the underlying
# mesh.
block = pyvista.read(helmet_file)
mesh = block[0][0][0]
mesh.plot(color='lightblue', show_edges=True, cpos='xy')
※ 화면
728x90
반응형
'Software > Python' 카테고리의 다른 글
Python 소개 - WSL(Linux)에서 PySide6 사용 (0) | 2023.12.14 |
---|---|
Python 시작하기 - PySide6에서 이미지 읽기 (0) | 2023.12.13 |
Python 시작하기 - PySide6에서 MatPlotLib 사용 (0) | 2023.12.13 |
Python 시작하기 - MatPlotLib (0) | 2023.12.13 |
Python 시작하기 - 실행파일 만들기 PyInstaller (0) | 2023.12.12 |