def addStreetlights(scene=viz.MainScene): global timeToMove, streetLight, origPOS, endPOS timeToMove = 1.2 origPOS = [ [8, 2.5, 5] , [8,2.5,-5] ] endPOS = [ [-11,2.5,5] , [-11,2.5,-5] ] streetLight = vizfx.addPointLight() streetLight.intensity(.4) streetLight.color(viz.WHITE) moveStreetlight() vizact.ontimer(timeToMove+1, moveStreetlight)
viz.clip(.1,100000) ocean = vizfx.addChild(ART_DIRECTORY + './art/environment/OceanFloor.osgb') # Change properties to enable the god ray. water = ocean.getChild('Water') water.disable(viz.DEPTH_WRITE) water.drawOrder(101) # Create and apply global fog effect. # fog = vizfx.addFogEffect( colorRamp=viz.addTexture(ART_DIRECTORY + './art/texture/FogRamp.tif'), height=1, density=(.09)) fog = vizfx.addFogEffect( colorRamp=viz.addTexture(globals_oa.MODEL_DIRECTORY + 'FogRamp.tif'), height=1, density=(.09)) vizfx.getComposer().addEffect(fog) bgcolor = [0.15*1.2, 0.67*1.2, 0.95*1.2] viz.clearcolor(bgcolor) # Enable fog on main scene. # viz.MainScene.enable(viz.FOG, op=viz.OP_ROOT) # Add sun light. lightSun = vizfx.addPointLight() lightSun.constantAttenuation(0) lightSun.linearAttenuation(0) lightSun.quadraticAttenuation(.3) lightSun.setPosition([0.123,0.84911,-1.929]) lightSun.color( viz.WHITE ) lightSun.specular( viz.WHITE ) lightSun.ambient( viz.BLACK )
import viz import vizfx #viz.setMultiSample(8) #viz.fov(60) viz.go() # Add a yellow spot light # Add white point light light = vizfx.addPointLight(color=viz.WHITE, pos=(0,2,0)) env = vizfx.addChild('Room_improved.osgb') code = """ Effect { Shader { BEGIN Material m.diffuse = vizfx_VertexColor.rgb; END } } """ effect = viz.addEffect(code) # Model will inherit MyColor property value from effect #env.apply(effect)
ori[1], ori[0], ori[2])) self.trackers[t]['values'][0].message(VAL_FMT.format('X', pos[0], ori[1])) self.trackers[t]['values'][1].message(VAL_FMT.format('Y', pos[1], ori[0])) self.trackers[t]['values'][2].message(VAL_FMT.format('Z', pos[2], ori[2])) for n in self.nodes.keys(): pos = self.nodes[n]['model'].getPosition(viz.ABS_GLOBAL) ori = self.nodes[n]['model'].getEuler(viz.ABS_GLOBAL) self.nodes[n]['ui'].message(FMT.format(pos[0], pos[1], pos[2], ori[1], ori[0], ori[2])) if __name__ == '__main__': """ If module is called directly, just display the debug view """ viz.setMultiSample(4) viz.go() hmd = steamvr.HMD() navigationNode = viz.addGroup() viewLink = viz.link(navigationNode, viz.MainView) viewLink.preMultLinkable(hmd.getSensor()) vizshape.addPlane(size=(100,100), color=(0.4, 0.4, 0.4)) headlight = viz.MainView.getHeadLight() headlight.disable() main_light = vizfx.addDirectionalLight(euler=(0,90,0), color=viz.WHITE) origin_light = vizfx.addPointLight(color=viz.WHITE, pos=(0,0,0)) debugger = SteamVRDebugOverlay(enable=True)
import viz import vizact import viztask import vizfx viz.setMultiSample(4) viz.fov(60) viz.go() #Add a room with baked colors #seams are an issue. I used the tips they described in the encyclopedia, but so far #have not been able to remove them test = viz.addChild('simpleRoomExportBaked.osgb') #move the viewpoint to back of room viz.MainView.setPosition([7, 1, 0]) viz.MainView.setEuler([-90, 0, 0]) #test viz light in program light = vizfx.addPointLight(color=viz.YELLOW, pos=(0,2,0)) #animated object to test viz light pigeon = viz.add('pigeon.cfg') pigeon.setScale([2] * 3) pigeon.setPosition([-2,0,-2]) pigeon.setEuler([180, 0, 0]) pigeon.state(3) #move the viewpoint to back of room viz.MainView.setPosition([7, 1, 0]) viz.MainView.setEuler([-90, 0, 0])
import tools # We're going to add a grabber with highlighting, so we have to update stencil # settings before calling viz.go if __name__ == "__main__": viz.setOption('viz.display.stencil', 8) # Add the local events (events specific to this demo) vizconnect.go('vizconnect_config_local_events.py') # get the quality setting of the demo if specified DEMO_QUALITY_SETTING = max( 0, viz.getOption('DEMO_QUALITY_SETTING', default=4, type=int)) vizfx.addPointLight(pos=(0, 5, 1, 0), euler=(0, 90, 0)) # Load the vizconnect configuration. if __name__ == "__main__": vizconnect.go('./vizconnect_config.py') viz.setMultiSample(DEMO_QUALITY_SETTING * 2) # disable the head lamps since we're doing lighting ourselves for window in viz.getWindowList(): window.getView().getHeadLight().disable() else: vizconnect.go('./multiscript_vizconnect_config.py') # Add a viewpoint so the user starts at [0, 0, 0]. vp = vizconnect.addViewpoint(pos=[0, 0, 0]) scenario = [