POV-Ray : Newsgroups : povray.programming : Mesh code : Re: Mesh code Server Time
8 Jul 2024 18:36:29 EDT (-0400)
  Re: Mesh code  
From: Thorsten Froehlich
Date: 24 Dec 2002 17:14:48
Message: <3e08dc58@news.povray.org>
In article <chr### [at] netplexaussieorg> , 
Christopher James Huff <chr### [at] maccom>  wrote:

> Well, it actually does do something, but it does more work than it needs
> to. It swaps the vertices and then passes them to another function. I
> changed it to pass them in a different order, the code is cleaner IMO
> and slightly faster, though not in a place where it really matters.

Actually, there is a lot more that could be done to be more (space)
efficient in the current code...

For example to current indexing of vertex-, normal-, uv- vectors, as well as
of textures does not exploit locality very well.  Taking vertices as
example, but the same holds for the other uv vectors, normals and textures:

Many vertices that are close to each other will also belong to triangles
close to each other.  So one could partition the current single table of
vertices into smaller tables.  This would allow to reduce the data in
Mesh_Triangle_Struct by at least 16 bytes if the indices are turned into 16
bit ints with a 16 bit table index.  Of course for very large meshes this
could cause duplicate table entries, but given that per triangle four bytes
- that is 1/3 of a vertex vector - are saved, this will still reduce memory
consumption.

Of course, the cost of such a modification would be much more complex mesh
parsing as data would have to be kept in a more ordered fashion.  So it
would require rewriting large chunks of the current code...

Or take this to the extreme and provide one full index and make the other
two single byte offsets relative to that one.  That way only 6 compared to
the current 12 bytes would be needed per vertex (or the other indexed data).
And probably such a method would be easy to implement without changing much
of the current code!

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.