2

I am trying to create a world in Vizard 4.0 that automatically generates 10,000+ objects in it. Once these objects are made, I want to fly through them or make them move at a certain speed in any direction I want.

I have written code for this but It is not giving me the fps I want. Currently I only get about 7fps with this code and I need this to go up to 60fps minimum. I have tried both moving them and moving the camera. But both give the same fps. I have written the part of the moving where the balls just move on their own in one direction and to make the camera move you need to hold down either the left mouse button or the right mouse button or both.

To run this program you first need to install Vizard from worldviz. It comes with a 90-day free trial. I am fairly new to Vizard so any help would be much 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) to smooth edges
viz.setMultiSample(4)

#Start World
viz.go(viz.FULLSCREEN)


#Increase the Field of View
viz.MainWindow.fov(60)

#Set my location 8 meters back from 0,0,0
viz.move([0,0,-8])


def Create_Shape(Number,x_pace,y_pace,z_pace,set_Time) :
    #create an array of shapes
    shapes = []
    #Generate Shapes
    for i in range(Number):
        #Generate random values for position and 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 all shapes and move them
    for shape in shapes:
        shape.addAction(move)
        #return shapes
        return shapes

#Calls create shape with the number of shapes needed to be made and
#the speed and time for the shapes to move at
Create_Shape(10000,0,0,10,10000000)
  • Lowering your multisample would help a ton. – wchargin May 09 '13 at 14:53
  • Please format the code properly. – piokuc May 09 '13 at 14:54
  • Have you tried to see what frame rate you get with just one object -- or maybe 10? – Markku K. May 09 '13 at 14:58
  • If you are looking for that sort of performance, why are you using Pyhton? – kindall May 09 '13 at 15:01
  • Code is formatted better now. When I decrease the number of my objects to 1 or even 1000 I still get well over 60fps, but that is not enough. I am using Python because of the Vizard toolbox. I am creating a virtual reality world in a CAVE to study human perception. I have already written it once in matlab and I did not gotten the results I wanted. Now I am trying to write it in Vizard. – user2366690 May 09 '13 at 15:49

1 Answers1

0

It was ages ago when I worked on Vizard, I remember loading them as instance would perform way better, memory and speed wise, unfortunately i dont remember syntax, but it's somthing like this

shape = vizshape.addSphere(x) // where x is a flag for loading as instance, cant recall it well :)
Ahmad Dwaik 'Warlock'
  • 5,953
  • 5
  • 34
  • 56