[fluxus] Object Loader

dave dave at pawfal.org
Mon Jan 1 17:06:05 PST 2007


Hi Christian,

On Mon, 2007-01-01 at 20:45 +0900, Christian Sandor wrote:
> Hi all,
> Happy new year!
> 
> Recently, I have played with the .obj-loader of fluxus.
> (see examples/23-objimport.scm). I have found several problems with
> it. Also, my scheme/fluxus skills are not that good, so I might be  
> making
> some obvious mistakes....
> 
> 1) Speed
> On my MacBookPro (2.16 GHz)
> Loading meshes/bunny.scm (1500 triangles):  1 second
> Loading a more complex model (20000 triangles):  75 seconds
> 
> It seems to me that the there is some fundamental problem in the
> object loader ... Maybe, the object loader should better be  
> implemented in C?

yup it's pretty rubbish isn't it - I think its more a case of fixing the
scheme version than using C as it's cleaner to support file formats on
the scheme side if possible, and I think the obj-loader is probably
quite easily improved - I've hardly ever used it. fwiw there is no
reason a scheme version should be slower than a C one, as it (should be)
disk IO bound for large models.

> 2) Caching of Loaded Models
> My goal is to parse object files only once. When I reload a script,
> the object should not be loaded again.
> I tried something like (in C syntax, sorry):

You can do this with the current code, as you can call obj-load once and
use the returned list in multiple calls to obj-make. It might also be a
fix for the absurd load times to save out the list created by obj-load,
as loading them in would not require any further processing.

> 3) Reusing pdata
> Another problem I have is reusing loaded models. When just drawing  
> several instances
> of a loaded model, this can easily be done with "draw-instance".  
> However, in the following case,
> I do not know what to do: consider example/17-physics1.scm
> Assume that I want to pass loaded objects to the physics engine. In  
> that case, the line:
>          (let ((ob (build-cube)))
> should me modified to use instances of the loaded object.
> I imagine someting like:
>          (let ((ob (clone my-object))
> where the imaginary function (clone my-object) makes a copy of the  
> loaded .obj data.
> Is there a better way to do this? Or does scheme/fluxus already
offer  
> this functionality?

no - it needs a build-instance! consider it todo'ed. 

the only way currently to duplicate models is to transfer the pdata into
scheme lists, make a new primitive of the right size and copy them back.
It will probably stay this way, but I'm starting to write some standard
higher level geometry operations built on top of the pdata which will
make this more convenient. 

the reason fluxus is a bit light on this sort of thing is because I only
really use it for procedural modelling (atm). 

another thing you are going to come up against is that the physics
system can't make collision meshes from polygonal models, we could quite
easily do this (ODE supports it) so keep pestering - I'm a bit tied up
with getting 0.12 done at the moment though.

cheers,

dave







More information about the Fluxus mailing list