- From: MenTaLguY <mental@rydia.net>
- Date: Fri, 22 Jun 2007 22:29:26 -0400
- To: Chris Lilley <chris@w3.org>
- Cc: adam@emiasys.com, www-svg@w3.org, bulia byak <buliabyak@gmail.com>
- Message-Id: <1182565766.29129.44.camel@localhost.localdomain>
On Sat, 2007-06-16 at 14:17 +0200, Chris Lilley wrote: > I would be interested to see your results. What artefacts are you > seeing - sharp edges (I would not have expected that from Gouraud)? The source of the problem is second-order discontinuity at the edges of the triangles (i.e. the color is continuous, but its rate of change is not). The general visual effect is of "rays" connecting the vertices of the triangulation, making the triangles fairly evident: http://www.rydia.net/~mental/trymesh.png So, unless we want to force the SVG author to manually create very finely divided meshes (which bulia rightly vetoed), we will need to select a different shading function which takes into account neighboring triangles and can give us higher-order continuity. The "friendlier" function can be then approximated in OpenGL or Postscript by automatic subdivision. [Actually, with OpenGL on modern hardware, the shading function could probably even be implemented directly as a fragment shader.] Here's the current state of the test harness (shown above in the screenshot); I'm not too proud of the code, but I may as well post it so people can start playing with it. The code is public domain. http://www.rydia.net/~mental/trymesh-20070622.tar Planned still are: - an "eyedropper tool" for picking node colors - the ability to load a background image - miscellaneous UI improvements - alternate gradient functions [I do have a couple alternate functions buried in the code already, but they're toys for testing rather than being useful artistically, and the automatic subdivision code still needs work.] I'll post newer archives periodically, but the very newest version will always be available via git: git://git.inkscape.org/projects/trymesh.git Patches are very welcome. README follows at the end of the email. -mental ------------------------------------ REQUIREMENTS "trymesh" has the following requirements: - a C compiler (gcc) - Ruby 1.8 - Ruby/Gnome2 - Ruby/OpenGL - Ruby/GtkGLExt - libgts - RubyGems - RubyInline If you're on Ubuntu, these can be satisfied by installing the following packages: gcc-4.1 ruby1.8 ruby1.8-dev libgnome2-ruby libopengl-ruby libgtkglext1-ruby libgts-dev If you have a recent enough version of Ubuntu, you should be able to install RubyGems via the 'rubygems' package; otherwise you will need to download RubyGems from: http://rubyforge.org/frs/?group_id=126 Unpack the archive, and run the following in the unpacked directory: sudo ruby setup.rb At that point, you can install RubyInline via: sudo gem install RubyInline RUNNING ruby bin/trymesh USAGE Left-click to select a vertex; drag it to reposition it. Double-click to create a new vertex with the color of the most recently selected vertex. Right-click to delete a vertex. The sliders at the bottom control the color of the currently selected vertex. There are three toggles at the top of the window that control what is displayed: [G] - displays the color gradient [T] - displays the edges of the triangulation [V] - displays the vertices
Received on Saturday, 23 June 2007 02:29:38 UTC