コード例 #1
0
    def _init_camera(self):
        """
        Intializes the camera for the NVISII renderer
        """

        # intializes the camera
        self.camera = nvisii.entity.create(
            name="camera",
            transform=nvisii.transform.create("camera_transform"),
        )

        self.camera.set_camera(
            nvisii.camera.create_from_fov(name="camera_camera",
                                          field_of_view=1,
                                          aspect=float(self.width) /
                                          float(self.height)))

        # Sets the primary camera of the renderer to the camera entity
        nvisii.set_camera_entity(self.camera)
        self._camera_configuration(at_vec=nvisii.vec3(0, 0, 1.06),
                                   up_vec=nvisii.vec3(0, 0, 1),
                                   eye_vec=nvisii.vec3(1.24, 0.0, 1.35),
                                   quat=nvisii.quat(-1, 0, 0, 0))

        # Environment configuration
        self._dome_light_intensity = 1
        nvisii.set_dome_light_intensity(self._dome_light_intensity)
        nvisii.set_max_bounce_depth(4)
コード例 #2
0
import nvisii
import noise
import random
import numpy as np

opt = lambda: None
opt.spp = 400
opt.width = 1920
opt.height = 1080
opt.noise = False
opt.out = '15_camera_motion_car_blur.png'
opt.control = True

# # # # # # # # # # # # # # # # # # # # # # # # #
nvisii.initialize()
nvisii.set_dome_light_intensity(.8)
nvisii.resize_window(int(opt.width), int(opt.height))
# # # # # # # # # # # # # # # # # # # # # # # # #

# load the textures
dome = nvisii.texture.create_from_file("dome", "content/teatro_massimo_2k.hdr")

# we can add HDR images to act as dome
nvisii.set_dome_light_texture(dome)
nvisii.set_dome_light_rotation(
    nvisii.angleAxis(nvisii.pi() * .5, nvisii.vec3(0, 0, 1)))

car_speed = 0
car_speed_x = car_speed
car_speed_y = -2 * car_speed
コード例 #3
0
    up=random_camera_movement['up'],  # up vector
    eye=random_camera_movement['eye'],
)

visii.set_camera_entity(camera)

# # # # # # # # # # # # # # # # # # # # # # # # #

# lets turn off the ambiant lights
# load a random skybox
skyboxes = glob.glob(f'{opt.skyboxes_folder}/*.hdr')
skybox_random_selection = skyboxes[random.randint(0, len(skyboxes) - 1)]

dome_tex = visii.texture.create_from_file('dome_tex', skybox_random_selection)
visii.set_dome_light_texture(dome_tex)
visii.set_dome_light_intensity(random.uniform(1.1, 2))
# visii.set_dome_light_intensity(1.15)
visii.set_dome_light_rotation(
    # visii.angleAxis(visii.pi()/2,visii.vec3(1,0,0)) \
    # * visii.angleAxis(visii.pi()/2,visii.vec3(0,0,1))\
    visii.angleAxis(random.uniform(-visii.pi(),visii.pi()),visii.vec3(0,0,1))\
    # * visii.angleAxis(visii.pi()/2,visii.vec3(0,1,0))\
    # * visii.angleAxis(random.uniform(-visii.pi()/8,visii.pi()/8),visii.vec3(0,0,1))\
)

# # # # # # # # # # # # # # # # # # # # # # # # #
# Lets set some objects in the scene

mesh_loaded = {}
objects_to_move = []
コード例 #4
0
    at=(0, 0, 0),
    up=(0, 0, 1),
    eye=(10, 0, 4),
)
nvisii.set_camera_entity(camera)

# Setup bullet physics stuff
seconds_per_step = 1.0 / 240.0
frames_per_second = 30.0
physicsClient = p.connect(p.GUI)  # non-graphical version
p.setGravity(0, 0, -10)

# Lets set the scene

# Change the dome light intensity
nvisii.set_dome_light_intensity(1.0)

# atmospheric thickness makes the sky go orange, almost like a sunset
nvisii.set_dome_light_sky(sun_position=(10, 10, 10),
                          atmosphere_thickness=1.0,
                          saturation=1.0)

# Lets add a sun light
sun = nvisii.entity.create(name="sun",
                           mesh=nvisii.mesh.create_sphere("sphere"),
                           transform=nvisii.transform.create("sun"),
                           light=nvisii.light.create("sun"))
sun.get_transform().set_position((10, 10, 10))
sun.get_light().set_temperature(5780)
sun.get_light().set_intensity(1000)