RenderImage
ipynbFile usdapputils__RenderImage.ipynb
In [2]:
| from pxr import UsdAppUtils,Usd
from PySide2 import QtOpenGL
from PySide2.QtWidgets import QApplication
|
In [3]:
| stage = Usd.Stage.Open("D:/sample/cube.usd")
|
In [4]:
| usdCamera = UsdAppUtils.GetCameraAtPath(stage,"/root/Camera/Camera")
|
In [5]:
| application = QApplication()
glFormat = QtOpenGL.QGLFormat()
glFormat.setSampleBuffers(True)
glFormat.setSamples(4)
glWidget = QtOpenGL.QGLWidget(glFormat)
glWidget.setFixedSize(640,480) # 出力サイズではなく、いい感じにするための値
glWidget.makeCurrent()
|
In [6]:
| frameRecorder = UsdAppUtils.FrameRecorder()
frameRecorder.SetImageWidth(640)
|
In [7]:
| frameRecorder.Record(stage, usdCamera, 0, "./sample.jpg")
|
In [8]:
| from IPython.display import Image
Image("./sample.jpg")
|