GPUOpen-LibrariesAndSDKs / BlenderUSDHydraAddon

This add-on allows you to assemble and compose USD data with Blender data and render it all using various renderers via Hydra.
Apache License 2.0
363 stars 37 forks source link

UsdImagingLite ? #33

Closed pellerington closed 2 years ago

pellerington commented 3 years ago

Hello,

I am trying to get this running on linux using "../blender-2.91.0-linux64/blender --python cmd_tools/test_plugin.py" It's running into the issue saying it requires UsdImagingLite (I will leave the error log below).

What is UsdImagingLite? It gives up zero results on google and github only gives one result which is this repo.

Is it from an older version of USD or something?

Traceback (most recent call last): File "/BlenderUSDHydraAddon/cmd_tools/test_plugin.py", line 30, in import hdusd File "/BlenderUSDHydraAddon/src/hdusd/init.py", line 39, in from . import engine, properties, ui, usd_nodes, mx_nodes File "/BlenderUSDHydraAddon/src/hdusd/engine/init.py", line 32, in from . import engine, handlers File "/BlenderUSDHydraAddon/src/hdusd/engine/engine.py", line 71, in from . import final_engine, viewport_engine, preview_engine File "/BlenderUSDHydraAddon/src/hdusd/engine/final_engine.py", line 19, in from pxr import UsdImagingGL, UsdImagingLite ImportError: cannot import name 'UsdImagingLite' from 'pxr' (/blender-2.91.0-linux64/2.91/python/lib/python3.7/pxr/init.py)

Thanks, Peter

bnagirniak commented 3 years ago

Sorry, UsdImagingLite is in our closed repo of USD. We have nearest plans to move its code into this repo, so it'll be available there soon.

bnagirniak commented 3 years ago

For your development, you can temporary comment code with UsdImagingLite, it is used only in final_engine.py. Final rendering won't be available for RPR delegate but will work for GL delegate.

pellerington commented 3 years ago

Thanks I was able to launch it. I had to change:

-from pxr import UsdImagingGL, UsdImagingLite +from pxr import UsdImagingGL

in src/hdusd/engine/final_engine.py

and also:

- default='HdRprPlugin', + default='HdStormRendererPlugin',

in src/hdusd/properties/scene.py

Thank you!

bsavery commented 3 years ago

We're going to make it so that we can more easily work on linux. Stay tuned!

pellerington commented 3 years ago

Exciting news, can't wait for the next update. Will happily test anything when it's ready.

Is the current implementation locked to the usd included delegates, or is the intention to allow any custom render delegate in the future?

bsavery commented 3 years ago

You should/could be able to install your own delegate right now. But it would have to be compiled against the USD version in the plugin. We haven't tested this but that's the intention.

pellerington commented 3 years ago

How do I link it, it's currently only giving me the option of GL?

bsavery commented 3 years ago

You'd have to install whichever hydra delegate to libs/plugins. The code that searches for render delegates is here:

https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon/blob/46f3f31ab67b444d10774f06f84fee25774a2c5f/src/hdusd/properties/scene.py#L22

Which delegate are you trying to use?

pellerington commented 3 years ago

It's a custom one (not embree/renderman/arnold or any published delegate).

I see that you are moving usdImagingLite into the repo. Thank you for the quick update!

bnagirniak commented 3 years ago

Yes, and Linux build is coming soon ;)

DeRobertC commented 2 years ago

I came across a similar issue when I was trying to install Renderman as a USD hydra delegate. I'll preface this by saying I'm not a developer. I'm just a 3D artist interested in using this system.

Traceback (most recent call last):
  File "D:\Blender\2.93\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd\__init__.py", line 39, in <module>
    from . import engine, properties, ui, usd_nodes, mx_nodes, bl_nodes
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd\engine\__init__.py", line 39, in <module>
    from . import engine, handlers
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd\engine\engine.py", line 42, in <module>
    from . import final_engine, viewport_engine, preview_engine
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd\engine\final_engine.py", line 19, in <module>
    from pxr import UsdImagingGL, UsdImagingLite
ImportError: cannot import name 'UsdImagingLite' from 'pxr' (C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd\libs\lib\python\pxr\__init__.py)

After reading the documentation here I thought it was going to be something where I just run the build_usd.py script from Pixar USD and enable the options in the advanced build configuration while using the line arguments from here. I had to do a bit of folder renaming since Boost installation was failing but ultimately the traceback above was, what I think, the closest I got to installing the delegate.

After spending an embarrassing amount of time trying to figure this out I am stuck. If someone could lend some guidance on how to correctly add a delegate I would be very grateful.

(I'm using Windows 10, Blender 2.93.1, and the latest release from Aug 19 (v1.0.21-beta b0bf57e) )

Thanks!

bnagirniak commented 2 years ago

Try the following:

  1. Add your options for build_usd.py script from Pixar USD here: https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon/blob/master/tools/build_usd.py#L64
  2. Use our build tool https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon#build-tool to build USD and all other projects required for this plugin.
bnagirniak commented 2 years ago

@KY-Hage in your case from #111 it'll be:

        call_args = (sys.executable, str(usd_dir / "build_scripts/build_usd.py"),
                     '--build', str(bin_usd_dir / "build"),
                     '--src', str(bin_usd_dir / "deps"),
                     '--openvdb',
                     '--prman', '--prman-location", "C:\Program Files\Pixar\RenderManProServer-24.1",
                     str(bin_usd_dir / "install"),
                     *args)
DeRobertC commented 2 years ago

I was able to get the custom build to finish, or at least I think it did. It produced a .zip file in the install folder and I was easily able to install it into blender. It was an issue on my end of doing things incorrectly. My apologies if you had spent time looking at my previous edit. I was able to successfully render and use the add-on just like the pre-built github release. However I did come across some issues.

As a quick note beforehand, I did edit the environment variables both listed in the command prompt window and on the Renderman USD page. As far as I understand they are correct.

Issues:

Minor: -In general Blender would just immediately crash and close. Not really an issue considering I'm still trying to get this set up but I might as well state that. -USD node tree would delete at times during my frequent restarts after Blender crashes. I expected as much consider I kept crashing Blender.

Major:

-Can't Render certain file types. Or rather at times certain file types refuse to work giving the error message as seen below. This would happen at times with any of the 5 file types I tried (PNG, JPEG, TIFF, OpenEXR, OpenEXR Multilayer) This message would appear almost always if I changed the render quality from full to medium. I did this just so I could test a little faster but the same message from before would appear. There was one instance where I tried to restart blender, then even my computer and neither worked to allow for a successful render without the same Osl error. Then I just selected cycles render then back to USD Hydra and I was able to render.

2021-09-29 04:38:04,650 ERROR hdusd.engine [27000]:
        Error in 'pxrInternal_v0_21__pxrReserved__::PlugPlugin::_Load' at line 258 in file S:\GitHub\BlenderUSDHydraAddon\deps\USD\pxr\base\plug\plugin.cpp : 'Failed to load plugin 'rmanOslParser': The specified module could not be found.
 in 'c:/Users/DeRobertC/AppData/Roaming/Blender Foundation/Blender/2.93/scripts/addons/hdusd_Renderman/libs/plugins/usd/rmanOslParser.dll''
        Error in 'pxrInternal_v0_21__pxrReserved__::NdrRegistry::_InstantiateParserPlugins' at line 961 in file S:\GitHub\BlenderUSDHydraAddon\deps\USD\pxr\usd\ndr\registry.cpp : 'Failed verification: ' pluginFactory '' EXCEPTION: Traceback (most recent call last):
  File "C:\Users\DeRobertC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd_Renderman\engine\engine.py", line 85, in render
    self.engine.render(depsgraph)
  File "C:\Users\DeRobertC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd_Renderman\engine\final_engine.py", line 158, in render
    self._render(scene)
  File "C:\Users\DeRobertC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd_Renderman\engine\final_engine.py", line 116, in _render
    renderer.Render(self.stage.GetPseudoRoot(), params)
pxr.Tf.ErrorException:
        Error in 'pxrInternal_v0_21__pxrReserved__::PlugPlugin::_Load' at line 258 in file S:\GitHub\BlenderUSDHydraAddon\deps\USD\pxr\base\plug\plugin.cpp : 'Failed to load plugin 'rmanOslParser': The specified module could not be found.
 in 'c:/Users/DeRobertC/AppData/Roaming/Blender Foundation/Blender/2.93/scripts/addons/hdusd_Renderman/libs/plugins/usd/rmanOslParser.dll''
        Error in 'pxrInternal_v0_21__pxrReserved__::NdrRegistry::_InstantiateParserPlugins' at line 961 in file S:\GitHub\BlenderUSDHydraAddon\deps\USD\pxr\usd\ndr\registry.cpp : 'Failed verification: ' pluginFactory ''

-Every time i use prman to render Blender closes immediately. No matter if it's in view-port or in render. Scene or node-tree. --I am using the free renderman license but as far as I understand there shouldn't be an issue since I believe it still fully installs renderman but your license is the limiting factor. --There was one time when attempting to render it got stuck at Scene: View Layer | Start Syncing but I was unable to repeat this. start sync

-GL Renderer objects never have color. This same thing occurred for me with the pre-built add-on you can download and install off the github release page. In view-port or in a render it will not have color. I am using the RPR shader default with only the diffuse color changed. No other settings enabled or changed. I will see the object if I'm using a HDRI (.hdr) but it is grey instead of having its proper color. It's a completely black render even if I have a light source (sun) in the sceen. This is using both scene or node tree as my data source. gl view gl render

-Can't use an HDRI: .hdr files work while .exr does not. Sometimes just enabling an .hdr in my world node would cause the previous Osl error making it difficult to pinpoint the real issue. I refer to the OpenImageIO plugin below.

2021-09-29 04:14:06,039 ERROR hdusd.engine [21336]:
        Error in 'pxrInternal_v0_21__pxrReserved__::HioGetFormat' at line 86 in file S:\GitHub\BlenderUSDHydraAddon\deps\USD\pxr\imaging\hio\types.cpp : 'Invalid channel count' EXCEPTION: Traceback (most recent call last):
  File "C:\Users\DeRobertC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd_Renderman\engine\engine.py", line 85, in render
    self.engine.render(depsgraph)
  File "C:\Users\DeRobertC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd_Renderman\engine\final_engine.py", line 158, in render
    self._render(scene)
  File "C:\Users\DeRobertC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\hdusd_Renderman\engine\final_engine.py", line 116, in _render
    renderer.Render(self.stage.GetPseudoRoot(), params)
pxr.Tf.ErrorException:
        Error in 'pxrInternal_v0_21__pxrReserved__::HioGetFormat' at line 86 in file S:\GitHub\BlenderUSDHydraAddon\deps\USD\pxr\imaging\hio\types.cpp : 'Invalid channel count'

My initial thought was that it seems to be missing a few options during the build, referring to the USD Advanced Build Configuration guide. My guesses were: -It needs Osl enabled in the cmake build options. There is a note Renderman USD Imaging documentation mentioning OSL parsing plugins. I am unsure what exactly is needed for this build.

-I may need to enable OpenImageIO

-Not sure if OpenColorIO would be needed as well.

-I don't really know how to change the way the build works with cmake but after looking through some of the files I found the options.cmake file in S:\GitHub\BlenderUSDHydraAddon\deps\USD\cmake\defaults which does appear to have options for similar to what's in the USD Documentation. --However I retried building it after having editing the options.cmake but I got the same OSL error. I must not know the correct way to add Osl to the build options.

I'm hoping this will be enough information to get this figured out. I really am interested in this and my lack of python and cmake knowledge wont make this impossible for me. At the very least hopefully my testing and documenting of it can help in the development a bit.

Thanks!

bnagirniak commented 2 years ago

Thank you for your detailed report, we still haven't tried renderman delegate, but it is in our plans. We expect there could be issues with new delegate.

-GL Renderer objects never have color.

This is known issue, it'll be fixed soon.

Overall, we'll walk with your report and such fixes are in our plans.

bnagirniak commented 2 years ago

Discussion moved to #111