/[gzz]/gzz/Documentation/Manuscripts/Irregu/irregu.tex
ViewVC logotype

Diff of /gzz/Documentation/Manuscripts/Irregu/irregu.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53 by jvk, Mon Nov 18 17:05:36 2002 UTC revision 1.54 by jvk, Tue Nov 19 11:49:05 2002 UTC
# Line 165  Line drawing: Line 165  Line drawing:
165  Buchanan, Sousa: The edge buffer NPAR 2000  Buchanan, Sousa: The edge buffer NPAR 2000
166  Northrup, Markosian: Artistic silhouettes NPAR 2000  Northrup, Markosian: Artistic silhouettes NPAR 2000
167    
168  Saito, Takahashi -- *the* reference (Image-space algorithm) - Computer Graphics Vol24 no4  Saito, Takahashi -- *the* reference (Image-space algorithm) - Computer Graphics Vol24 no4 %\cite{saito90comprehensible}
169    
170  CARTOONS, SPEECH BUBBLES and FRAMES!!  CARTOONS, SPEECH BUBBLES and FRAMES!!
171  NEWSPAPERS, TORN ARTICLES  NEWSPAPERS, TORN ARTICLES
# Line 184  Terms: canvas, tear-out, connected/scatt Line 184  Terms: canvas, tear-out, connected/scatt
184  ``torn edge'' = ?,  ``torn edge'' = ?,
185  ``thickness of roughness'' = ?,  ``thickness of roughness'' = ?,
186  ``border'' = ?,  ``border'' = ?,
187  ``section/segment of envelope'' = ?.  ``section/segment of envelope'' = ?,
188    ``inner edge (of the border)'' = ?,
189    ``outer edge (of the border)'' = ?.
190    
191  In this section, we introduce the use of non-photorealistic rough, torn shapes instead  In this section, we introduce the use of non-photorealistic rough, torn shapes instead
192  of the usual rectangular, clipped and framed viewports.  of the usual rectangular, clipped and framed viewports.
# Line 307  $N(s)$ so that $E(s,t) = E(s,1/2) + (t-1 Line 309  $N(s)$ so that $E(s,t) = E(s,1/2) + (t-1
309  For the connected edge, we can obtain the final edge curve $C(s)$ by  For the connected edge, we can obtain the final edge curve $C(s)$ by
310  simply shifting  simply shifting
311  the spine of the envelope along its normal direction by a function  the spine of the envelope along its normal direction by a function
312  $0\le f(p)\le 1$ which only depends on the location of the spine:  $0\le f(p)\le 1$ which only depends on the location $p$ of the spine:
313  $C(s) = E(s, f(E(s,1/2)))$.  $C(s) = E(s, f(E(s,1/2)))$.
314    
315  The scattered case, on the other hand, can be obtained through a decision process:  The scattered case, on the other hand, can be obtained through a decision process:
# Line 315  again using a function $f(p)$ of locatio Line 317  again using a function $f(p)$ of locatio
317  a given point $E(s,t)$ is {\em inside} the tear-out,  a given point $E(s,t)$ is {\em inside} the tear-out,
318  iff $f(E(s,t)) > t$.  iff $f(E(s,t)) > t$.
319    
320  % XXX: the irregu_gears.jpeg issue should be addressed here, i.e., the shape  A suitable choice for $f$ would be
321  % of the torn edge should ideally not depend on normal in/out direction.  a function with noise at different frequencies, but with lower frequencies
322    emphasized more, such as turbulence\cite{perlin-noise-intro}.
323    
324    
325  Although these algorithms seem different and produce different results, there is  Although these algorithms seem different and produce different results, there is
326  actually a reasonable generalization which yields to a visual explanation.  actually a general formulation which yields to a visual explanation.
327  Both algorithms can be seen as computing the intersection of  Both algorithms can be seen as computing the intersection of
328  \emph{ripple volume}, the volume below the surface $(p, f(p))$,  \emph{ripple volume}, the volume below the surface $(p, f(p))$,
329   and a \emph{cutting surface} $(E(s,g(t)), t)$,   and a \emph{cutting surface} $(E(s,g(t)), t)$,
330  and then mapping the intersection on the envelope $E(s,t)$  and then mapping the intersection on the envelope $E(s,t)$
331  using the parameters of the cutting surface.  using the parameters of the cutting surface.
332  Using this parametrization for both surfaces, a point $E(s,t)$  
 is inside the tear-out, iff  
 \begin{equation} \label{eq:inside}  
     f(E(s,g(t))) \ge t.  
 \end{equation}  
