https://github.com/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.
https://github.com/gpuopen-librariesandsdks/blenderusdhydraaddon
blender materialx rendering usd
Last synced: about 2 months ago
JSON representation
This add-on allows you to assemble and compose USD data with Blender data and render it all using various renderers via Hydra.
- Host: GitHub
- URL: https://github.com/gpuopen-librariesandsdks/blenderusdhydraaddon
- Owner: GPUOpen-LibrariesAndSDKs
- License: apache-2.0
- Created: 2020-10-22T15:48:30.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-29T18:50:39.000Z (over 1 year ago)
- Last Synced: 2025-03-29T14:09:54.618Z (2 months ago)
- Topics: blender, materialx, rendering, usd
- Language: Python
- Homepage:
- Size: 836 KB
- Stars: 380
- Watchers: 44
- Forks: 38
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Blender USD Hydra Addon
With Pixar's USD system emerging as a powerful tool for 3D graphics pipelines and interchange. This addon uses AMD Radeon™ ProRender renderer in USD Hydra rendering system in Blender.
## Additional Documentation
- [Pixar USD](https://graphics.pixar.com/usd/docs/index.html)
- [Hydra](https://graphics.pixar.com/usd/docs/USD-Glossary.html#USDGlossary-Hydra)
- [MaterialX](http://www.materialx.org/)## Requirements
Currently, this addon works only with [Blender 4.0+](https://www.blender.org/download/) in Windows, Mac OS and Linux.On the [releases](https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon/releases) page are prebuilt versions of the ready to install addon.
## Installing Add-on
Download the add-on from the releases page [releases](https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon/releases). Open Blender preferences and got to the Add-ons section click Install button and pick the add-on in File Browser. Enable the add-on from the Add-ons section.
## Usage
### Rendering
At a simple level, this functions similar to any render addon to Blender, like Cycles or EEVEE which are included in Blender. Simply select the render engine (in this case "Hydra RPR") and render using the `F12` key or starting a viewport render.## Contributing
### Build Requirements
- Latest Blender precompiled libraries. Clone repository [Blender](https://projects.blender.org/blender/blender) and follow [instructions](https://wiki.blender.org/wiki/Building_Blender#:~:text=for%20Developers.-,Library%20Dependencies,-Details%20on%20obtaining)
- [Python 3.10 x64](https://www.python.org/ftp/python/3.10.11/python-3.10.11.exe) _(Blender 4.0+ uses 3.10)_
- requirements.txt- [Visual Studio 2022 Community](https://visualstudio.microsoft.com/downloads/) _(Windows only)_
- [CMake 3.22.2+](https://cmake.org/download/). Make sure it's added to the PATH environment variable
- Subversion client, such as [TortoiseSVN](https://tortoisesvn.net/downloads.html)
- [Git for Windows](https://gitforwindows.org/)### Recommended software
- [epydoc](http://epydoc.sourceforge.net/) - enable PyCharm to parse Core's documentation. Use `py -m pip install epydoc` with your selected python interpreter or install it from PyCharm.
- [PyCharm Community Edition](https://www.jetbrains.com/pycharm/download/download-thanks.html?platform=windows&code=PCC) - recommended for coding, possible to enable intellisense(limited) for Blender code.
- [Visual Studio 2022 Community](https://visualstudio.microsoft.com/downloads) - has a powerful python extension, possible to enable intellisense for Blender, provides remote debugging in Blender.### Coding Conventions
Aim is to conform to [pep8](https://www.python.org/dev/peps/pep-0008/).
At minimum it's 4 spaces for indentation, sources are utf-8, there's `.gitconfig` in the root of the project - please set you editor to use it (for most simplicity). PyCharm default setting are fine and seems that it also picks up `.editorconfig` automatically also, [Tortoise](https://tortoisegit.org/) Merge has a checkbox 'Enable EditorConfig', for Visual Studio there's [EditorConfig extension](https://visualstudiogallery.msdn.microsoft.com/c8bccfe2-650c-4b42-bc5c-845e21f96328).### Git
We try to avoid merge commits, the easiest way to do it. This one rejects merges that would result in merge commit:
```commandline
> git config [--global] merge.ff only
```
Converts pull to do, essentially, fetch&rebase:
```commandline
> git config [--global] pull.rebase true
```
Also, make more meaningful commits (one commit per feature) the easy way. This will create a single change set from multiple commits coming from ``:
```commandline
> git merge --squash
```### ThirdParty libraries
There is ThirdParty repositories included to the project as a submodules. Please update submodules:
- `deps/MaterialX` https://github.com/AcademySoftwareFoundation/MaterialX
- `deps/RadeonProRenderUSD` https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD
- `deps/USD` https://github.com/PixarAnimationStudios/OpenUSDAll of them are included via SSH protocol. You will need to create and install [SSH keys](https://help.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh).
Once SSH keys are installed update/checkout submodules for active branch:
```commandline
> git submodule update --init -f --recursive
```### Build
Require `python 3.10+` to be set by default.#### Windows:
Download Blender precompiled libraries.
```commandline
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/win64_vc15
```
Use cmd.exe or any other command prompt.
```commandline
> git clone https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon
> cd BlenderUSDHydraAddon
> git submodule update --init --recursive
> python build.py -all
```#### Mac OS:
Download Blender precompiled libraries.
```commandline
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_darwin
```
```commandline
> git clone https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon
> cd BlenderUSDHydraAddon
> git submodule update --init --recursive
> python tools/build.py -all
```#### Linux:
Download Blender precompiled libraries.
```commandline
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_x86_64_glibc_228
```
```commandline
> git clone https://github.com/GPUOpen-LibrariesAndSDKs/BlenderUSDHydraAddon
> cd BlenderUSDHydraAddon
> git submodule update --init --recursive
> python tools/build.py -all
```For building on non-default system python version you should change it with `update-alternatives --config python` command or via setting venv.
#### Build tool
You can build project using `build.py` with different flag combinations. It allows you to create a folder with binaries and pack all the necessary files for development to `/install` folder. Also `build.py` provides a variety of ways to make a project builds:
- `-all` - builds all binaries, equals to `-materialx -usd -hdrpr -addon`
- `-usd` - builds usd binaries
- `-hdrpr` - builds HdRPR plugin binaries
- `-materialx` - builds MaterialX binaries
- `-bin-dir ` - define path to build binaries. _Default_: `bin`
- `-bl-libs-dir ` - define path to Blender precompiled libraries. _Default_: `../lib/`
- `-clean` - removes binaries folder before build, for example: `-all -clean` remove all folders in ``, `-usd -hdrpr -clean` removes only `/Usd` and `/HdRPR`
- `-G ` - set builder, passing with `-all`, `-materialx`, `-usd` and `-hdrpr`. _Example_: `-G "Visual Studio 16 2019"`, `-G "Xcode"`
- `-addon` - generates zip archive with plugin to `./install` folderArguments are mostly used to skip build unneeded binaries. For example:
```commandline
> python build.py -hdrpr -addon
```
### Debugging
#### Visual Studio 2022
Recommended software for debugging, has really nice mixed python and C stack debugging. Provides to you ability of interactive code evaluation. You can make breakpoints move step by step, watch variables and etc.##### 1. Run Blender with the Add-on
Make sure you have no installed addon for Blender version you want to use; remove installed version if needed.##### 2. Attach Visual Studio to process
Press menu Debug -> Attach to Process... or use hotkey`Ctrl+Alt+P`. In opened window choose Blender process, now you connected and allowed to debug.
Also use build-in Python debugger in realtime. Turn on with `Debug -> Windows -> Python Debug Interactive.#### Blender
The easiest way to [build Blender](https://wiki.blender.org/wiki/Building_Blender/Windows) in Release or RelWithDebInfo and add `#pragma optimize( "", off )`.#### PyCharm
```python
import pydevd
pydevd.settrace('localhost', port=52128, stdoutToServer=True, stderrToServer=True, suspend=False)
```