import taichi as ti import numpy as np import tina ti.init(ti.gpu) dens = np.load('assets/smoke.npy')[::1, ::1, ::1] scene = tina.PTScene() scene.engine.skybox = tina.Atomsphere() volume = tina.VolumeScale(tina.SimpleVolume(N=dens.shape[0]), scale=5) scene.add_object(tina.MeshModel('assets/monkey.obj')) g = tina.Param(float, initial=0.76) scene.add_object(volume, tina.HenyeyGreenstein(g=g)) #scene.add_object(tina.MeshTransform(tina.MeshModel('assets/plane.obj'), # tina.translate([0, 0, 4]) @ tina.eularXYZ([ti.pi / 2, 0, 0])), # tina.Emission() * 4) gui = ti.GUI('volume', scene.res) g.make_slider(gui, 'g', -1, 1, 0.01) volume.set_volume_density(dens) scene.update() while gui.running: scene.input(gui) scene.render() #nsteps=32) gui.set_image(scene.img) gui.show()
import taichi as ti import tina ti.init(ti.cpu) scene = tina.Scene(smoothing=True) metallic = tina.Param(float, initial=0.0) specular = tina.Param(float, initial=0.5) roughness = tina.Param(float, initial=0.4) material = tina.PBR(metallic=metallic, roughness=roughness, specular=specular) #shineness = tina.Param(float, initial=32) #specular = tina.Param(float, initial=0.5) #material = tina.Classic(shineness=shineness, specular=specular) model = tina.PrimitiveMesh.sphere() scene.add_object(model, material) gui = ti.GUI('matball') if 'roughness' in globals(): roughness.make_slider(gui, 'roughness') if 'metallic' in globals(): metallic.make_slider(gui, 'metallic') if 'shineness' in globals(): shineness.make_slider(gui, 'shineness', 1, 500, 1) if 'specular' in globals(): specular.make_slider(gui, 'specular') while gui.running: scene.input(gui)
import taichi as ti import tina ti.init(ti.gpu) scene = tina.Scene((640, 480), smoothing=True, ssr=True, taa=True) monkey_material = tina.PBR(metallic=0.0, roughness=0.4) monkey = tina.MeshModel('assets/monkey.obj') scene.add_object(monkey, monkey_material) param_metallic = tina.Param() param_roughness = tina.Param() plane_material = tina.PBR(metallic=param_metallic, roughness=param_roughness) plane = tina.MeshTransform(tina.MeshGrid(32), tina.scale(2) @ tina.eularXYZ([-ti.pi / 2, 0, 0])) scene.add_object(plane, plane_material) gui = ti.GUI(res=scene.res) nsteps = gui.slider('nsteps', 1, 128, 1) nsamples = gui.slider('nsamples', 1, 128, 1) stepsize = gui.slider('stepsize', 0, 32, 0.1) tolerance = gui.slider('tolerance', 0, 64, 0.1) blurring = gui.slider('blurring', 1, 8, 1) metallic = gui.slider('metallic', 0, 1, 0.01) roughness = gui.slider('roughness', 0, 1, 0.01) nsteps.value = 64 nsamples.value = 12 blurring.value = 4 stepsize.value = 2 tolerance.value = 15 metallic.value = 1.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()
import taichi as ti import tina ti.init(ti.cpu) scene = tina.Scene(smoothing=True) metallic = tina.Param(float) roughness = tina.Param(float) material = tina.CookTorrance(metallic=metallic, roughness=roughness) model = tina.MeshModel('assets/sphere.obj') scene.add_object(model, material) gui = ti.GUI('matball') metallic.make_slider(gui, 'metallic') roughness.make_slider(gui, 'roughness') scene.init_control(gui, blendish=True) while gui.running: scene.input(gui) scene.render() gui.set_image(scene.img) gui.show()