333  The function $g$ (actually its inverse) defines the profile of the  The function $g$ (actually its inverse) defines the profile of the
334  cutting surface, with $g(t) = t$ for the scattered case and $g(t) = 1/2$,  cutting surface, with $g(t) = t$ for the scattered case and $g(t) = 1/2$,
335  i.e., a vertical surface, for the connected case.  i.e., a vertical surface, for the connected case.
336    Other choices for $g$ are possible, but not very useful, because they
337    correspond to just different distortions of the same basic shape.
338    
339  A suitable choice for $f$ would be  Using the same parametrization for both surfaces, a point $E(s,t)$
340  a function with noise at different frequencies, but with lower frequencies  is inside the tear-out, iff
341  emphasized more, such as turbulence\cite{perlin-noise-intro}.  \begin{equation} \label{eq:inside}
342        f(E(s,g(t))) \ge t.
343    \end{equation}
344    For more variation on the edge shapes, the inequality can be
345    generalized to
346    \begin{equation} \label{eq:inside2}
347       (1-\alpha(t)) f_1(E(s,g_1(t))) + \alpha(t) f_2(E(s,g_2(t)) \ge t,
348    \end{equation}
349    where the $\alpha(t)$ parameter specifies interpolation between
350    two different shapes.
351    
352  \section{Hardware-accelerated implementation}  \section{Hardware-accelerated implementation}
353    
354  In the following, we shall concentrate on drawing one section  In the following, we shall concentrate on drawing one rectangular section
355  of the envelope, in the unit square, with $t=0$ inside the tear-out,  of the envelope, in the unit square, with $t=0$ inside the tear-out,
356  $t=1$ outside the tear-out, and $s$ along the length of the envelope.  $t=1$ outside the tear-out, and $s$ along the length of the envelope.
357  It assumed that the canvas position $E(s,t)$ inside the section of the  It assumed that the canvas position $E(s,t)$ inside the section of the
# Line 387  the tear-out. Line 398  the tear-out.
398    
399  [GL\_EXT\_texture\_env\_add or OpenGL 1.3 required]  [GL\_EXT\_texture\_env\_add or OpenGL 1.3 required]
400    
401    Using two texture accesses, it is also possible to compute
402    the generalized case given in Eq.~\ref{eq:inside2} using
403    GL\_NV\_register\_combiners and interpolation parameter of the
404    form $\alpha(t) = a t + b$.
405    Even if using just $g_1 = g_2$ and $\alpha(t) = 1/2$, this formulation
406    allows an infinite non-repeating area of different shapes by making
407    the ripple functions $f_1$ and $f_2$ repeat at non-rationally
408    related periods.
409    
410  XXX: two texture accesses could be used to compute  On the other hand, this formulation brakes most of the border
411  \[  drawing algorithms discussed below.
    (1-\alpha(t)) f_1(E(s,g_1(t))) + \alpha(t) f_2(E(s,g_2(t)) \ge t  
 \]  
 for intermediate shapes and larger repeating unit in  
 the canvas (if the mapped sizes of two textures are not rationally related).  
 However, it brakes most of the border drawing algorithms discussed below.  
412    
413    
414  \if0  \if0
# Line 437  making it hard to obtain consistent bord Line 451  making it hard to obtain consistent bord
451  Mathematically, the border of an irregular tear-out is defined as  Mathematically, the border of an irregular tear-out is defined as
452  the set of points whose distance from the tear-out is less than  the set of points whose distance from the tear-out is less than
453  or equal to the desired line width.  or equal to the desired line width.
454  In the following, we consider different ways approximating  In the following, we consider different ways for approximating
455  the border.  the border.
456    
457  \subsubsection{The oldest trick}  \subsubsection{The oldest trick}
# Line 534  has no effect. Line 548  has no effect.
548  A four-component texture can store angles 45 degress apart for a vertical  A four-component texture can store angles 45 degress apart for a vertical
549  cutting plane and 90 degrees apart for a non-vertical plane.  cutting plane and 90 degrees apart for a non-vertical plane.
550    
551  Non-photorealistic line width scaling can be obtained by computing  Non-photorealistic line width scaling is obtained by computing
552  each mip-map\cite{williams83pyramidal}  each mip-map\cite{williams83pyramidal}
553  level of the outer surface textures separately  level of the outer surface textures separately
554  with the desired line width for that scale.  with the desired line width for that scale.
# Line 590  tear-out shapes with contents. Line 604  tear-out shapes with contents.
604  Curved envelopes can be approximated by dicing to linear pieces.  Curved envelopes can be approximated by dicing to linear pieces.
605  In the connected case, the sections are drawn as if they were  In the connected case, the sections are drawn as if they were
606  rectangles of such lengths that the spines of the adjacent sections meet.  rectangles of such lengths that the spines of the adjacent sections meet.
607  Projective texture mapping is used to stretch together the sides of the  Projective texture mapping is used to shear together the sides of the
608  adjacent rectangles.  adjacent rectangles.
609  In the scattered case, the sections are drawn simply  In the scattered case, the sections are drawn simply
610  as overlapping rectangles,  as overlapping rectangles,
# Line 618  as a similar intersection using the half Line 632  as a similar intersection using the half
632  the outer edges of the borders.  the outer edges of the borders.
633    
634  The intersection can be implemented by drawing the outside  The intersection can be implemented by drawing the outside
635  of the tear-out to the stencil buffer for each side of the shape.  to the stencil buffer for each side of the shape.
636  The inside is then drawn with a polygon  The inside is then drawn with a polygon
637  surrounding the inside and the envelopes of all sides  surrounding the inside and the envelopes of all sides
638  with stencil test set to discard those fragments that were  with stencil test set to discard those fragments that were
# Line 628  and requires no extra passes over the in Line 642  and requires no extra passes over the in
642  (the stencil can be cleared as the contents are drawn).  (the stencil can be cleared as the contents are drawn).
643    
644  If a canvas is torn into multiple pieces, the above methods  If a canvas is torn into multiple pieces, the above methods
645  produce edges that do not fit together: the ripple volume  produce edges that do not fit together: the edges of adjacent
646  cutting surfaces are always directed with upward slopes  pieces have opposing ripples.
 towards the normals of the envelopes, creating opposing  
 ripples for adjacent tear-out pieces.  
647  The problem is partly solved by inverting ($1-f(p)$)  The problem is partly solved by inverting ($1-f(p)$)
648  the ripple function for either one of each pair of facing sides.  the ripple function for either one of each pair of facing sides.
649  But then a 180 degree rotation of a pair of fitting pieces  But then a 180 degree rotation of a pair of fitting pieces
650  inverts the torn line between them, breaking the principle of  inverts the torn shape between them, breaking the principle of
651  tying ripple shape to canvas positions.  tying ripple shape to canvas positions.
652    
653  The problem can be solved with a vector valued ripple function $F(p)$:  The problem can be fully solved with a vector valued ripple function $F(p)$,
654  using $f(p) = (1 + d\cdot F(p))/2$, where $d$ is the unit normal  using $f(p) = (1 + d\cdot F(p))/2$, where $d$ is the unit normal
655  of the envelope, automatically inverts the function for 180 degree  of the envelope. The dot product automatically inverts the
656  rotation.  function for a 180 degree rotation.
657  The vector valued function can be directly used with the  This function can be directly used with the
658  pre-computed borders method, by pre-computing the dot product  pre-computed borders method by pre-computing the dot product
659  when computing the outer surfaces. As a bonus, the scattered  when computing the outer surfaces. As a bonus, the scattered
660  case, too, then needs to store only a span of 180 degrees.  case, too, then needs to store only a span of 180 degrees.
661  The texture shader version can also use vector valued ripple function  The texture shader version can also use vector valued ripple function

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26