|
From: Ethan M. <merritt@u.washington.edu> - 2010-12-09 20:11:48
|
On Thursday, December 09, 2010 07:53:12 am Stanislav Maslovski wrote: > Hello, > > On Tue, 2010-12-07 at 15:42 +0000, Stanislav Maslovski wrote: > > On Tue, 2010-12-07 at 11:51 +0000, Stanislav Maslovski wrote: > > > Hello, > > > > > > Can anyone advise me on how can I workaround the problem with 3D > > > rendering in the plot [1]? The problem is that the surfaces that must be > > > hidden are seen in this plot (to clearly see them, > > > load "maxout.gnuplot" and try rotating the plot). > > > > > > The plot was generated in maxima, using the draw3d command. Any help > > > will be very much appreciated! > > > > > > [1] http://zalil.ru/30094104 (wait 10 secs, and download will start) > > > > Replying to myself: actually, after reading some docs (and the code) I > > realized that it was a limitation of the rendering algorithm used by the > > gnuplot (a variant of painter's algorithm). So, I solved this issue by > > patching pm3d.c:pm3d_depth_queue_flush() so that sorting of quadrangles > > was done based on the average depth of 4 corners. I don't think this is the best way to approach the problem. As Hans-Bernhard pointed out, _any_ simple-minded sorting on a single Z value is going to fail for some configuration of triangles. The bigger the triangle, the more likely that any single Z value is not right for the whole thing. I suggest that a better approach would be to add a pass that splits large triangles into smaller pieces before sorting and rendering. The only tricky part is how to define "large". [OK, there's potentially another tricky part if you are coloring by something other than Z since you have to decide how to assign colors to the newly created vertices.] You can probably find sample code for this kind of divide-and-conquer approach in a textbook or article, but it should be simple enough to work it out from scratch. Ethan > > > > It would be nice if this could be made configurable. I will probably > > come out with a patch in the next couple of days to enable this feature. > > Just in case: the patch with an example is available from here > http://sourceforge.net/tracker/?func=detail&aid=3132649&group_id=2055&atid=302055 > > Cheers, > -- > Stanislav |