Hi there,
I have set up a Frame Recorder, some basic render settings as well as a render product and tried to render an image using the Frame Recorder, but when I run my script, I get the warnings:
Warning: in _AdapterLookup at line 279 of C:\Users\DinelAnthony\Source\Repos\PixarAnimationStudios\USD\pxr\usdImaging\usdImaging\delegate.cpp – Selected hydra renderer doesn’t support prim type ‘RenderSettings’
Warning: in _AdapterLookup at line 279 of C:\Users\DinelAnthony\Source\Repos\PixarAnimationStudios\USD\pxr\usdImaging\usdImaging\delegate.cpp – Selected hydra renderer doesn’t support prim type ‘RenderProduct’
This is then followed by plenty of “GL error : invalid operation”.
An image is output, however none of my render settings seem to come into effect. This happens no matter which renderer I choose (my system only has GL and Embree).
When building USD 23.08 I had these build flags if that helps
–build-monolithic --tests --docs --python-docs --debug-python --ptex --openvdb --embree --no-prman --openimageio --alembic --hdf5 --no-draco --materialx --opencolorio
and here is the script:
def SetupOpenGLContext(width=100, height=100):
from PySide6.QtOpenGL import QOpenGLFramebufferObject
from PySide6.QtOpenGL import QOpenGLFramebufferObjectFormat
from PySide6.QtCore import QSize
from PySide6.QtGui import QOffscreenSurface
from PySide6.QtGui import QOpenGLContext
from PySide6.QtGui import QSurfaceFormat
from PySide6.QtWidgets import QApplication
application = QApplication(sys.argv)
glFormat = QSurfaceFormat()
glFormat.setSamples(4)
glWidget = QOffscreenSurface()
glWidget.setFormat(glFormat)
glWidget.create()
glWidget._offscreenContext = QOpenGLContext()
glWidget._offscreenContext.setFormat(glFormat)
glWidget._offscreenContext.create()
glWidget._offscreenContext.makeCurrent(glWidget)
glFBOFormat = QOpenGLFramebufferObjectFormat()
glWidget._fbo = QOpenGLFramebufferObject(QSize(1, 1), glFBOFormat)
glWidget._fbo.bind()
return glWidget
# Get the stage and camera
stage = Usd.Stage.Open("RotateCamera.usda")
camera = UsdGeom.Camera(stage.GetPrimAtPath("/Camera"))
render_scope = UsdGeom.Scope.Define(stage, "/Render")
# anim_length = stage.GetEndTimeCode()
anim_length = 1
# Create a renderer prim
# render_prim = stage.DefinePrim("/Render")
horiz_ap = int(camera.GetHorizontalApertureAttr().Get())
vert_ap = int(camera.GetVerticalApertureAttr().Get())
# Camera resolution is the product of the apertures
cam_res = horiz_ap * vert_ap
# Camera aspect ratio is horizontal : vertical or the apertures
cam_asp = horiz_ap / vert_ap
# Define the renderer settings object
render_settings = UsdRender.Settings.Define(stage, "/Render/PrimarySettings")
# Add a bunch of rendering parameters
render_settings.CreateResolutionAttr().Set(Gf.Vec2i([512, 152]))
# Create an OpenGL Context for GPU Rendering
GPU = True
if GPU:
glWidget = SetupOpenGLContext(100, 100)
# Specify renderer and prim path for render settings
renderer = UsdAppUtils.rendererArgs.GetPluginIdFromArgument("GL")
rs_prim_path = stage.SetMetadata("renderSettingsPrimPath",
"/Render/PrimarySettings")
# Define render products
render_prods = UsdRender.Product.Define(stage, "/Render/PrimaryProduct")
# Specify parameters of render settings
render_prods.CreateCameraRel().AddTarget("/Camera")
render_prods.CreateProductTypeAttr().Set("raster")
# Create a product relation to the render product
render_settings.CreateProductsRel().AddTarget("/Render/PrimaryProduct")
stage.Save()
# Create a frame recorder
frame_recorder = UsdAppUtils.FrameRecorder(renderer, GPU)
frame_recorder.SetComplexity(1) # 1 is the lowest
frame_recorder.SetImageWidth(500)
# Render the image
frame_recorder.SetRendererPlugin(renderer)
for frame in range(int(anim_length)):
print(frame_recorder.Record(stage,
camera,
frame,
f".\\Renders\\test{frame}.png"))
If someone could help me figure out this error that would be amazing. Or if this would be better posted as an issue please let me know that as well!