コード例 #1
0
    def __init__(self, **kwargs):
        super(StaticScene, self).__init__()
        self.logger = get_logger()

        # we do composition here, not inheritance anymore because it is too
        # limiting in its capabilities. Using a render manager is a better way
        # to handle compositor nodes
        self.renderman = abr_scenes.RenderManager()

        # extract configuration, then build and activate a split config
        self.config = kwargs.get('config', StaticSceneConfiguration())
        # this check that the given configuration is (or inherits from) of the correct type
        if not isinstance(self.config, StaticSceneConfiguration):
            raise RuntimeError(
                f"Invalid configuration of type {type(self.config)} for class {_scene_name}"
            )

        # determine if we are rendering in multiview mode
        self.render_mode = kwargs.get('render_mode', 'default')
        if self.render_mode not in ['default', 'multiview']:
            self.logger.warn(
                f'render mode "{self.render_mode}" not supported. Falling back to "default"'
            )
            self.render_mode = 'default'

        # we might have to post-process the configuration
        self.postprocess_config()

        # setup directory information for each camera
        self.setup_dirinfo()

        # setup the scene, i.e. load it from file
        self.setup_scene()

        # setup the renderer. do this _AFTER_ the file was loaded during
        # setup_scene(), because otherwise the information will be taken from
        # the file, and changes made by setup_renderer ignored
        self.renderman.setup_renderer(self.config.render_setup.integrator,
                                      self.config.render_setup.denoising,
                                      self.config.render_setup.samples,
                                      self.config.render_setup.motion_blur)

        # grab environment textures
        self.setup_environment_textures()

        # setup objects for which the user want to randomize the texture
        self.setup_textured_objects()

        # setup all camera information according to the configuration
        self.setup_cameras()

        # setup global render output configuration
        self.setup_render_output()

        # populate the scene with objects (target and non)
        self.objs = self.setup_objects(
            self.config.scenario_setup.target_objects)

        # finally, setup the compositor
        self.setup_compositor()
コード例 #2
0
    def __init__(self, **kwargs):
        super(WorkstationScenarios, self).__init__()
        self.logger = get_logger()
        add_file_handler(self.logger)

        # we do composition here, not inheritance anymore because it is too
        # limiting in its capabilities. Using a render manager is a better way
        # to handle compositor nodes
        self.renderman = abr_scenes.RenderManager()

        # extract configuration, then build and activate a split config
        self.config = kwargs.get('config', WorkstationScenariosConfiguration())
        if self.config.dataset.scene_type.lower() != 'WorkstationScenarios'.lower():
            raise RuntimeError(
                f"Invalid configuration of scene type {self.config.dataset.scene_type} for class WorkstationScenarios")
        
        # determine if we are rendering in multiview mode
        self.render_mode = kwargs.get('render_mode', 'default')
        if self.render_mode not in ['default', 'multiview']:
            self.logger.warn(f'render mode "{self.render_mode}" not supported. Falling back to "default"')
            self.render_mode = 'default'
        
        # we might have to post-process the configuration
        self.postprocess_config()

        # setup directory information for each camera
        self.setup_dirinfo()

        # setup the scene, i.e. load it from file
        self.setup_scene()

        # setup the renderer. do this _AFTER_ the file was loaded during
        # setup_scene(), because otherwise the information will be taken from
        # the file, and changes made by setup_renderer ignored
        self.renderman.setup_renderer(self.config.render_setup.integrator, self.config.render_setup.denoising,
                                      self.config.render_setup.samples, self.config.render_setup.motion_blur)

        # grab environment textures
        self.setup_environment_textures()

        # setup all camera information according to the configuration
        self.setup_cameras()

        # setup global render output configuration
        self.setup_render_output()

        # populate the scene with objects
        self.objs = self.setup_objects(self.config.scenario_setup.target_objects,
                                       bpy_collection='TargetObjects',
                                       abc_objects=self.config.scenario_setup.abc_objects,
                                       abc_bpy_collection='ABCObjects')
        self.distractors = self.setup_objects(self.config.scenario_setup.distractor_objects,
                                              bpy_collection='DistractorObjects')

        # finally, setup the compositor
        self.setup_compositor()
コード例 #3
0
    def __init__(self, **kwargs):
        super(SimpleObject, self).__init__()
        self.logger = get_logger()

        # we make use of the RenderManager
        self.renderman = abr_scenes.RenderManager()

        # get the configuration, if one was passed in
        self.config = kwargs.get('config', SimpleObjectConfiguration())

        # determine if we are rendering in multiview mode
        self.render_mode = kwargs.get('render_mode', 'default')
        if not self.render_mode == 'default':
            self.logger.warn(
                f'{self.__class__} scene supports only "default" render mode. Falling back to "default"'
            )
            self.render_mode = 'default'

        # we might have to post-process the configuration
        self.postprocess_config()

        # set up directory information that will be used
        self.setup_dirinfo()

        # set up anything that we need for the scene before doing anything else.
        # For instance, removing all default objects
        self.setup_scene()

        # now that we have setup the scene, let's set up the render manager
        self.renderman.setup_renderer(self.config.render_setup.integrator,
                                      self.config.render_setup.denoising,
                                      self.config.render_setup.samples,
                                      self.config.render_setup.motion_blur)

        # setup environment texture information
        self.setup_environment_textures()

        # setup the camera that we wish to use
        self.setup_cameras()

        # setup render / output settings
        self.setup_render_output()

        # setup the object that we want to render
        self.setup_objects()

        # finally, let's setup the compositor
        self.setup_compositor()