irtk.connectors.mitsuba_connector.MitsubaConnector

class irtk.connectors.mitsuba_connector.MitsubaConnector
__init__()
forward_ad(param_func, scene, render_options, sensor_ids=[0], integrator_id=0)

param_func should be a function that takes parameters of a mitsuba scene as the input, and return a variable with gradient tracking enabled. This variable should affect the scene parameters in some ways, or it itself is a scene parameter.

renderC(scene, render_options, sensor_ids=[0], integrator_id=0)

Renders the scene with the given sensor IDs and integrator IDs.

Parameters:
  • scene – The scene to render.

  • render_options – The render options.

  • sensor_ids – The sensor IDs.

  • integrator_id – The integrator ID.

Returns:

A torch.Tensor containing the rendered images with shape (num_sensors, h, w, c).

renderD(image_grads, scene, render_options, sensor_ids=[0], integrator_id=0)

Given the gradients of the rendered images, compute the gradients of the scene parameters.

Parameters:
  • image_grads – The image gradients.

  • scene – The scene passed to renderC.

  • render_options – The render options.

  • sensor_ids – The sensor IDs.

  • integrator_id – The integrator ID.

Returns:

A list of torch.Tensors, where each tensor corresponds to the gradient of a parameter in scene.requiring_grad, in the same order.