from vtkplotter import Plotter, Plane, datadir vp = Plotter() cow = vp.load(datadir + "cow.byu", c="grey", alpha=0.7) vp += Plane(pos=[0, -3.6, 0], normal=[0, 1, 0], sx=20).texture("grass") vp.show(viewup='y', interactive=0) # vp.light() returns a vtkLight object with focal Point, fp, to mesh cow # fp can also be explicitly set as fp=[x,y,z] l = vp.addLight(pos=[-6, 6, 6], focalPoint=cow, deg=12, showsource=1) # can be switched on/off this way #l.SwitchOff() vp.show(interactive=1)
from vtkplotter import Plotter, Text2D, Arrow, datadir vp = Plotter(axes=1) ambient, diffuse, specular = 0.1, 0., 0. specularPower, specularColor = 20, 'white' for i in range(8): s = vp.load(datadir + 'pumpkin.vtk', c='gold') s.normalize().pos((i % 4) * 2.2, int(i < 4) * 3, 0) #s.phong() s.flat() # modify the default with specific values s.lighting('default', ambient, diffuse, specular, specularPower, specularColor) #ambient += 0.125 diffuse += 0.125 specular += 0.125 vp += Text2D(__doc__) vp.show() print('Adding a light source..') p = (3, 1.5, 3) f = (3, 1.5, 0) vp.addLight(pos=p, focalPoint=f) vp += Arrow(p, f, s=0.01, c='gray', alpha=0.2) vp.show()