Fast Vertex Manipulation

Blitz3D Forums/Blitz3D Programming/Fast Vertex Manipulation

Damien Sturdy(Posted 2005) [#1]
Hey peeps!

The discussion about the fastest way to manipulate meshes in another thread the other day lead me to write a bit of code.

The code basically buffered all manipulation commands and executed them all at once on an "updatemesh".

I found it to be the same speed, initially... until just now... when i realised i never free any of the types..

So, the first go moves 100 vertices. the second go moves 200, etc etc.

yet, this code still ran the same speed as directly calling the original commands (for the most part of course).

Im wondering then- This code must be considerably FASTER once i put the "delete" line in. lol..

I will post here later to test. I'm hoping its much faster anyway. I used a similar method doing car damage in the racer without realising. Took it out because i had no way to reset the meshes :/

OKAY! I added the code! (Messy but followable i suppose...)

Now, after a few tests, i can tell you that if you are NOT doing much with a mesh other than updating it, you can actually lose speed using this technique. If you are updating a mesh which is pickable, and are picking, you get a massive increase.

Could do with a few people testing it out actually!

Use the provided commands, and call "updatemesh" before you render, that should be all :)




Mr Snidesmin(Posted 2005) [#2]
Sounds almost too good to be true. . . can't wait to see the code :O)

Isn't using types slow though? epecially when you create + delete large numbers of them at a time. . . there's a lot of dynamic memory allocation going on there.

I guess I'll have to see the code before I see what you mean really. . .


jfk EO-11110(Posted 2005) [#3]
Types are indeed pretty slow comapred to dynamicly created banks (that may hold some kind of homegrown types as well). additionally it's a lot faster to access things using an absolute index. But of course, this is an other issue.


Ross C(Posted 2005) [#4]
Can't you reuse the types? I think the delete command can be slow.


Clarks(Posted 2005) [#5]
the delete command can be slow. hmmm!

ive ran tests on types vs banks and types were faster. the continuous function calling on banks is what caused the types to win.


Damien Sturdy(Posted 2005) [#6]
Mann.... I updated.


If you have to update a mesh and are using collision stuff in between each update, then you get (apparently) a 650% speed up.

If its just moving stuff, IE no line pick, then its quicker the blitz way :/

:(


jfk EO-11110(Posted 2005) [#7]
Clarks - I think it really depends on the way you use it. Of course, there is an overhead when you call a function each time you want to access a bank. If you're familar with asm code then it may be easier to use the bank access syntax right away, instead of a function call that emulates type access syntax.


Clarks(Posted 2005) [#8]
youre right jfk, the only reason why types are faster is because the banks accessed with functions


Damien Sturdy(Posted 2005) [#9]
Was this of no use then? ;)


Clarks(Posted 2005) [#10]
thats a major speed difference