Example #1
0
def create_animated_sensors(trajectory: List[Transform],
                            shutter_time: float = 1.,
                            width: int = 1920,
                            height: int = 1440,
                            fov: float = 45.,
                            num_samples: int = 256) -> List[Sensor]:
    """
    Create an animated sensor (Applies motion blur to the rendered image)
    :param trajectory: The trajectory containing all Transforms
    :param shutter_time: The shutter time to be used to set the Mitsuba setShutterOpenTime
    :param width: Width of the generated image
    :param height: Height of the generated image
    :param fov: The sensor field of view
    :param num_samples: Number of samples per pixel (controls the noise in the resulting image)
    :return: A list of Mitsuba animated sensors
    """
    animated_sensors = []
    for transform_idx in range(len(trajectory)):
        atrafo = AnimatedTransform()
        atrafo.appendTransform(0, trajectory[transform_idx])
        atrafo.appendTransform(
            1, trajectory[min(transform_idx + 1,
                              len(trajectory) - 1)])
        atrafo.sortAndSimplify()
        sensor = create_sensor_from_transform(atrafo, width, height, fov,
                                              num_samples)
        sensor.setShutterOpen(0)
        sensor.setShutterOpenTime(shutter_time)
        animated_sensors.append(sensor)

    return animated_sensors
Example #2
0
            def animated_transform(self, motion):
                if len(motion) == 2 and motion[0][1] == motion[1][1]:
                    del motion[1]

                if len(motion) > 1:
                    transform = AnimatedTransform()

                    for (t, m) in motion:
                        transform.appendTransform(t, self.transform_matrix(m))

                else:
                    transform = self.transform_matrix(motion[0][1])

                return transform
Example #3
0
            def animated_transform(self, motion):
                if len(motion) == 2 and motion[0][1] == motion[1][1]:
                    del motion[1]

                if len(motion) > 1:
                    transform = AnimatedTransform()

                    for (t, m) in motion:
                        transform.appendTransform(t, self.transform_matrix(m))

                else:
                    transform = self.transform_matrix(motion[0][1])

                return transform
Example #4
0
            def animated_lookAt(self, motion):
                if len(motion) == 2 and motion[0][1] == motion[1][1]:
                    del motion[1]

                if len(motion) > 1:
                    transform = AnimatedTransform()

                    for (t, (origin, target, up, scale)) in motion:
                        transform.appendTransform(t, self.transform_lookAt(origin, target, up, scale))

                else:
                    (origin, target, up, scale) = motion[0][1]
                    transform = self.transform_lookAt(origin, target, up, scale)

                return transform
Example #5
0
            def animated_lookAt(self, motion):
                if len(motion) == 2 and motion[0][1] == motion[1][1]:
                    del motion[1]

                if len(motion) > 1:
                    transform = AnimatedTransform()

                    for (t, (origin, target, up, scale)) in motion:
                        transform.appendTransform(
                            t, self.transform_lookAt(origin, target, up,
                                                     scale))

                else:
                    (origin, target, up, scale) = motion[0][1]
                    transform = self.transform_lookAt(origin, target, up,
                                                      scale)

                return transform