On Tuesday 03 August 2004 07:08 pm, William Skaggs wrote: > Actually I would go about this differently: Start by > making a list of all of the triangles, recording their > vertices. I have this list available already, so this would be no problem. > Then go through the image, and for each pixel, > figure out which triangle is visible there, and render > its color. I think this would be a lot faster, and it > lets you work with a tile iterator as well. Even if I had an easy way to determine the right triangle, this would make anti-aliasing harder because no pixel would "know" if it is part of an edge or even nearby. My guess is that the advantage of using a tile iterator would not outweigh the additional computing time necessary for the approach you suggest, but I have not tried it yet, and this is why I asked for stats initially. > If you start searching from the center of the image, and > work outward, then the first triangle you find that > overlies the point will be the one that is visible, > so the search can be done pretty efficiently. > In fact, > there may even be a way of calculating which triangle is > visible above a given pixel without having to do any > searching. The search would be additionally complicated by the fact that you can optionally give the pyramids random heights and modify the viewing distance, so the perspective projection has to be taken into account more explicitly. I therefore don't think that the method you suggest would be easier or faster. I have meanwhile modified the plug-in to use GIMP's selection and fill method (with anti-aliasing enabled). The result now looks better and also rendered quite fast (there's currently a problem on the left side of the pyramids in the horizontal center of the image which I will of course fix): http://stud4.tuwien.ac.at/~e0225855/extrude2.png To fill a triangle, I use: gimp_palette_set_foreground ... gimp_free_select .... gimp_edit_fill .... Is there a better way to do this? The "set_foreground"-part changes the colour menu in the user interface, can I avoid this somehow? Why does the call take a pointer - is it safe to modify the variable after the call? Another question: Do I have to call gimp_drawable_flush and gimp_drawable_update at the end of processing? What do these things do? I called them when I worked on the pixel data directly, but I have now commented these calls out as I only use internal GIMP functions and don't copy or modify the pixel regions/arrays directly. And something else: The documentation for "gimp-drawable-mask-bounds" reads "...returns the whether there...". Markus.