WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-17-2004, 01:02 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
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
Reply With Quote
  #2  
Old 06-17-2004, 01:26 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
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?
Reply With Quote
  #3  
Old 06-17-2004, 02:18 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
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
Reply With Quote
  #4  
Old 06-17-2004, 02:31 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #5  
Old 06-17-2004, 02:38 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #6  
Old 06-17-2004, 02:46 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
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
Reply With Quote
  #7  
Old 06-17-2004, 03:24 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #8  
Old 06-17-2004, 03:29 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
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
Reply With Quote
  #9  
Old 06-17-2004, 04:40 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #10  
Old 06-18-2004, 07:37 AM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Thumbs up

Farshizzle, mah nizzle.

So there's no way to "get" the framerate reading?
Reply With Quote
  #11  
Old 06-18-2004, 10:37 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #12  
Old 06-18-2004, 12:24 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
I feel ya, bro...

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
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:26 AM.


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