View Full Version : viz.CULLFACE and viz.clip??

06-17-2004, 01:02 PM
I have created a series of simulations that update the viz.HEAD_POS and/or viz.BODY_ORI in real time using a timer that updates with no delay (i.e. viz.starttimer(timerid)). These simulations depict continuous forward motion through a world with sinusoidal rotations and translations superimposed on top of the translation. I achieve this effect with a kind of "leap frog" technique where segments of the world are repeatedly flipped to new positions along the +z axis using hotspots. Finally, the scene is fairly rich in polygons and texture mapping, and I am implementing fog as well. Thus, not only is there quite a computational load for the CPU to handle, but the graphics card is being pushed, too.

I have noticed that the framerate is cut in half (from 60 Hz to 30 Hz) when fog is enabled versus when fog is disabled. I tried using viz.clip to minimize the number of polygons to be rendered, but the fog is affected by viz.clip.

1) Isn't there a command called "viz.CULLFACE" or something that will prevent unseen or obstructed faces from being rendered along with their texture maps?

2) Any other suggestions?? (e.g., the technique used to create motion simulation, tricks to help rendering)


06-17-2004, 01:26 PM
Hi again,

I've tried saving the framerate during the motion simulations to track the framerate over time and then save that data to a file. I have not been successful in even storing the framerate data in a matrix:

F = viz.framerate()
F = str(viz.framerate())
F = F + [str(viz.framerate())]

I get a bunch of "None"s for framerate.

Is there a way to save the framerate data? Or convert the framerate data into a format that is able to be saved?

06-17-2004, 02:18 PM
I just realized that one could use a rendering plug-in to create the motion simulations I have described above. You could basically have a look-up table for a list of pre-calculated 3D positions and/or orientations.

In the Vizard Help files, there is a bit about "Extending Vizard with your rendering plug-in." It refers to the link "www.worldviz.com/download" to get a template for creating a project in Visual Studio for a rendering plug-in. The Downloads section of the WorldViz website has nothing more than the newest version of Vizard available for download. Could you send me the template?


06-17-2004, 02:31 PM
Hi Jason,

viz.CULL_FACE doesn't prevent hidden surfaces from being drawn. What it does is prevent both sides of a polygon from being drawn. For example, if you are drawing a box and you don't care about seeing the inside of the box, then you can turn on cull face. This usually doesn't give you a significant increase in performance though.

Usually the bottlenecks involve high resolution textures or high polygon models. When your script is running try checking the stats by clicking on the stats button in the GUI (It's the button that says "123"). It will print out how many triangles there are and how much texture memory is being used in the output window.

If the amount of textures being used is close to the amount of texture memory your graphics card can handle then that might be the problem. Also, make sure the width and height of your textures are a power of 2 (2,4,8,16,32,64,....). You can easily see if any of your textures are not powers of 2 by checking the output window. It will display a message like this
"Scaling image '<filename>' from (<width>,<height>) to (<powerof2width>,<powerof2height>)"

The viz.framerate() command doesn't return anything. It just tells vizard to display the framerate.

Let me know if you need any more help.

06-17-2004, 02:38 PM
Hi Jason,

A rendering plugin is usually used to perform custom drawing operations. You could precalculate the 3d positions in python and store them in a list, without using a plug-in. If you are doing some extensive calculations, then you could perform the calculations in C/C++ and then create a python wrapper for them. If you would like to try this then I could send you a template for creating python plugins.

06-17-2004, 02:46 PM
Yes, please do send me the template for the python plug-in. I'll try creating the pre-calculated list of positions and see how it works.


Also, is there any way to save the framerate using viz.framerate()??


06-17-2004, 03:24 PM
Hi Jason,

If all you need to do is precalculate data, then you really don't need a plugin. Just calculate the data within your script and store it in a list. Either way, here's a link to a sample python plugin. You will need Microsoft Visual Studio .NET to open it.


06-17-2004, 03:29 PM
I understand that I can pre-calculate values in the python script itself. I will need this plug-in for use in a future application in which we will drive the visual display with the 3 Dof (roll, pitch, yaw) orientation information from a motion base simulator.

Thanks, Farshid!


06-17-2004, 04:40 PM
Hi Jason,

If you plan on connecting to hardware, then you might consider using a sensor plugin. Take a look at the documentation for more information. Also, look in the plugin forum for examples of how to use it.

06-18-2004, 07:37 AM
Farshizzle, mah nizzle. :cool:

So there's no way to "get" the framerate reading?

06-18-2004, 10:37 AM
Yo, what up dizzle,

No there's no built-in way to get the frame-rate reading. Here's a sample script that manually calculates the framerate:import viz
import time

framerate = []

def mytimer(num):
if len(framerate) > HISTORY_SIZE:
del framerate[0]

rate = len(framerate) / (framerate[-1] - framerate[0])



06-18-2004, 12:24 PM
I feel ya, bro... :p

I used something similar to get at the framerate. I was just curious as to whether there was an easier or more direct way.

'Preciate ya,