NVIDIAGameWorks / kaolin-wisp

NVIDIA Kaolin Wisp is a PyTorch library powered by NVIDIA Kaolin Core to work with neural fields (including NeRFs, NGLOD, instant-ngp and VQAD).
Other
1.45k stars 133 forks source link

Generic Widgets and @widget decorator #102

Closed orperel closed 1 year ago

orperel commented 1 year ago

This change refactors the widget system to better support user made building blocks:

  1. Uses the interface in the gui system to dynamically paint the attributes of each block
  2. Adds the @widget decorator, so widgets can get automatically created for wisp blocks
  3. Removes quite a few redundant widgets, and makes the who hierarchy less brittle
  4. colors.py module now supports an unused color generator

The previous situation required implementing a specialized imgui widget for every added grid / nef / bottom level renderer which was a hassle. In the new solution, the WispModule is put into use - components can expose public properties which the gui system will automatically paint (read only).

Implementing a widget is also easier now with the @widget decorator which says which wisp building block this widget describes. When wisp's gui system paints the scene graph and encounters some component, it will know which widget to load by using the widget registered with this decorator (defaults are in place).

Supporting "editable" components is beyond the scope of this MR and still requires a specialized widget. That's not too bad though, as pretty much the only components that require "special" implementations are the RayTracedRenderer renderers (NeuralRadianceFieldPackedRenderer,NeuralSDFPackedRenderer`) and for a good reason: they maintain a copy of the tracer within, and the gui allows editing the properties of these tracers.

I've included a default RayTracedRenderer solution as well, so new bottom level renderers would still have a read-only support if they don't specialize anything (for example the SPCRenderer).