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
368 stars 39 forks source link
blender materialx rendering usd

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

Requirements

Currently, this addon works only with Blender 4.0+ in Windows, Mac OS and Linux.

On the releases page are prebuilt versions of the ready to install addon.

Installing Add-on

Download the add-on from the releases page 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

Recommended software

Coding Conventions

Aim is to conform to pep8. 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 Merge has a checkbox 'Enable EditorConfig', for Visual Studio there's EditorConfig extension.

Git

We try to avoid merge commits, the easiest way to do it. This one rejects merges that would result in merge commit:

> git config [--global] merge.ff only

Converts pull to do, essentially, fetch&rebase:

> 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 <branch>:

> git merge <branch> --squash 

ThirdParty libraries

There is ThirdParty repositories included to the project as a submodules. Please update submodules:

All of them are included via SSH protocol. You will need to create and install SSH keys.

Once SSH keys are installed update/checkout submodules for active branch:

> git submodule update --init -f --recursive

Build

Require python 3.10+ to be set by default.

Windows:

Download Blender precompiled libraries.

svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/win64_vc15

Use cmd.exe or any other command prompt.

> 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.

svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_darwin
> 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.

svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_x86_64_glibc_228
> 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:

Arguments are mostly used to skip build unneeded binaries. For example:

> 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 hotkeyCtrl+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 in Release or RelWithDebInfo and add #pragma optimize( "", off ).

PyCharm

import pydevd
pydevd.settrace('localhost', port=52128, stdoutToServer=True, stderrToServer=True, suspend=False)