Skip to content

Loading multiple pipelines and trainers #161

@ttsesm

Description

@ttsesm
          @ttsesm 

You can add multiple objects to the scene graph like this:

from wisp.framework import WispState
from wisp.renderer.core.api import add_to_scene_graph

wisp_state = WispState() # Your global shared info here.. Created once per app
nerf_pipeline1 = Pipeline(nef=nef1, tracer=tracer1) # See main_nerf.py for an example of creating a Pipeline..
nerf_pipeline2 = Pipeline(nef=nef2, tracer=tracer2) # See main_nerf.py for an example of creating a Pipeline..

# Optional NeRF args are args that NeuralRadianceFieldPackedRenderer.__init__ takes as input:
# https://github.com/NVIDIAGameWorks/kaolin-wisp/blob/main/wisp/renderer/core/renderers/radiance_pipeline_renderer.py#L26
# batch_size is an optional setup arg here which hints the visualizer how many rays can be processed at once
# e.g. this is the pipeline's batch_size used for inference time
nerf_specific_args = dict(batch_size=2**14)

# Add object to scene graph: if interactive mode is on, this will make sure the visualizer can display it.
add_to_scene_graph(state=wisp_state, name="My NeRF", obj=nerf_pipeline1, **nerf_specific_args)
add_to_scene_graph(state=wisp_state, name="Another NeRF", obj=nerf_pipeline2, **nerf_specific_args)

Each object has its own ObjectTransform so you can control their orientation, dimensions and location around the scene.

Some more explanation about the scene graph and NeuralRadianceFieldPackedRenderer is available in the docs:
https://kaolin-wisp.readthedocs.io/en/latest/pages/renderer.html#the-scenegraph

Keep in mind that the app runs in an infinite loop, add_to_scene_graph is an async request. The object actually gets added to the scene graph when the next frame is drawn.

If you have further questions please open a separate issue, it makes it easier for me to track :)

Originally posted by @orperel in #35 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions