PDA

View Full Version : perspective rendering


wolbers
05-04-2006, 09:29 AM
Hi,
is it possible to automatically scale the size of on-the-fly objects to convey depth impression? I have created a ground plane consisting of points, but Vizard applies the same pointsize to each point, independent of the distance to the observer.

Best,
Thomas

farshizzo
05-04-2006, 10:30 AM
Hi,

If you want the points to be scaled by distance then try using a billboarded quad instead of On-The-Fly objects. Here is some code:quad = viz.add(viz.TEXQUAD)
quad.billboard()
quad.scale(0.2,0.2,0.2) #Need to scale it only once
quad.translate(x,y,z) #Position the quadNow perspective rendering will work correctly on the points

If you plan on using a lot of points then this might not be the most effiecient solution. If this is the case, then there is an alternative solution which requires a plugin. However, try this method first and let me know if it is sufficient.

wolbers
05-04-2006, 11:19 AM
Thanks for your suggestion. Your solution worked fine, however, given that I need 2000-3000 points, the animation was somewhat slowed down. Do you think the plugin could handle that?

farshizzo
05-04-2006, 11:24 AM
Do you think the plugin could handle that?
Not sure, but it will definitely handle better than using 2000 billboarded quads. Are the position of the points static or dynamic. If they are static then you shouldn't need a plugin.

wolbers
05-04-2006, 11:39 AM
They are all dynamic - from frame to frame, some points will be redrawn at random locations, whereas others will be slightly displaced along the z-axis.

farshizzo
05-04-2006, 12:50 PM
Hi,

I've attached a zip file which contains a plugin and sample script on how to use it. The points should have some form of perspective rendering on them.

wolbers
05-04-2006, 03:37 PM
Hi,

thank you so much - the plug-in works fine. I have, however, observed that the speed with which the points change position depends on how far backwards you move the viewpoint. I guess my limited knowledge of Vizard prevents me from understanding this - is there a way to get around it?

farshizzo
05-08-2006, 11:18 AM
Hi,

The example code that changes the position of the points uses the actual elapsed time to calculate the new position, so it shouldn't be framerate dependent. Press the F4 key to display the framerate of you simulation in the upper left corner of the window. It should usually be around 60 fps. When you move further back does the framerate drop?

wolbers
05-10-2006, 11:02 AM
Yes, the closer I move the viewpoint towards the dots, the lower the framerate. Could that have anything to do with my graphics card (ATI FireGL V3200)?