Skip to content

Commit

Permalink
Merge version 1.3.0 (#321)
Browse files Browse the repository at this point in the history
* Optimize batch rendering (#288)

First of all, track whether we are rendering in batch mode or not and if so then do not resolve framebuffers on each iteration.

As the second optimization, introduce a progressive mode - whether we should update renderStats each sample or should we render at once as many samples as possible, depending on sampling mode: when uniform sampling mode is used, render all samples per one Render call; when adaptive sampling mode is used, render min samples first and then call Render for each sample progressively querying current active pixel count.

As for the naming convention, I followed husk because usdrecord has none of it. I'm going to add renderMode to usdrecord.

Here are some measurements: 12% performance gain (before:01:38.02-after:01:26.06) on basic0 test with adaptive sampling and 7% performance gain (before:04:28.75-after:04:10.65) with uniform sampling.

* Update hdRpr installation scheme (#285)

Previously the only way to use hdRpr in Houdini was to copy hdRpr package directly into Houdini.
From this [post](https://www.sidefx.com/forum/topic/70623/#post-301401) I knew that Houdini (starting from 18.0.370) has functionality that allows us to avoid copying hdRpr libraries directly into Houdini.
Which effectively would save users from reinstalling hdRpr every time he updates Houdini.
All we need to do is to add package ([package docs](https://www.sidefx.com/docs/houdini/ref/plugins.html)) that points to hdRpr plugin.
The only requirement is to have plugInfo.json under HDRPR_PACKAGE/houdini/dso/usd_plugins directory that will describe our USD plugin.
On Linux and macOS hdRpr library will automatically resolve (through runpath) and load linked libraries (like libRadeonProRender). On Windows, unfortunately, users have to add the bin folder to the PATH (it can be done in the same place with HOUDINI_PATH in package file so no need for users to manually add path entry to PATH).

Instead of ad-hoc FindUSD.cmake script, rely on generated (by USD) pxrConfig that specifies and links all required libraries.
Though we still have to keep the same ad-hoc script to find USD that is built in the monolithic mode because USD does not generate valid pxrConfig in this mode.

* Do not require the user to explicitly specify RPR_ENABLE_OPENVDB_SUPPORT, automatically skip openvdb support if the corresponding library cannot be found
* The same for RPR_BUILD_AS_HOUINI_PLUGIN - automatically decide from provided info (pxr_DIR or HFS in the environment) whether we are building Houdini plugin or usdview
* Ship README within the package
* Improve `generatePackage.py` - now it will generate package from scratch (no need to run it from a configured project)
* Fix loading of RPR menu in usdview

* Expose caustics control

* Use rpr::Context's mutex to sync access to RPR API (#290)

The main motivation here is to stick to one mutex everywhere we use rpr::Context.
Previously rpr::Context was not used anywhere except hdRpr so it was not the issue but now we need to sync RPR API access in RprInteropTask

* buildmaster: version update to 1.2.3

* Add render mode render setting (#289)

Add render mode render setting #289

* Fix dome light visibility (#292)

Due to how is environment light creation/deletion implemented in RPR API we must remove default environment light before creating a new one

* Fix hdRpr monolithic USD build (#293)

* Fix hdRpr monolithic USD build

* Remove global include_directories and link_directories

* Do not search for python libraries

Because we are not linking it explicitly

* buildmaster: version update to 1.2.5

* UsdPreviewSurface: use specular workflow on refractive materials (#299)

* Expose shadow and reflection catcher controls (#294)

* Improve AOV system (#295)

* Add support for all AOV supported by RPR core

* Split color AOV

Color AOV might have been tonemapped, denoised, and composed with alpha.
Previously there was no way to get unmodified color output from RPR while using tonemapping/denoising/opacity.

* Replace `HDRPR_DISABLE_ALPHA` env. setting with corresponding render setting to allow runtime changes

* buildmaster: version update to 1.2.6

* Query UV primvar name from bound material (#296)

When mesh has few UV sets or it has non-standard (`st`) UV primvar name we must query the name of the needed UV primvar from bound material

* Add UDIM support (#298)

(northstar only)

* buildmaster: version update to 1.2.7

* Add UsdRenderVar support (#300)

UsdRenderVar API allows the user to control the currently rendered AOV set.
The main difference of UsdRenderVar AOV from good old well-known AOV is that it fully defines HdAovDescriptor, while "default" AOV takes its descriptor from render delegate.

* buildmaster: version update to 1.2.8

* Add northstar support (#297)

* Add northstar support

* Disable opacity AOV when using Northstar

* buildmaster: version update to 1.2.9

* Speed up basis curves creation (#302)

Minimize the number of memory reallocations by precalculating the amount of required memory before converting Hydra data to RPR data.

* buildmaster: version update to 1.2.10

* Fix normal input of AI denoise filter (#305)

Normals should be in [0; 1] range

* Rework material handling (#301)

* Rework material handling

- Implement nodal data-driven material generation from the given HdMaterialNetwork.
- Prepare the ground for MaterialX support:
  * parse node definitions from the given .mtlx files
  * define all RPR native nodes (RPR_MATERIAL_NODE_*) as .mtlx files
- Implement convenient wrapper around arithmetic nodes to simplify its usage: previously we had to keep two distinct code-paths for scalar/vector inputs and texture inputs.
- Houdini: add VOP node for each RPR material node

* Update Houdini packaging

* Fix macOS compilation errors

* macOS fixes

* Fix linux compilation errors

* Add MaterialX dependency as submodule

* Update install instructions

* Allow displacement controled via non-texture input

* Fix color AOV HdFormat

* Handle normal input for UsdPreviewSurface

* Fix image caching in UsdUVTexture node

* Register materials from RprUsdMaterialRegistry in SdrRegistry

USD 20.05 Hydra forbids material nodes with unknown id.

* Resolve review remarks

* Add northstar specific rendering loop (#308)

Account for high dependency of Northstar performance on RPR_CONTEXT_ITERATIONS: higher value gives better performance.

* Allow building hdRpr for Houdini 18.5 (#309)

* Parallelize texture loading  (#307)

Texture processing
Texture loading and creation of rpr::Image is one of the most time-consuming tasks. This process consists of two key steps:

Load image data from a disk
Create rpr::Image from the loaded data
Parallelize what can be parallelized
The obvious idea here is to parallelize what can be parallelized.
rpr::Image creation cannot be parallelized due to the single-threaded nature of RPR API.
So the only thing left is loading from a disk.

Performance measurements before and after parallelization
I'm testing on the NVIDIA's USD Attic scene and the SideFX's Bar scene. The following time values are measured from the delegate creation to the beginning of the first render call (end of SyncAll) - effectively time to the first pixel minus time of the first rprContextRender.

Tahoe	Attic, sec	Bar, sec
Single-threaded	26.620	14.353
Multi-threaded	8.358	9.543
Northstar	Attic, sec	Bar, sec
Single-threaded	26.289	13.117
Multi-threaded	8.558	8.197
As you can see, the Attic scene has a huge improvement in time in the same time the Bar scene not.
More specific measurements should explain why.

Performance measurements of textures processing
Attic - 345 .png textures in total
Single-threaded loading of textures from a disk: 20.452 sec
Multi-threaded loading of textures from a disk: 02.068 sec
Northstar rpr::Image creation (always single-threaded): 03.478 sec
Tahoe rpr::Image creation (always single-threaded): 03.977 sec
Bar scene - 3044 .exr textures in total
Single-threaded loading of textures from a disk: 03.711 sec
Multi-threaded loading of textures from a disk: 02.270 sec
Northstar rpr::Image creation (always single-threaded): 02.072 sec
Tahoe rpr::Image creation (always single-threaded): 07.809 sec
Despite 10 times the difference in the number of textures, .exr wins drastically but it does not parallelize so well as .png loading.
So these numbers answer why we see such a huge boost on the Attic scene when parallelizing texture loading and also they show why numbers on the Bar scene not that remarkable. But these numbers also bring at least two new questions:

Why .png loading is so much slower?
Why .exr loading has much lower parallelization potential?
The actual code that loads images from the disk is inside of USD, or rather inside of Glf module.

PNG loading
PNG loading is done with stb_image library.

To estimate the performance price of GlfImage abstraction and its concrete implementation that uses stb_image I've made a simple test (stbtest.zip) that uses stb_image directly and measured its performance. It showed me that the single-threaded performance of .png image loading through GlfImage abstraction is almost the same as raw stb_image loading. That means that if we want to improve .png images loading speed all we can do is improve decoder implementation.

It's possible to force GlfImage to use OIIO library to load .png images. OIIO library uses libpng for .png loading. This gives such results for the Attic scene:

Single-threaded loading of textures from a disk: 21.916 sec OIIO vs 20.452 sec stb_image
Multi-threaded loading of textures from a disk: 02.688 sec OIIO vs 02.068 sec stb_image
Short googling gave me this note in which the author compares stb_image, lodepng, libpng and libjpeg decoding performance. It says that "libpng is fastest, optimized stb_image takes about 33-40% longer" - this conclusion contradicts with my comparison stb_image vs OIIO (libpng). But the author of this note used libpng directly, probably this can explain such a result?

EXR loading
EXR loading is done with OIIO library (which uses openexr under the hood).

I did not find any public comparisons of the currently available solutions for loading .exr images. So I will have to do it myself. But I think that the current performance of .exr images is out of the question especially when comparing to .png loading performance.

RAT loading
This is a native Houdini image format promoted as the best image format for texture mapping. Previously support for this format was implemented inside of hdRpr under ifdef that was enabled when compiling hdRpr as Houdini plugin. For the sake of image loading cleanliness and unification of Houdini and usdview plugin, I've moved .rat related code to the separate plugin that will be built only when Houdini's library is available.

Conclusion
Regardless performance of the image decoders embedded in USD, parallelization of GlfImage loading gives us tangible results - ~3.2x less time to the first pixel on the Attic scene and ~1.5x speed up for the Bar scene.

* buildmaster: version update to 1.2.11

* Support SideFX-style UDIM tag (#312)

* buildmaster: version update to 1.2.12

* Update to RIF SDK 1.5.4 (#314)

* buildmaster: version update to 1.2.13

* Unlock alpha for northstar (#311)

* Unlock alpha for northstar

* Unlock alpha render setting for northstar

* buildmaster: version update to 1.2.14

* Refactor render qualities handling (+ enable Northstar on macOS) (#318)

* Refactor render qualities handling

* Update northstar's UI name

* Fix depth of field (#319)

Focal length and sensor size should be in millimeters

* buildmaster: version update to 1.2.15

* 1.3.0 Release (#315)

* 1.3.0 Release

* Update changelog

* buildmaster: version update to 1.3.1

* Hotfix 1.3.0 Release (#320)

* buildmaster: version update to 1.3.2
  • Loading branch information
bsavery authored Aug 19, 2020
1 parent 1ae5806 commit fa8cbb0
Show file tree
Hide file tree
Showing 164 changed files with 8,923 additions and 3,579 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "deps/RPR"]
path = deps/RPR
url = https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderSDK
[submodule "deps/MaterialX"]
path = deps/MaterialX
url = https://github.com/materialx/MaterialX
28 changes: 28 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
# Change Log

## 1.3 Release

hdRpr installation scheme was changed - there is no more need to copy hdRpr package directly into Houdini. More info [here](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/285).

### New features
* Parallelize texture loading ([PR #307](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/307))
* Expose RPR-native materials ([PR #301](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/301))
* Add RPR 2.0 (Northstar) support ([PR #297](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/297))
* Add UsdRenderVar support (raw AOVs only) ([PR #300](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/300))
* Add UDIM support (Northstar only) ([PR #298](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/298))
* Improve AOV system ([PR #295](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/295))
* Expose shadow and reflection catcher controls ([PR #294](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/294))
* Expose caustics control ([PR #291](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/291))
* Add render mode render setting ([PR #289](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/289))
* Optimize batch rendering ([PR #288](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/288))
* BasisCurves bezier support ([PR #282](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/282))
* Speed up basis curves creation ([PR #302](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/302))
* Add RIF-based tone mapping filter ([PR #283](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/283))

### Fixes
* Fixed depth of field ([PR #319](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/319))
* Fixed normal input of AI denoise filter ([PR #305](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/305))
* Fixed dome light visibility ([PR #292](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/292))
* Now UV primvar name is queried from the bound material ([PR #296](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/296))
* Use specular workflow on refractive materials for UsdPreviewSurface ([PR #299](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/299))


## 1.2 Release
### New features
- Volume rework ([PR #268](https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderUSD/pull/268))
Expand Down
35 changes: 21 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/defaults
${CMAKE_SOURCE_DIR}/cmake/macros)

include(Options)

if(RPR_BUILD_AS_HOUDINI_PLUGIN)
include(Houdini)
endif(RPR_BUILD_AS_HOUDINI_PLUGIN)

include(ProjectDefaults)
include(Packages)

Expand All @@ -34,12 +29,24 @@ include(Public)

set(CMAKE_CXX_STANDARD 14)

include_directories(${USD_INCLUDE_DIR})
link_directories(${USD_LIBRARY_DIR})
include_directories(${RPR_INCLUDE_DIR})
link_directories(${RPR_LIBRARY_DIR})

add_subdirectory(pxr/imaging/plugin/hdRpr)

# install(FILES README.md DESTINATION .)
# install(FILES LICENSE.md DESTINATION .)
if(NOT MaterialX_FOUND)
# If MaterialX was not explicitly provided, use the one from a submodule
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
if(HoudiniUSD_FOUND AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Houdini builds with the old ABI. We need to match.
set(EXTERNAL_COMPILE_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0")
endif()
set(MATERIALX_PYTHON_LTO OFF)
set(MATERIALX_INSTALL_PYTHON OFF)
set(MATERIALX_BUILD_RENDER OFF)
set(MATERIALX_BUILD_GEN_GLSL OFF)
set(MATERIALX_BUILD_GEN_OSL OFF)
set(MATERIALX_BUILD_TESTS OFF)
add_subdirectory(deps/MaterialX)
endif()

add_subdirectory(pxr/imaging)

install(FILES README.md DESTINATION .)
install(FILES INSTALL.md DESTINATION .)
install(FILES LICENSE.md DESTINATION .)
61 changes: 42 additions & 19 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,60 @@
## Installation from a package

### Automatic installation
### Houdini plugin

Installed [**Python**](https://www.python.org/downloads/) with PATH environment variable setup is required for automatic installation.
#### Manual

> If you do not want to install python, but you have already installed Houdini with a working license, you can use hython from the Houdini package. Follow instructions under [Others](#others) subsection.
Add a new Houdini package with such configuration json:
```
{
"env":[
{
"RPR":"path-to-the-package"
},
{
"HOUDINI_PATH":"$RPR/houdini"
},
{
"PATH":"$RPR/lib"
}
]
}
```
where `path-to-the-package` depends on where do you unzip hdRpr package and should point to the directory that contains INSTALL.md (this file)

#### Windows
More info here https://www.sidefx.com/docs/houdini/ref/plugins.html

Run **install.bat**
#### Automatic

#### Others
`activateHoudiniPlugin.py` script can do the same for you automatically - it will try to find your houdini preference dir and add hdRpr package that will point to the current directory.

Use the installer script **install.py**. From a terminal run:
```
python install.py
```
And follow the instructions from the script
### Usdview plugin

* Add `HDRPR_PACKAGE_DIR/plugin` path entry to the `PXR_PLUGINPATH_NAME` environment variable
* Add `HDRPR_PACKAGE_DIR/lib/python` path entry to the `PYTHONPATH` environment variable
* Windows only: add the `HDRPR_PACKAGE_DIR/lib` path entry to the `PATH` environment variable

### Manual
OR

Copy content of hdRpr*.tar.gz to houdini installation directory.
Default destination path looks like:
* **Windows** `C:\Program Files\Side Effects Software\Houdini 18.0.287`
* **Ubuntu** `/opt/hfs18.0`
* **macOS** `/Applications/Houdini/Current/Frameworks/Houdini.framework/Versions/Current`
You can copy hdRpr package directories (lib and plugin) directly to the root of your USD package.

## Installation from sources

Run following command in configured cmake project:
1. Configure cmake project (more info about it in README.md)

```
cd RadeonProRenderUSD
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=package ..
```
cmake --build . --config Release --target INSTALL

2. Build cmake project
```
cmake --build . --config Release --target install
```

3. Follow instructions from "Installation from package" for either "Houdini plugin" or "Usdview plugin" depending on how you configured the project on step 1.

## Feedback

Expand Down
40 changes: 11 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,22 @@ Cloning into 'RadeonProRenderUSD'...

##### Required Components

##### UsdView plugin Components
##### USD Component

As many USD users get the USD libraries from different places, or compile their own, we tried to keep this as flexible as possible. You can download USD to build yourself from [GitHub](https://www.github.com/PixarAnimationStudios/USD). UsdView plugin is build by default (```RPR_BUILD_AS_HOUDINI_PLUGIN=FALSE```).
Provide USD in one of two ways:

| Dependency Name | Description | Version |
| ------------------ |----------------------------------------------------------------------- | ------- |
| USD_ROOT | USD directory with include and lib dirs | 20.02 |

##### Houdini plugin Components
* An installation of USD. Define pxr_DIR to point to it when running cmake, if required. You can download USD to build yourself from [GitHub](https://www.github.com/PixarAnimationStudios/USD).
* The USD which is provided with Houdini. The HFS environment variable should point to the Houdini installation (the correct way is to run cmake from Houdini's `Command Line Tools` or by sourcing `houdini_setup`). You can download Houdini installer from [Downloads | SideFX](https://www.sidefx.com/download).

To build houdini plugin set cmake flag ```RPR_BUILD_AS_HOUDINI_PLUGIN=TRUE```. `HOUDINI_ROOT` is the directory containing the `houdini_setup` file. You can download Houdini installer from [Daily Builds | SideFX](https://www.sidefx.com/download/daily-builds/#category-gold).
##### MaterialX Component

| Dependency Name | Description | Version |
| ------------------ |----------------------------------------------------------------------- | ------- |
| HOUDINI_ROOT | Houdini toolkit directory | 18 |
By default, MaterialX library will be compiled from the sources located under a MaterialX submodule `deps/MaterialX`.
You can override this behavior by providing a complete build of MaterialX to cmake. Please note, on Linux for Houdini plugin, MaterialX should be compiled with `-D_GLIBCXX_USE_CXX11_ABI=0` definition as it is required by Houdini.

##### Optional Components

##### OpenVDB

Support for OpenVDB is disabled by default, and can optionally be enabled by
specifying the cmake flag ```RPR_ENABLE_OPENVDB_SUPPORT=TRUE```.

**Following dependency required only for usdview plugin, houdini is shipped with own build of openvdb**

| Dependency Name | Description | Version |
Expand All @@ -83,9 +76,8 @@ then you need to specify ```RPR_SDK_PLATFORM=centos6``` cmake flag
```
mkdir build
cd build
cmake -DUSD_ROOT=/data/usd_build -DCMAKE_INSTALL_PREFIX=/data/usd_build ..
make
make install
cmake -Dpxr_DIR=/data/usd_build -DCMAKE_INSTALL_PREFIX=/data/usd_build ..
cmake --build . --config Release --target install
```

Supported Platforms
Expand All @@ -97,21 +89,11 @@ Supported Platforms
Try it out
-----------------------------

Set the environment variables specified by the script when it finishes and
launch ```usdview``` with a sample asset.

```
> usdview extras/usd/tutorials/convertingLayerFormats/Sphere.usda
```

And select RPR as the render delegate.
Follow instruction from INSTALL.md to activate the plugin.
Launch either usdview or Houdini's Solaris viewport and select RPR as the render delegate.

#### Environment Variables

* `PXR_PLUGINPATH_NAME`

If you want the RPR menu added to USDView (allows selecting device, and render quality). Set it to ``` PXR_PLUGINPATH_NAME=${USD_ROOT}/lib/python/rpr ```, where USD_ROOT is your USD install directory.

* `HDRPR_ENABLE_TRACING`

Instruct Radeon ProRender to generate trace files for debugging purposes. The tracing will record all RPR commands with a memory dump of the data used. By default, RPR tracing is disabled. To enable it set `HDRPR_ENABLE_TRACING` to 1.
Expand Down
40 changes: 0 additions & 40 deletions cmake/defaults/Houdini.cmake

This file was deleted.

3 changes: 0 additions & 3 deletions cmake/defaults/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ option(PXR_ENABLE_NAMESPACES "Enable C++ namespaces." ON)

option(PXR_SYMLINK_HEADER_FILES "Symlink the header files from, ie, pxr/base/lib/tf to CMAKE_DIR/pxr/base/tf, instead of copying; ensures that you may edit the header file in either location, and improves experience in IDEs which find normally the \"copied\" header, ie, CLion; has no effect on windows" OFF)

option(RPR_BUILD_AS_HOUDINI_PLUGIN "Build RadeonProRender Houdini plugin" OFF)
option(RPR_ENABLE_OPENVDB_SUPPORT "Enable OpenVDB" ${RPR_BUILD_AS_HOUDINI_PLUGIN})

# Precompiled headers are a win on Windows, not on gcc.
set(pxr_enable_pch "OFF")
if(MSVC)
Expand Down
Loading

0 comments on commit fa8cbb0

Please sign in to comment.