gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/Documentation/Manuscripts/Irregu irregu.tex


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/Documentation/Manuscripts/Irregu irregu.tex
Date: Sun, 17 Nov 2002 06:55:29 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/11/17 06:55:27

Modified files:
        Documentation/Manuscripts/Irregu: irregu.tex 

Log message:
        terms and algo

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Documentation/Manuscripts/Irregu/irregu.tex.diff?tr1=1.47&tr2=1.48&r1=text&r2=text

Patches:
Index: gzz/Documentation/Manuscripts/Irregu/irregu.tex
diff -u gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.47 
gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.48
--- gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.47        Sat Nov 16 
06:14:30 2002
+++ gzz/Documentation/Manuscripts/Irregu/irregu.tex     Sun Nov 17 06:55:27 2002
@@ -178,9 +178,11 @@
 
 \section{Tearing}
 
-Terms: tear-out, connected/scattered, envelope, spine of the envelope,
+Terms: canvas, tear-out, connected/scattered, envelope, spine of the envelope,
 ``torn edge'' = ?,
-``thickness of roughness'' = ?
+``thickness of roughness'' = ?,
+``border'' = ?,
+``section/segment of envelope'' = ?.
 
 In this section, we introduce the use of non-photorealistic rough, torn shapes 
instead 
 of the usual rectangular, clipped and framed viewports.
@@ -273,7 +275,7 @@
 Square root XXX refs: stroke scaling in pen drawings?
 
 
-Edge shapes: attached and sprinkled and intermediates.
+Edge shapes: connected and scattered (and intermediates).
 TOPOLOGY!
 
 Finally, there is the question of what should happen when the viewport reaches 
the edge
@@ -290,69 +292,49 @@
 and discuss
 a simple algorithm for a shape with the desired properties.
 
-To start off, assume that we are drawing the torn edge around a given 
-smooth parametric curve $C = (x(t), y(t))$. The thickness of the roughness of 
the
-edge is assumed to be small compared
-to the curvature of $C$.
-% XXX
-
-Locally, we can approximate the curve by a point and a normal vector.
-The resulting shape of the edge should be continuous w.r.t.~both the local
-point and normal vector.
-
-For the attached edge, we can obtain the final curve by simply shifting the 
original
-smooth curve to its normal direction by a function which only depends on the 
location $(x, y)$.
-
-The sprinkled case, on the other hand, can be obtained through a decision 
process:
-again using a function $f(p)$ of location $p$, a given point is {\em inside} 
the curve,
-iff $f(p) < |p - n_C(p)|$, where $n_C(p)$ is the nearest point to $p$ on the 
curve $C$.
+To start off, assume that we are drawing the torn edge inside a 
+given \emph{envelope}.
+The envelope is parametrized as a mapping $E(s,t)$ to canvas coordinates
+so that $E(s,0)$ and $E(s,1)$ are along the inner and outer edges of the 
+envelope, respectively, and the ripples are contained between these two curves.
+The envelope should not intersect itself.
+
+An envelope can be defined with a spine $E(s,1/2)$ and a normal vector
+$N(s)$ so that $E(s,t) = E(s,1/2) + (t-1/2) N(s)$.
+
+For the connected edge, we can obtain the final curve $C(s)$ by simply shifting
+the spine of the envelope along its normal direction by a function 
+$0\le f(p)\le 1$ which only depends on the location of the spine: 
+$C(s) = E(s, f(E(s,1/2)))$.
+
+The scattered case, on the other hand, can be obtained through a decision 
process:
+again using a function $f(p)$ of location $p$, 
+a given point $E(s,t)$ is {\em inside} the tear-out,
+iff $f(E(s,t)) > t$.
 
 % XXX: the irregu_gears.jpeg issue should be addressed here, i.e., the shape 
 % of the torn edge should ideally not depend on normal in/out direction.
 
 Although these algorithms seem different and produce different results, there 
is 
 actually a reasonable generalization which yields to a visual explanation.
