[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
tom st denis wrote :
>
> If you guys change P3D to not un-persp-project the points and calc
> normals and that stuff rendering would be much faster via P3D. Most
> likely the user already knows the normal of the face they are rendering
> so if we changed P3D to avoid useless work all will be cool.
I've tried to remove those computations but it did not speed things up.
The bottleneck is somewhere else... As soon as I will be able to profile
Allegro programs I think I'll discover where P3D spends much time.
Anyway, I think Jason Wilkins is right : the bottleneck is somewhere
around the edge list sorting. And what we need is a *very* quick
algorithm to insert an element in a sorted double linked list... (Hash
tables seem not to be efficient since the list is small : ~20-30 edges
in the list)
Does anyone have a good idea ?
BTW P3D (nor any other scanline sorting lib) can not (and never will)
display a convex object faster than the painter algo. The main advantage
of the scanline sorting algo is to avoid overdrawing of polygons at the
price of more complex (and slower) routines. Anyway, if the time gained
by avoiding overdrawing is greater than the time spent to manage edge
lists then frames are displayed faster.
However, in the particular case of a convex object, back faces are
trivially rejected by backface culling so even with the painter algo
there is no overdrawing... In such a configuration P3D spends (very)
much time to manage and sort lists but does not gain any time at all
since there is no overdrawing to be avoided in the scene. Scanline
sorting algorithms are then slower than the Painter algo.
P3D is supposed to speed up 3D drawing but it does not achieve it in
every configuration. It's up to you to decide which is the better
algorithm that meet your needs : none of them can render a 3D scene
quickly in every configuration. This is a matter of compromise.
Bertrand.