How to draw 10,000+ objects and move them and get 60fps+ in Vizard Python -
i trying create world in vizard 4.0 automatically generates 10,000+ objects in it. once these objects made, want fly through them or make them move @ speed in direction want.
i have written code not giving me fps want. 7fps code , need go 60fps minimum. have tried both moving them , moving camera. both give same fps. have written part of moving balls move on own in 1 direction , make camera move need hold down either left mouse button or right mouse button or both.
to run program first need install vizard worldviz. comes 90-day free trial. new vizard appreciated. thank you
code below:
enter code here import viz import vizact import vizshape import random import vizinfo import viztask #enable full screen anti-aliasing (fsaa) smooth edges viz.setmultisample(4) #start world viz.go(viz.fullscreen) #increase field of view viz.mainwindow.fov(60) #set location 8 meters 0,0,0 viz.move([0,0,-8]) def create_shape(number,x_pace,y_pace,z_pace,set_time) : #create array of shapes shapes = [] #generate shapes in range(number): #generate random values position , orientation x = random.randint(-100,100) y = random.randint(-100,100) z = random.randint(-100,100) #generate shapes shape = vizshape.addsphere() #shape.setscale(0.25,0.25,0.25) shape.setposition([x,y,z]) shapes.append(shape) #move shapes move = vizact.move(x_pace,y_pace,z_pace,set_time) #loop through shapes , move them shape in shapes: shape.addaction(move) #return shapes return shapes #calls create shape number of shapes needed made , #the speed , time shapes move @ create_shape(10000,0,0,10,10000000)
it ages ago when worked on vizard, remember loading them instance perform way better, memory , speed wise, unfortunately dont remember syntax, it's somthing this
shape = vizshape.addsphere(x) // x flag loading instance, cant recall :)
Comments
Post a Comment