-Both algorithms can be represented as a point being inside the final curve if
-$$
-    f(g(p)) < |p-n_C(p)|
-$$
-where $g(p) = p$ for the sprinkled case and $g(p) = n_C(p)$ 
-for the attached case. We can immediately define a family of intermediate forms
-with 
-$$
-    g_\alpha(p) = \alpha p + (1-\alpha) n_C(p),
-$$
-parametrized by $\alpha$
-with usually $0 \le \alpha \le 1$.
-
-% \alpha = 1   corresponds to projecting the cutting plane to the paper 
-% \alpha \ne 1 requires stretching the cutting plane before projection
-%              with stretch factor 1 / \alpha (i.e, \infty for \alpha = 0)
+Both algorithms can be seen as computing the intersection of (the volume
+above) the surface $(p, f(p))$ and a \emph{cutting surface} $(E(s,g(t)), t)$, 
+and then mapping the intersection on the envelope $E(s,t)$ 
+using the parametrization of the cutting surface.
+The function $g$ (actually its inverse) defines the profile of the 
+cutting surface, with $g(t) = t$ for the scattered case and $g(t) = 1/2$,
+i.e., a vertical surface, for the connected case. 
 
 A suitable choice for $f$ would be
 a function with noise at different frequencies, but with lower frequencies
 emphasized more, such as turbulence\cite{perlin-noise-intro}.
 
-% The jagged shape is defined by a surface $(x, y, f(x,y))$,
-% where $0 \le f(x,y) \le 1$ and $(x, y, 1/2)$ is paper location.
-% The shape of an edge torn along a line is obtained by intersecting
-% the surface with a plane cutting through the tearing line.
-% The intersection is then rotated around the tearing line until
-% it is horizontal and stretched so that $z = 0$ and $z = 1$ lines 
-% of the cutting plane correspond to the desired maximum positive
-% and negative displacements of the edge.
-% 
-% If the cutting plane is vertical, the shape of the torn edge is attached.
-% If the angle between $z = 1/2$ plane and the cutting plane is
-% small enough, the plane will cut off maxima of the surface,
-% producing a sprinkeld shape.
-
 \section{Hardware-accelerated implementation}
 
 In the following, we shall concentrate on drawing one section
-of the edge, in the unit square, so that $x=0$ is outside and $x=1$
-is inside the tearout. The $y$ coordinate is along the edge.
-
+of the envelope, in the unit square: $0\le s\le1$, $0\le t\le1$.
+It assumed that the position $E(s,t)$ inside the section of the envelope 
+and the function $g(t)$ depend linearly on the parameters $s$ and $t$.
 
 We shall concentrate on OpenGL and NVIDIA extensions (due
 to their availability in the Linux environment), but 
@@ -372,25 +354,24 @@
 
 \subsection{Drawing the shape}
 
-Recall that the torn shape is defined as the intersection
-of a surface $(x,y,f(x,y))$ and a cutting plane, rotated and
-stretched around the tearing line to match desired bounds on the paper.
-
-Because the rotation and stretching are affine operations, 
-the $(x,y,z)$ coordinates of the cutting plane 
-are affine functions of the corresponding $(x',y')$ 
-paper coordinates.
-Thus, OpenGL can interpolate $(x,y)$ as texture coordinates
-and $1-z$ as the alpha component of the primary color 
-of a fragment corrensponding to the paper position $(x',y')$.
-The fragment is inside the tearout 
-if the corresponding point of the cutting plane falls below
-the displacement surface, i.e., if $f(x,y) < z$.
-This is equivalent to $f(x,y) + (1-z) < 1$. 
+Recall that the torn shape can be defined as the intersection
+of a surface $(p,f(p))$ and a cutting plane $E(s,g(t),t)$.
+Using the same parametrization for both surfaces, a point $E(s,t)$
+is inside the tear-out, iff
+\begin{equation}
+    f(E(s,g(t))) < t.
+\end{equation}
+
+Because $E(s,t)$ and $E(s,g(t))$ are both affine functions,
+we can draw the section as a single QUAD with object position 
+interpolated as $E(s,t)$, texture coordinates as $E(s,g(t))$,
+and the alpha component of the primary color as $(1-t)$.
+The above inequality can be written as $f(E(s,g(t))) + (1-t) < 1$.
 The left side can be computed using texture environment mode ADD
-and an INTENSITY texture storing $f(x,y)$.
+and an INTENSITY texture storing $f(p)$.
 The alpha output of the texture environment can then be tested
-against $1$ using ALPHA\_TEST.
+against $1$ using ALPHA\_TEST to discard fragments outside
+the tear-out.
 
 
 [GL\_EXT\_texture\_env\_add or OpenGL 1.3 required]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]