W3C home > Mailing lists > Public > www-svg@w3.org > August 2008

Pseudo3D by distorting the bounding box

From: Manuel Strehl <svg@manuel-strehl.de>
Date: Sun, 31 Aug 2008 17:07:51 +0200
Message-ID: <48BAB3C7.8070300@manuel-strehl.de>
To: www-svg@w3.org

Hi,

this is a reminder of one proposal for pseudo 3D in SVG, that was made
during the SVGOpen 08. As shown by various projects and presentations
the need for doing perspective deformation somehow in SVG is rather urgent.

This proposal now is inspired by the way raster graphic programs like
Photoshop and GIMP do perspectives.

Proposal: Add an additional attribute "bounding-box-map" to the spec.

Usage:
  <svg:path id="arbitrary_path" d="..." />
  <svg:path bounding-box-map="url(#arbitrary_path)" d="..." />

Effect: The bounding box (the smallest rectangular the object fits into)
of the object with @bounding-box-map is distorted in a way that it takes
on the shape of the path defined by the referred ID. This reference is
quite similar to the way masks, clippings and so forth work. Possibly
the referred path should be encapsulated in some additional element like
<clipPath />.

Notes:
* To be of maximal use, the usage of "bounding-box-map" should not be
restricted to paths. Especially distorting groups and using, e.g.,
letters for mapping can introduce powerful features.
* This has not to be the only way to do pseudo 3D in SVG. It can be
introduced additively to other features.

Advantages:
* Works exactly like current SVG features: clipping, ...
* Do not just pseudo 3D stuff, but all kinds of distortions, waves, ...
* Implementation on authoring side would be comparatively simple. In
fact, there is already an Inkscape plugin that does exactly this
(deforming a path with regard to another one)
* Do Star Wars like intros ;-)
* Most important for a 2D (!) graphics format: no z axis needed.

Disadvantages:
* Implementing in viewers (animation!) could be more tricky.
* How to map onto non-trivial curves like, e.g., "O"s? Perhaps just fill
the spaces inside and take only the outermost M...z part of subcurves?
* Doing some transformation like "skip to the 'back' by 40°" is
impossible without trigonometry. You'll have to calculate a trapezoid to
map the element onto.

Hoping for a fruitful discussion,
Manuel
Received on Sunday, 31 August 2008 21:55:07 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:40 GMT