Appleseed

From BRL-CAD
Revision as of 13:54, 12 March 2022 by Sean (talk | contribs) (add historic context)

Appleseed Integration Project

This is an effort to bring physically-based rendering (PBR) to solid geometry CAD modeling in BRL-CAD. The goal of the project is to be able to support as many 'rt' features as possible so that 'art' is a drop-in replacement. Collaboration with appleseed began in 2014 after talks at the 10th-year GSoC summit. Appleseed devs created a procedural geometry interface that enabled PBR on BRL-CAD geometry using our ray tracing engine (LIBRT).

This project has been realized through the development efforts of GCI students, GSoC students, and capstone students at Texas A&M University, enabled by development support and mentoring by BRL-CAD and Appleseed development teams.

Progress

The appleseed integration project takes advantage of appleseed's support for procedural objects, which allows for the creation of a custom plugin to execute custom ray-intersect logic. By linking with librt, the plugin is thus able to render BRL-CAD geometry. Aside from simply being able to render the geometry, art.exe currently supports a few select rt features. At the moment, art.exe is capable of:

  • selecting the geometry model and the regions to render
  • defining the render image pixel dimensions
  • setting the azimuth/elevation and perspective angle


As mentioned, the goal of the project is for art.exe to implement the same features as rt.exe, so that, in a sense, they can be used interchangeably. Therefore, if possible, it would be preferred if art could reuse the same helper functions and variables used by rt. For example, much of the command-line option parsing performed by art directly comes from opt.c/usage.cpp, which was originally used by rt. This makes the code much cleaner and easier to maintain.


To-Do

Separating Regions

  • The custom BRL-CAD plugin currently tracks all BRL-CAD regions and their mappings to Appleseed instances via a single "ray trace instance pointer" (rtip). It uses a string comparison to determine if a hit is on a corresponding appleseed instance. While this works, it's incredibly inefficient. It either needs a separate rtip per object (ideal) or it needs to use pointers/integers to determine if we hit the Appleseed instance.

Colors/Materials

  • BRL-CAD objects are rendered by appleseed individually and can have different colors and/or materials assigned to each instance. However, there is no automatic mapping from BRL-CAD shader settings to Appleseed settings. PBR shaders are supported via BRL-CAD 'material' objects (see 'material' command and gltf import). Using more advanced materials (e.g., with textures) is untested.

Multithreading Support

  • Both appleseed and librt are capable of multithreaded rendering, but at the moment, the plugin will only work on a single thread. At some point, multithreading support should be implemented in order to fully take advantage of appleseed/librt capabilities.

Refining CMake

  • Setting up the appleseed project requires a lot of hacky and manual work due to relying on a pre-built binary of Appleseed. The CMake build needs to compile Appleseed and all its dependencies using CMake's External_ProjectAdd feature in order to make the build process easier for all platforms and in order to ensure 'art' is always enabled.