## Re: [Algorithms] Triangle/Triangle intersection

 Re: [Algorithms] Triangle/Triangle intersection From: Jason Hughes - 2007-10-25 04:16:35 ```Diogo, You can try to choose better seeds for new charts. This is critical, as each choice changes the available faces for future charts, so regularity and a lack of spurious triangles scattered about after the partitioning process is key. Usually the best places to start tend to be least-connected faces, but there may be other, more optimal metrics to use that will yield greater, flatter charts. You can try different seeds, even without changing the heuristic, and sometimes find significantly better results. If your routine is fast enough, you can randomize it slightly (pick from the top 2 or 3 seeds for each chart) and take the best result. You can also control the rate of vertex splits by adding new guiding metrics to the fitness/heuristic function. Try to maximize the ratio of interior vertices (count actual verts here, not just vertex positions!) to total vertices. This should result in rounder partitions that tend to walk along existing discontinuities. Another technique is to grab whole vertex neighborhoods at a time, rather than face-by-face. So, evaluate vertices on the perimeter and decide which neighborhood you want to take next. This gives you a guarantee that you won't create splits arbitrarily by forgetting to take one face in a neighborhood, which you can't easily predict will happen if you go face-by-face. Some care is needed to handle the case of a vertex along a discontinuity seam correctly--grabbing a neighborhood should only grab a single 'final' vertex and its adjacent faces. So, a split neighborhood (vertex on the UV seam of a torus) should include only faces on one side of the seam when you grab a vertex that straddles the seam, but do consider the opposing vertex neighborhood when considering perimeter vertices during the next iteration, as it's just another vertex. Thanks, JH Diogo de Andrade wrote: > Hey all! > > Follow up to my previous thread... :) > > I've implemented part of the paper suggested by Jason Hughes to create some > UV coords for lightmapping. > The implementation itself was pretty straightforward, and the results > (visually) are very nice... The geometry spans curvature, I can control the > precision of the maps pretty accurately (goodbye edge distortions!), etc... > > The thing I'm not that happy with is the amount of new vertexes this > approach generates... I was expecting more vertexes in the unwrapped model > (there are discontinuities after all!), but I wasn't expecting that many, > really... > > Practical examples: > > Source Temporary Final Final/Source > Torus 325 1728 1254 370% > Box 24 36 36 150% > Character 433 1812 1635 370% > Sphere 559 2880 2102 370% > > What I see is lots of charts being generated, which leads to > discontinuities... > > My question is if this is a normal situation... I've never done > lightmapping, so I'm not sure if a 400% increase in vertex count is normal > when using these kind of algorithms... > If it's not, maybe somebody can point me to where I'm doing things wrong... > My heuristic is something like (from the paper): > > TriInfo* tri=&(tri_info[*it]); > float dist=(tri->_center-current_chart->_center).normalize(); > float cos_angle=dot_product(tri->_normal,current_chart->_normal); > if (cos_angle>=tolerance) > { > float heuristic=(lambda-cos_angle)*dist; > if (heuristic { > best_heuristic=heuristic; > best_match_id=unsigned long(tri->_id); > best_tri=tri; > } > } > > Any ideas? > > Thanks in advance! > > Diogo de Andrade > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > ```