Open JerryKon opened 2 years ago
Filed as internal issue #USD-7296
Hi, I changed the drawMode as the following but it didn't work. The usdRecord still exports the default drawMode image. Any ideas?
pxr\usdImaging\usdAppUtils\frameRecorder.cpp
bool
UsdAppUtilsFrameRecorder::Record()
{
...
UsdImagingGLRenderParams renderParams;
renderParams.frame = timeCode;
...
renderParams.drawMode = UsdImagingGLDrawMode::DRAW_GEOM_FLAT;
...
}
Hi Jerry. The AOV features and draw style aren't accessible from usdrecord or UsdAppUtilsFrameRecorder right now, although they are accessible from UsdImagingGLEngine, which is the rendering class that FrameRecorder uses. Adding AOV output to usdrecord is super interesting; we'd love a PR for this if you get to it before we do. The draw mode is something designed for interactive rendering, so I'm not sure it makes sense as an option for usdrecord.
If you set draw mode and AOVs inside UsdAppUtilsFrameRecorder::Record(), I'd expect that to work. There are a few viewport drawing things (hidden surface wireframe draw mode, the usdview bounding box display, camera guides) that aren't supported outside of usdview, but the rest should work and give you similar results to usdview.
Hope that helps!
Hi tcauchois I was trying to add the AOV feature myself actually. And working on the UsdImagingGLEngine in FrameRecorder. Seems it doesn't work as I thought. I made some changes to the code below.
Changed the aov name for _imageingEngine in FrameRecorder as following. But don't work.
UsdAppUtilsFrameRecorder::Record()
{
_imagingEngine.SetRendererAov(HdAovTokens->depth);
...
HgiTextureHandle handle = _imagingEngine.GetAovTexture(HdAovTokens->depth);
...
}
Seems the UsdImagingGLEngine only works with HdAovTokens->color.
_imagingEngine.GetAovTexture(HdAovTokens->color)
GetAovTexture is a bit misnamed; it returns the GL resources we use for drawing, which are "color" and "depth". Whatever you pass to SetRendererAov is brought in as "color" (since it's what's drawn into the viewport), but it is colorized/it's not raw. So you could try doing SetRendererAov(depth); GetAovTexture(color).
If you want to grab the buffer directly, UsdImagingGL has a member _taskController, which has GetRenderOutput. If you call _taskController.GetRenderOutput(depth), you get an "HdRenderBuffer" object that stores the frame data. This isn't exposed on UsdImagingGL yet but we plan to add it. Hope that helps.
Hi,
I added --aov args to usdrecord and could render aov out,e.g. color,depth. The drawMode works in usdrecord. Some kitchen imges attatched here.
But still with some problems. '--aov primId' would raise exception. Got errors belowing.
0(75) : error C7011: implicit cast from "float" to "int"
Recording aborted due to the following failure at time code EARLIEST:
Error in 'pxrInternal_v0_22__pxrReserved__::HgiGLShaderProgram' at line 52 in file /l/temp/jerry/git_repo/USD/pxr/imaging/hgiGL/shaderProgram.cpp : 'Failed verification: ' id>0 ' -- Invalid shader provided to program'
Error in 'pxrInternal_v0_22__pxrReserved__::HgiGLPostPendingGLErrors' at line 91 in file /l/temp/jerry/git_repo/USD/pxr/imaging/hgiGL/diagnostic.cpp : 'GL error: invalid value, reported from pxrInternal_v0_22__pxrReserved__::HgiGLShaderProgram::HgiGLShaderProgram(const pxrInternal_v0_22__pxrReserved__::HgiShaderProgramDesc&)'
Error in 'pxrInternal_v0_22__pxrReserved__::HdxVisualizeAovTask::_CreateShaderResources' at line 248 in file /l/temp/jerry/git_repo/USD/pxr/imaging/hdx/visualizeAovTask.cpp : 'Failed to create AOV visualization shader VisualizeFragmentId'
Error in 'pxrInternal_v0_22__pxrReserved__::HdxVisualizeAovTask::Execute' at line 616 in file /l/temp/jerry/git_repo/USD/pxr/imaging/hdx/visualizeAovTask.cpp : 'Failed verification: ' _CreateShaderResources( aovTexDesc) ''
Awesome progress! For "primId", you're hitting a shader compile error in the AOV display for that buffer; would you be up for filing a separate issue about that? If possible, try going into usdview and switching to the "primId" AOV and see if you get the same error, since that's easier for us to reproduce.
Hi, got same error in usdview when primId checked.
Pull Requests submitted here. #1854
Description of Requirements
Hi, Any way to export Hydra AOVs images with usdrecord. For exmple,
Thanks a lot.