Exemplo n.º 1
0
import taichi as ti
import numpy as np
import tina

ti.init(ti.gpu)

scene = tina.PTScene(smoothing=True, texturing=True)

scene.add_object(tina.PrimitiveMesh.sphere(), tina.Glass())
scene.add_object(
    tina.MeshTransform(tina.MeshModel('assets/cube.obj'),
                       tina.translate([0, -3, 0]) @ tina.scale(2)),
    tina.Lambert())

scene.add_object(
    tina.MeshTransform(tina.MeshModel('assets/plane.obj'),
                       tina.translate([0, 4, 0]) @ tina.scale(0.2)),
    tina.Lamp(color=tina.Texture("assets/cloth.jpg")) * 64)

gui = ti.GUI('bdpt', scene.res)

scene.update()
while gui.running:
    if scene.input(gui):
        scene.clear()
    scene.render(nsteps=6)
    scene.render_light(nsteps=6)
    gui.set_image(scene.img)
    gui.show()
Exemplo n.º 2
0
    if args.record:
        ti.core.start_recording('./export/TaichiSLAM.yml')
        ti.init(arch=ti.cc)
    else:
        if args.cuda:
            ti.init(arch=ti.cuda)
        else:
            ti.init(arch=ti.cpu, debug=True)

    gui = ti.GUI('TaichiSLAM', (RES_X, RES_Y))
    level = 1
    scene = tina.Scene(RES_X, RES_Y, bgcolor=(0.1, 0.1, 0.1))
    pars1 = tina.SimpleParticles(maxpars=args.max_disp_particles)
    pars2 = tina.SimpleParticles(maxpars=args.max_disp_particles)
    material1 = tina.Lamp()
    material2 = tina.Lamp()
    scene.add_object(pars1, material1)
    scene.add_object(pars2, material2)
    if args.method == "octo":
        mapping = Octomap(texture_enabled=args.texture_enabled,
                          max_disp_particles=args.max_disp_particles,
                          min_occupy_thres=args.occupy_thres,
                          map_scale=args.map_size,
                          voxel_size=args.voxel_size,
                          K=args.K)
    elif args.method == "esdf":
        mapping = DenseESDF(texture_enabled=args.texture_enabled,
                            max_disp_particles=args.max_disp_particles,
                            min_occupy_thres=args.occupy_thres,
                            map_scale=args.map_size,
Exemplo n.º 3
0
import taichi as ti
import numpy as np
import tina

ti.init(ti.gpu)

scene = tina.PTScene(smoothing=True, texturing=True)
scene.load_gltf('assets/cornell.gltf')
scene.add_object(tina.MeshTransform(tina.MeshModel('assets/plane.obj'),
    tina.translate([0, 3.98, 0]) @ tina.scale(0.1)), tina.Lamp(color=64))

if isinstance(scene, tina.PTScene):
    scene.update()

gui = ti.GUI('cornell_box', scene.res)
scene.init_control(gui, center=(0, 2, 0), radius=5)

while gui.running:
    scene.input(gui)
    if isinstance(scene, tina.PTScene):
        scene.render(nsteps=8)
    else:
        scene.render()
    gui.set_image(scene.img)
    gui.show()

ti.imwrite(scene.img, 'cornell.png')
Exemplo n.º 4
0
import taichi as ti
import numpy as np
import tina

ti.init(ti.gpu)

scene = tina.PTScene(smoothing=True)

roughness = tina.Param(float, initial=0.2)
metallic = tina.Param(float, initial=1.0)
scene.add_object(tina.MeshModel('assets/sphere.obj'),
                 tina.PBR(metallic=metallic, roughness=roughness))

pars = tina.SimpleParticles()
scene.add_object(pars, tina.Lamp(color=32))

gui = ti.GUI('path', scene.res)
roughness.make_slider(gui, 'roughness', 0, 1, 0.01)
metallic.make_slider(gui, 'metallic', 0, 1, 0.01)

pars.set_particles(np.array([
    [0, 0, 5],
]))

scene.update()
while gui.running:
    if scene.input(gui):
        scene.clear()
    scene.render(nsteps=6)
    gui.set_image(scene.img)
    gui.show()
Exemplo n.º 5
0
import taichi as ti
import numpy as np
import tina

ti.init(ti.opengl)

scene = tina.PTScene(smoothing=True)

roughness = tina.Param(float, initial=0.2)
metallic = tina.Param(float, initial=1.0)
scene.add_object(tina.MeshModel('assets/sphere.obj'), tina.PBR(metallic=metallic, roughness=roughness))

scene.add_object(tina.MeshTransform(tina.MeshModel('assets/plane.obj'),
        tina.translate([0, 0, 4]) @ tina.eularXYZ([ti.pi / 2, 0, 0])
        #@ tina.scale(0.1)), tina.Lamp(color=32))
        @ tina.scale(0.4)), tina.Lamp(color=1))

gui = ti.GUI('path', scene.res)
roughness.make_slider(gui, 'roughness', 0, 1, 0.01)
metallic.make_slider(gui, 'metallic', 0, 1, 0.01)

scene.update()
while gui.running:
    if scene.input(gui):
        scene.clear()
    scene.render(nsteps=6)
    gui.set_image(scene.img)
    gui.show()

#ti.imwrite(scene.img, 'output.png')
Exemplo n.º 6
0
#scene.lighting.skybox = tina.Atomsphere()

#material = tina.Phong(color=[0.25, 0.5, 0.5])
#scene.add_object(tina.PrimitiveMesh.sphere(), tina.Glass())
roughness = tina.Param(float, initial=0.332)
metallic = tina.Param(float, initial=0.0)
scene.add_object(tina.MeshModel('assets/sphere.obj'), tina.PBR(metallic=metallic, roughness=roughness))
#scene.add_object(tina.PrimitiveMesh.sphere(), tina.Mirror())
#scene.add_object(tina.MeshModel('assets/bunny.obj'), tina.Glass())
#scene.add_object(tina.MeshModel('assets/monkey.obj'), tina.Mirror())
#scene.add_object(tina.MeshModel('assets/cube.obj'), tina.Classic())
#scene.add_object(tina.MeshTransform(tina.MeshModel('assets/cube.obj'), tina.translate([0, -1.2, 0]) @ tina.scale([2, 0.05, 2])), tina.Lambert())

scene.add_object(tina.MeshTransform(tina.MeshModel('assets/plane.obj'),
        tina.translate([0, 0, 4]) @ tina.eularXYZ([ti.pi / 2, 0, 0])
        @ tina.scale(0.1)), tina.Lamp(color=128))

gui = ti.GUI('path', scene.res)
roughness.make_slider(gui, 'roughness', 0, 1, 0.01)
metallic.make_slider(gui, 'metallic', 0, 1, 0.01)

scene.update()
while gui.running:
    if scene.input(gui):
        scene.clear()
    scene.render(nsteps=6)
    gui.set_image(scene.img)
    gui.show()

#ti.imwrite(scene.img, 'output.png')