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: Tue, 19 Nov 2002 08:13:07 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/11/19 08:13:07

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

Log message:
        reorg

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

Patches:
Index: gzz/Documentation/Manuscripts/Irregu/irregu.tex
diff -u gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.54 
gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.55
--- gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.54        Tue Nov 19 
06:49:05 2002
+++ gzz/Documentation/Manuscripts/Irregu/irregu.tex     Tue Nov 19 08:13:07 2002
@@ -186,7 +186,9 @@
 ``border'' = ?,
 ``section/segment of envelope'' = ?,
 ``inner edge (of the border)'' = ?,
-``outer edge (of the border)'' = ?.
+``outer edge (of the border)'' = ?,
+``ripple volume'' = ``volume under $({\bf p},f({\bf p}))$''?,
+``ripple function'' = $f({\bf p})$.
 
 In this section, we introduce the use of non-photorealistic rough, torn shapes 
instead 
 of the usual rectangular, clipped and framed viewports.
@@ -298,24 +300,24 @@
 
 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 the inner and outer edges of the 
+The envelope is parametrized as a mapping $E(x,y)$ to canvas coordinates
+so that $E(x,0)$ and $E(x,1)$ are 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)$.
+An envelope can be defined with a spine $E(x,1/2)$ and a normal vector
+$N(x)$ so that $E(x,y) = E(x,1/2) + (y-1/2) N(x)$.
 
-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(x)$ 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 $p$ of the spine:
-$C(s) = E(s, f(E(s,1/2)))$.
+$0\le f({\bf p})\le 1$ which only depends on the location ${\bf p}$ of the 
spine:
+$C(x) = E(x, f(E(x,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$.
+again using a function $f({\bf p})$ of location ${\bf p}$, 
+a given point $E(x,y)$ is {\em inside} the tear-out,
+iff $f(E(x,y)) > y$.
 
 A suitable choice for $f$ would be
 a function with noise at different frequencies, but with lower frequencies
@@ -325,44 +327,32 @@
 Although these algorithms seem different and produce different results, there 
is 
 actually a general formulation which yields to a visual explanation.
 Both algorithms can be seen as computing the intersection of 
-\emph{ripple volume}, the volume below 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)$ 
+\emph{ripple volume}, the volume below the surface $({\bf p}, f({\bf p}))$,
+ and a \emph{cutting surface} $(E(x,g(y)), y)$, 
+and then mapping the intersection on the envelope $E(x,y)$ 
 using the parameters 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$,
+cutting surface, with $g(y) = y$ for the scattered case and $g(y) = 1/2$,
 i.e., a vertical surface, for the connected case. 
 Other choices for $g$ are possible, but not very useful, because they
 correspond to just different distortions of the same basic shape.
 
-Using the same parametrization for both surfaces, a point $E(s,t)$
+Using the same parametrization for both surfaces, a point $E(x,y)$
 is inside the tear-out, iff
 \begin{equation} \label{eq:inside}
-    f(E(s,g(t))) \ge t.
+    f(E(x,g(y))) \ge y.
 \end{equation}
 For more variation on the edge shapes, the inequality can be 
 generalized to
 \begin{equation} \label{eq:inside2}
-   (1-\alpha(t)) f_1(E(s,g_1(t))) + \alpha(t) f_2(E(s,g_2(t)) \ge t,
+   (1-\alpha(y)) f_1(E(x,g_1(y))) + \alpha(y) f_2(E(x,g_2(y)) \ge y,
 \end{equation}
-where the $\alpha(t)$ parameter specifies interpolation between
+where the $\alpha(y)$ parameter specifies interpolation between
 two different shapes. 
 
 \section{Hardware-accelerated implementation}
 
-In the following, we shall concentrate on drawing one rectangular section
-of the envelope, in the unit square, with $t=0$ inside the tear-out,
-$t=1$ outside the tear-out, and $s$ along the length of the envelope.
-It assumed that the canvas position $E(s,t)$ inside the section of the 
-envelope depends linearly on the parameters $s$ and $t$.
-[XXX: should we assume that $E(s,t)$ is identity].
-
-We shall concentrate on OpenGL and NVIDIA extensions (due
-to their availability in the Linux environment), but 
-the feature sets of other APIs and manufacturers
-are quite similar.
-
 There are two basic alternatives for drawing the shape: either
 by using geometry to draw the jagged edge segment by segment,
 or by using a texture to draw a longer stretch at one time.
@@ -374,40 +364,49 @@
 the one used by Perlin in \cite{perlin-hypertexture} for synthesizing
 solid shapes.
 
+We shall concentrate on OpenGL and NVIDIA extensions (due
+to their availability in the Linux environment), but 
+the feature sets of other APIs and manufacturers
+are quite similar.
+
+In the following, we shall concentrate on drawing one rectangular section
+of the envelope, in the unit square, with $y=0$ inside the tear-out,
+$y=1$ outside the tear-out, and $x$ along the length of the envelope.
+It assumed that the canvas position $E(x,y)$ inside the section of the 
+envelope depends linearly on the parameters $x$ and $y$.
+Furthermore, without loss of generality, we assume that $E(x,y) = (x,y)$.
+At the end of this section, we consider how to use the rectangular 
+pieces to create a complete tear-out shape.
+
 \subsection{Drawing the shape}
 
-Recall that the torn shape is defined as the intersection
-of the volume below $(p,f(p))$ and a cutting surface $(E(s,g(t)),t)$.
-Because $E$ and $g$ are assumed to be affine, the cutting
-surface is actually a plane.
-The intersection is given by Eq.~\ref{eq:inside}, which can be written as 
-point $E(s,t)$ being inside the tearout, iff
+The shape is given by Eq.~(\ref{eq:inside}), which under the 
+assumptions can be written as a point $(x,y)$ being inside the tearout, 
+iff
 \[
-    f(E(s,g(t))) + (1-t) \ge 1.
+    f(x,g(y)) + (1-y) \ge 1,
 \]
-Because $E$ and $g$ are affine,
-we can draw the section of the envelope as a single QUAD 
-with texture coordinates interpolated as $E(s,g(t))$
-and the alpha component of the primary color as $(1-t)$.
-The left side of the above inequality can be computed using 
-texture environment mode ADD and an INTENSITY texture storing $f(p)$.
+where $g(y) = y$ or $g(y) = 1/2$.
+We can draw the section of the envelope as a single rectangle
+with texture coordinates interpolated as $(x,g(y))$
+and the alpha component of the primary color as $(1-y)$.
+The left side of the inequality can be computed using 
+texture environment mode ADD and an INTENSITY texture storing $f({\bf p})$.
 The alpha output of the texture environment can then be tested
 against $1$ using ALPHA\_TEST to discard fragments outside
 the tear-out.
 
+[ XXX: OpenGL 1.3 or GL\_EXT\_texture\_env\_add required ]
 
-[GL\_EXT\_texture\_env\_add or OpenGL 1.3 required]
-
-Using two texture accesses, it is also possible to compute
-the generalized case given in Eq.~\ref{eq:inside2} using
-GL\_NV\_register\_combiners and interpolation parameter of the
-form $\alpha(t) = a t + b$.
-Even if using just $g_1 = g_2$ and $\alpha(t) = 1/2$, this formulation 
-allows an infinite non-repeating area of different shapes by making 
+Using two texture units and register combiners, 
+it is also possible to compute the generalized case given by 
+Eq.~(\ref{eq:inside2}) with interpolation parameter of the
+form $\alpha(y) = a y + b$.
+This formulation also allows an infinite non-repeating area of 
+different shapes by making 
 the ripple functions $f_1$ and $f_2$ repeat at non-rationally
 related periods.
-
-On the other hand, this formulation brakes most of the border 
+On the other hand, the generalized formulation brakes most of the border 
 drawing algorithms discussed below.
 
 
@@ -468,8 +467,9 @@
 
 This method is simple and general, but requires multiple passes
 of the envelope for drawing the border.
-If the edge is connected, it suffices to shift to the envelope
-positive normal and both tangent directions.
+If the edge is connected, it suffices to shift to the 
+positive $y$ and to positive and negative $x$ directions
+of the envelope.
 
 %Quite fast, but still has overhead w.r.t.~just the shape.
 %Artifacts: edge thickness, small features 
@@ -489,11 +489,11 @@
 %computed in parallel for each fragment.
 With four texture units, it is possible to do the texture accesses
 corresponding to four different shifted edges for each fragment
-and use GL\_NV\_register\_combiners to determine if any of them
+and use register combiners to determine if any of them
 is inside the tear-out.
 
-For connected edges, the texture coordinates do not change along a
-normal of the envelope.
+For connected edges, the texture coordinates do not change along 
+the $y$ direction of the envelope.
 Simply set up texture units so that each one has
 the same bound texture but texture coordinates a distance corresponding
 to border width (or a fraction of it) apart along the length of the envelope.
@@ -501,10 +501,15 @@
 the envelope.
 A fragment is inside the outer edge of the border, if its distance from
 any of the adjacent inner edge points is less than the line width.
-This computation can be carried out using GL\_NV\_register\_combiners.
+This computation can be carried out using register combiners.
 
 \subsubsection{Pre-computed borders}
 
+Recall that the torn shape can be defined as the intersection
+of the ripple volume, i.e., the volume below $(x,y,f(x,y))$, 
+and a cutting surface $(x,g(y),y)$,
+which is actually a plane in the linear section of the envelope.
+
 It is possible to obtain the outer edge of the border 
 by simulating the procedure of drawing a thick line in the cutting plane:
 A circle on screen with radius corresponding to the desired border
@@ -589,6 +594,8 @@
 
 \subsection{Future work: NV30}
 
+XXX
+
 With NV30, more accuracy with floating point textures.
 More procedural textures with fragment programs.
 A single texture unit can be accessed multiple
@@ -644,14 +651,16 @@
 If a canvas is torn into multiple pieces, the above methods
 produce edges that do not fit together: the edges of adjacent
 pieces have opposing ripples.
-The problem is partly solved by inverting ($1-f(p)$) 
+The problem is partly solved by inverting ($1-f({\bf p})$) 
 the ripple function for either one of each pair of facing sides.
 But then a 180 degree rotation of a pair of fitting pieces 
 inverts the torn shape between them, breaking the principle of
 tying ripple shape to canvas positions.
 
-The problem can be fully solved with a vector valued ripple function $F(p)$,
-using $f(p) = (1 + d\cdot F(p))/2$, where $d$ is the unit normal
+The problem can be fully solved with a vector valued ripple function 
+${\bf F}({\bf p})$,
+using $f({\bf p}) = (1 + {\bf d}\cdot {\bf F}({\bf p}))/2$, 
+where ${\bf d}$ is the unit normal
 of the envelope. The dot product automatically inverts the 
 function for a 180 degree rotation.
 This function can be directly used with the




reply via email to

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