WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-12-2005, 05:30 AM
Stefan Stefan is offline
Member
 
Join Date: May 2005
Posts: 5
Loading .3ds-Files without interrupting Program flow

Hello everybody !

I am currently programing with Vizard 2.51. I want to load a number of 3ds-Files at runtime, without interrupting the program. I tried to use a seperate Thread for loading the files, but the program still stops when loading. (I created a new thread in Python and also tried to use a director function, it didnīt work out as I hoped)

Could anybody give me a hint ?

Thank you,
Stefan
Reply With Quote
  #2  
Old 05-12-2005, 11:11 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The current version of Vizard blocks execution on file loads. The next version should fix this. If you need this functionality sooner let me know and I will create a plugin that implements it.
Reply With Quote
  #3  
Old 05-13-2005, 06:19 AM
Stefan Stefan is offline
Member
 
Join Date: May 2005
Posts: 5
Plugin for loading 3ds-files

Hi farshizzo !
Thank you for your quick answer. How long will it take for the new version to be released ? I would be glad if I could get this functionality soon, so if you could create a plugin, that would be great. Have a nice day and thanks in advance,

Stefan
Reply With Quote
  #4  
Old 05-13-2005, 10:08 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I'm not sure when the next release is going to be, so I'll just go ahead and build a plugin for you. I should have one ready by today.
Reply With Quote
  #5  
Old 05-13-2005, 02:17 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I've attached a zip file to this post which contains the plugin delayload.dlc and a sample script testDelayLoad.py showing how to use it. Let me know if you have any problems with it.
Attached Files
File Type: zip delayload.zip (5.1 KB, 1323 views)
Reply With Quote
  #6  
Old 06-01-2005, 07:21 AM
Stefan Stefan is offline
Member
 
Join Date: May 2005
Posts: 5
PlugIn and loading 3ds-files multiple times

Hi farshizzo !

I tried your plug-in and it works quite fine. Although I still have a problem with the blocking-version of the add-command. I will try it again later. But I have another question concerning the loading of 3ds-files. I use code that looks similar to this one:

tile = viz.add('myTile')
child = tile.getChild('childOfMyTile')
child.parent(tile)

Because I shuffle around large amounts of data, I might be forced to remove the object ( -> tile.remove() ) and load it again later, using the code above. When I load the object again, the function getChild produces an error (child not found).

Do you have an idea what might cause the error ?

Thanks,
Stefan
Reply With Quote
  #7  
Old 06-01-2005, 10:54 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi Stefan,

I tried your sample code on a model here and it worked fine. This is the code I used to test it:
Code:
import viz
viz.go()

viz.move(0,0,-10)

def onkeydown(key):
	global tile,child
	if key == ' ':
		tile = viz.add('testviz/reflect_logo.3ds')
		child = tile.getchild('Sphere01')
		child.parent(tile)
	elif key == 'r':
		tile.remove()

viz.callback(viz.KEYDOWN_EVENT,onkeydown)
Let me know if I am doing anything different.

Also, why are you reparenting the child after you get it? When you get a child from a model Vizard retains its hierarchical structure.
Reply With Quote
  #8  
Old 06-02-2005, 05:57 AM
Stefan Stefan is offline
Member
 
Join Date: May 2005
Posts: 5
Loading and reparenting

Hi farshizzo !

You are doing exactly the same thing as I do. Thatīs quite funny. Your code works, mine not. Perhaps this might be related to the amount of objects I am loading ? Sometimes I load more than 1000 objects. I experienced other problems with Vizard 2.17, like objects disapearing or objects being at the wrong position and so on. Those things (mostly) happened when I loaded more than a specific number of objects.

Reparenting:
I do this because of the alignment of the object to the coordinate system. When the object is initally loaded, the object points upwards instead of forward (because y and z are exchanged in the local coordinate system). After the reparenting, the object is aligned correctly. Also I donīt know why. Is the child aligned to the coordinate system of the parent when you use the parent()-function ? If so, why isnīt this done when loading the file ? Iīm curious about this.

Another thing I just realized:
Currently the bottleneck of my application is the number of textures. When drawing with textures, the frame rate drops to 2 or 3 when all objects are visible. Without textures the framerate is 28 to 35. I guess the program is swapping textures in and out of the graphics card memory. Is there some way to work around this besides lowering the resolution or reducing the number of textures ?

Hm, that concludes my questions for today

Have a nice day, and thank you again,
Stefan
Reply With Quote
  #9  
Old 06-02-2005, 04:33 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Have you tried out Vizard 2.51? This might fix these problems you are experiencing.

When you parent an object to another it will inherit the transformation of the parent. The same thing is done when loading files.

When your world is running click on the "Display Stats" button in the toolbar. It should print out some statistics of your simulation, including how much texture memory you are using. If this value is near the amount of memory on your graphics card then this is most likely your problem. How many textures do you have and how big are they? If you wish I could create a plugin to compress the textures of an object. This might help a little bit.
Reply With Quote
  #10  
Old 06-08-2005, 12:28 AM
Stefan Stefan is offline
Member
 
Join Date: May 2005
Posts: 5
texture management

Hi farshizzo !

Is there a command to completely unload textures from memory, something like the remove-command just for images ? Also, if you find the time, a texture-compression plug-in would be nice.

Thanks,
Stefan
Reply With Quote
  #11  
Old 06-08-2005, 04:44 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

There is no command to remove textures. Also, when you load models, Vizard caches the textures so that other models can share the same textures. So even when you delete a model the texture is still in memory. The best solution would be to allow the user to clear the cache and free up the memory. This feature doesn't currently exist, but I will look into adding it to the next release.
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 07:22 AM.


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