WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   viz.CULLFACE and viz.clip?? (https://forum.worldviz.com/showthread.php?t=157)

JRichizzle 06-17-2004 01:02 PM

viz.CULLFACE and viz.clip??
 
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.

Questions:
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)

Thanks,
Jason

JRichizzle 06-17-2004 01:26 PM

viz.framerate()
 
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:

e.g.,
F = viz.framerate()
F = str(viz.framerate())
F = F + [str(viz.framerate())]
etc...

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?

JRichizzle 06-17-2004 02:18 PM

Rendering plug-in
 
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?

Thanks,
Jason

farshizzo 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 '' from (,) to (,)"

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.

farshizzo 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.

JRichizzle 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.

Thanks!

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

-Jason

farshizzo 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.

http://www.worldviz.com/download/fil...hon_plugin.zip

JRichizzle 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!

-Jason

farshizzo 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.

JRichizzle 06-18-2004 07:37 AM

Farshizzle, mah nizzle. :cool:

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

farshizzo 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:
Code:

import viz
import time
viz.go()

HISTORY_SIZE = 30
framerate = []

def mytimer(num):
        framerate.append(time.clock())
        if len(framerate) > HISTORY_SIZE:
                del framerate[0]

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

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.001,viz.FOREVER)

word

JRichizzle 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,
JRich


All times are GMT -7. The time now is 07:14 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC