gzz-commits
[Top][All Lists]

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

 From: Tuomas J. Lukka Subject: [Gzz-commits] gzz/Documentation/Manuscripts/Irregu irregu.tex Date: Sat, 30 Nov 2002 04:37:48 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/11/30 04:37:48

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

Log message:
Working on how

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

Patches:
Index: gzz/Documentation/Manuscripts/Irregu/irregu.tex
diff -u gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.102
gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.103
--- gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.102       Sat Nov 30
04:29:48 2002
+++ gzz/Documentation/Manuscripts/Irregu/irregu.tex     Sat Nov 30 04:37:48 2002
@@ -424,6 +424,9 @@
\newcommand{\p}{\mathbf{p}}
\newcommand{\q}{\mathbf{q}}

+\newcommand{\afunc}{\mathbf{a}}
+\newcommand{\bfunc}{\mathbf{b}}
+
The most obvious choice is to use an offset: if $a(\p)$ is the
indicator function for the shape $A$, i.e. 1 if $\p$ is inside $A$ and
0 otherwise, then
@@ -433,141 +436,93 @@
This is the way Perlin\cite{perlin-noise-intro} create marble out of
lines.

-% This type of mapping is implemented in modern
-% the image of the undistorted shape can be stored in a texture and accessed
-% with texture coordinates offset by (read from) another texture.
-% This is called an offset (dependent) texture access.
-
The limitation of this approach is that there is no ebbing because
it is based on the points inside $A$, not its border.
-A different approach is to displace the border of $A$
-
-The forward function cannot be efficiently implemented on pixel level,
-because each pixel may depend on multiple values of the function.
-The edge of the shape could be displaced on vertex level,
-but that is likely to not yield good performance if the shape has fine detail.
-Furthermore, intersections in the edge may cause additional problems.
-If the function is bijection, so as to avoid any intersections, we
-can just as well use the inverse mapping.
-
----
+A different approach is to displace the border of $A$: if $\afunc(t)$ is
+the parametrized curve of the border of the original shape,
+then
+$$+ \bfunc(t) = \afunc(t) + f(\afunc(t)). +$$
+This technique is commonly called displacement mapping.
+There are variations to this such as displacing along the border.

-Because of implementation constraints, we further refine
-the ideal offset texture model discussed above.
-First of all, we want to be able to tear off many different shapes without
-having to render each of them to textures.
-And more importantly, texture shading is not implemented on low-end
-hardware.
-XXX: we want to be able to draw connected tear-out shapes.
-XXX: ebbing?
-
-\if 0
-We split the edge of the original shape to multiple pieces,
-each assumed to be a straight line segment, and then consider
-the problem of distorting each one separately.
-
-Consider a half-plane shape
-$- A = \{\, x \mid n \cdot (x - x_0) \le 0 \,\} -$
-representing one line segment, where $n$ is the unit normal of the line.
-
-The offset mapping yields $y \in B$, iff
-$- y + F(y) \in A, -$
-i.e., iff
-$$- n \cdot (y - x_0) + n \cdot F(y) \le 0, -$$
-Thus, offset has only effect in the normal direction and the problem
-is essentially reduced to one dimension.
-We can simply define the scattered case'' as: $F(y) = -n f(y)$,
-where the real function $f(y)$ specifies offset in the (negative)
-normal direction.
-This yields $y \in B$, iff
-$$- f(y) \ge n \cdot (y - x_0), -$$
-The movement is still natural, because the resulting distortion
-is continuous and local. XXX: rotation?
-
-Consider then the edge displacement case, i.e. the distorted edge defined
-by $y = x + G(x)$ for $x$ in the undistorted edge.
-Analogously to the offset function, the displacement can be limited
-to the normal direction by defining $G(x) = n f(x)$,
-where $f(x)$ is the normal displacement.
-With one-dimensional displacement, the distorted edge cannot intersect
-itself, and we obtain $y \in B$, iff
-$$- f(x_y) \ge n \cdot (y - x_0), -$$
-where $x_y$ is the projection of $y$ to the undistorted edge.
-
-Thus, we have a connected case'' in a very similar formulation
-to the above scattered case''.
-\fi
-
----
-
-To start off, assume that we are drawing the torn edge inside a
-given smooth \emph{envelope}.
-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
-smooth curves.
-An envelope can be defined with a \emph{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)$.
-The envelope should not intersect itself.
-
-This formulation allows us to consider the distortion only
-in the normal direction ($y$-axis) for each point $x$ in the edge.
-On the other hand, we will need to specifically consider the corners
-later.
-
-The edge curve $C(x)$ of a conneccted shape can be obtained by simply
-displacing the edge in the normal direction by a function
-$f(\p)$: $C(x) = E(x, 1/2 + f(E(x,1/2)))$.
-
-The scattered case, on the other hand, can be obtained by offsetting
-in the normal direction: using an offset function $f(\p)$ of location $\p$:
-a given point $E(x,y)$ is {\em inside} the tear-out,
-iff $y - f(E(x,y)) < 1/2$. Here, the offset function is negated
-for reasons of other formulations. XXX
-
-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}.
-
-These one-dimensional displacement and offset mappings correspond
-to the following 2D forward and inverse functions:
-\begin{eqnarray}
-  G_N(\p) &=& \p + (r N) f(\p), \\
-  F_N(\q) &=& \q - (r N) f(\q),
-\end{eqnarray}
-where $N$ is the unit normal, $r$ is the distortion radius,
-and the undistorted shape $A$ is the region inside the spine $E(x,1/2)$.
-
-Although these algorithms seem different and produce different results,
-they can both be formulated as offsetting in the one-dimensional case:
-a point $E(x,y)$
-is inside the tear-out, iff
-$$\label{eq:inside} - f(E(x,g(y))) \ge y, -$$
-where $g(y) = y$ for the scattered case and $g(y) = 1/2$.
-The function $g(y)$ specifies how the offset texture'' is mapped.
+The important point w.r.t.~both of of these common techniques
+is that the displacement depends on location in {\em canvas} coordinates,
+not in the coordinates relative to the undistorted shape.
+This is what produces the correct illusion.
+
+% ---
+%
+% Because of implementation constraints, we further refine
+% the ideal offset texture model discussed above.
+% First of all, we want to be able to tear off many different shapes without
+% having to render each of them to textures.
+% And more importantly, texture shading is not implemented on low-end
+% hardware.
+% XXX: we want to be able to draw connected tear-out shapes.
+% XXX: ebbing?
+%
+
+% ---
+%
+% To start off, assume that we are drawing the torn edge inside a
+% given smooth \emph{envelope}.
+% 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
+% smooth curves.
+% An envelope can be defined with a \emph{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)$.
+% The envelope should not intersect itself.
+%
+% This formulation allows us to consider the distortion only
+% in the normal direction ($y$-axis) for each point $x$ in the edge.
+% On the other hand, we will need to specifically consider the corners
+% later.
+%
+% The edge curve $C(x)$ of a conneccted shape can be obtained by simply
+% displacing the edge in the normal direction by a function
+% $f(\p)$: $C(x) = E(x, 1/2 + f(E(x,1/2)))$.
+%
+% The scattered case, on the other hand, can be obtained by offsetting
+% in the normal direction: using an offset function $f(\p)$ of location $\p$:
+% a given point $E(x,y)$ is {\em inside} the tear-out,
+% iff $y - f(E(x,y)) < 1/2$. Here, the offset function is negated
+% for reasons of other formulations. XXX
+%
+% 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}.
+%
+% These one-dimensional displacement and offset mappings correspond
+% to the following 2D forward and inverse functions:
+% \begin{eqnarray}
+%   G_N(\p) &=& \p + (r N) f(\p), \\
+%   F_N(\q) &=& \q - (r N) f(\q),
+% \end{eqnarray}
+% where $N$ is the unit normal, $r$ is the distortion radius,
+% and the undistorted shape $A$ is the region inside the spine $E(x,1/2)$.
+%
+% Although these algorithms seem different and produce different results,
+% they can both be formulated as offsetting in the one-dimensional case:
+% a point $E(x,y)$
+% is inside the tear-out, iff
+% $$\label{eq:inside} +% f(E(x,g(y))) \ge y, +%$$
+% % where $g(y) = y$ for the scattered case and $g(y) = 1/2$.
+% The function $g(y)$ specifies how the offset texture'' is mapped.
Other choices for $g$ are possible, but not very useful, because they
-correspond to just different distortions of the same basic shape.
-
-For more variation on edge shapes, the inequality can be
-generalized to
-$$\label{eq:inside2} - (1-\alpha(y)) f_1(E(x,g_1(y))) + \alpha(y) f_2(E(x,g_2(y)) \ge y, -$$
-where the $\alpha(y)$ parameter specifies interpolation between
-two different shapes.
+% % correspond to just different distortions of the same basic shape.
+%
+% For more variation on edge shapes, the inequality can be
+% generalized to
+% $$\label{eq:inside2} +% (1-\alpha(y)) f_1(E(x,g_1(y))) + \alpha(y) f_2(E(x,g_2(y)) \ge y, +%$$
+% where the $\alpha(y)$ parameter specifies interpolation between
+% two different shapes.

\section{Hardware-accelerated implementation}

@@ -579,6 +534,20 @@
We have chosen the latter approach as the more likely one to
yield an acceptable performance. Also, it is easier to avoid
aliasing artifacts in the texture approach..
+
+% This type of mapping is implemented in modern
+% the image of the undistorted shape can be stored in a texture and accessed
+% with texture coordinates offset by (read from) another texture.
+% This is called an offset (dependent) texture access.
+
+The forward function cannot be efficiently implemented on pixel level,
+because each pixel may depend on multiple values of the function.
+The edge of the shape could be displaced on vertex level,
+but that is likely to not yield good performance if the shape has fine detail.
+Furthermore, intersections in the edge may cause additional problems.
+If the function is bijection, so as to avoid any intersections, we
+can just as well use the inverse mapping.

This approach, generating shape through texture, is similar to
the one used by Perlin in \cite{perlin-hypertexture} for synthesizing