/[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.106 by tjl, Sat Nov 30 09:40:12 2002 UTC revision 1.107 by tjl, Sat Nov 30 10:09:19 2002 UTC
# Line 438  translation-invariant. Line 438  translation-invariant.
438  The most obvious choice is to use an offset: if $a(\p)$ is the  The most obvious choice is to use an offset: if $a(\p)$ is the
439  indicator function for the shape $A$, i.e. 1 if $\p$ is inside $A$ and  indicator function for the shape $A$, i.e. 1 if $\p$ is inside $A$ and
440  0 otherwise, then  0 otherwise, then
441  $$  \begin{equation} \label{eqoffset}
442      b(\p) = a(\p + f(\p)).      b(\p) = a(\p + f(\p)).
443  $$  \end{equation}
444  This is the way Perlin\cite{perlin-noise-intro} create marble out of  This is the way Perlin\cite{perlin-noise-intro} create marble out of
445  lines.  lines.
446    
# Line 449  it is based on the points inside $A$, no Line 449  it is based on the points inside $A$, no
449  A different approach is to displace the border of $A$: if $\afunc(t)$ is  A different approach is to displace the border of $A$: if $\afunc(t)$ is
450  the parametrized curve of the border of the original shape,  the parametrized curve of the border of the original shape,
451  then  then
452  $$  \[
453      \bfunc(t) = \afunc(t) + f(\afunc(t)).      \bfunc(t) = \afunc(t) + f(\afunc(t)).
454  $$  \]
455  This technique is commonly called displacement mapping.  This technique is commonly called displacement mapping.
456  There are variations to this such as displacing along the border.  There are variations to this such as displacing along the normal direction.
457    
458  The important point w.r.t.~both of of these common techniques  The important point w.r.t.~both of of these common techniques
459  is that the displacement depends on location in {\em canvas} coordinates,  is that the displacement depends on location in {\em canvas} coordinates,
# Line 536  This is what produces the correct illusi Line 536  This is what produces the correct illusi
536    
537  We shall concentrate on OpenGL and NVIDIA extensions (due  We shall concentrate on OpenGL and NVIDIA extensions (due
538  to their availability in the Linux environment), but  to their availability in the Linux environment), but
539  the feature sets of other APIs and manufacturers  the feature sets of other
540    manufacturers
541    and
542    proprietary APIs
543  are quite similar.  are quite similar.
544    
545  OpenGL allows non-rectangular viewports through the stencil buffer  OpenGL allows non-rectangular viewports through the stencil buffer,
546    which can be used to create the stencil in a first pass
547    by just drawing into the pixels and then in the second pass
548    set to mask only those pixels to be allowed to be drawn that were
549    touched in the first pass.
550    
551  There are two basic alternatives for drawing the shape: either  There are two basic alternatives for drawing the shape: either
552  by using geometry to draw the jagged edge segment by segment,  by using geometry to draw the jagged edge segment by segment,
553  or by using a texture to draw a longer stretch at one time.  or by using a texture to draw a longer stretch at one time.
554  We have chosen the latter approach as the more likely one to  We have chosen the latter approach as the more likely one to
555  yield an acceptable performance. Also, it is easier to avoid  yield an acceptable performance. Also, it is easier to avoid
556  aliasing artifacts in the texture approach..  aliasing artifacts in the texture approach.
   
 % This type of mapping is implemented in modern  
 % texture shading hardware:  
 % 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.  
   
557  This approach, generating shape through texture, is similar to  This approach, generating shape through texture, is similar to
558  the one used by Perlin in \cite{perlin-hypertexture} for synthesizing  the one used by Perlin in \cite{perlin-hypertexture} for synthesizing
559  solid shapes.  solid shapes.
560    
561  In the following, we shall concentrate on drawing one rectangular section  % The forward function cannot be efficiently implemented on pixel level,
562  of the envelope, in the unit square, with $y=0$ inside the tear-out,  % because each pixel may depend on multiple values of the function.
563  $y=1$ outside the tear-out, and $x$ along the length of the envelope.  % The edge of the shape could be displaced on vertex level,
564  It assumed that the canvas location $E(x,y)$  % but that is likely to not yield good performance if the shape has fine detail.
565  depends linearly on the parameters $x$ and $y$  % Furthermore, intersections in the edge may cause additional problems.
566  inside the section of the envelope.  % If the function is bijection, so as to avoid any intersections, we
567  Furthermore, without loss of generality, we assume that $E(x,y) = (x,y)$.  % can just as well use the inverse mapping.
568  At the end of this section, we consider how to use the rectangular  
569  pieces to create a complete tear-out shape.  % In the following, we shall concentrate on drawing one rectangular section
570    % of the envelope, in the unit square, with $y=0$ inside the tear-out,
571    % $y=1$ outside the tear-out, and $x$ along the length of the envelope.
572    % It assumed that the canvas location $E(x,y)$
573    % depends linearly on the parameters $x$ and $y$
574    % inside the section of the envelope.
575    % Furthermore, without loss of generality, we assume that $E(x,y) = (x,y)$.
576    % At the end of this section, we consider how to use the rectangular
577    % pieces to create a complete tear-out shape.
578    
579  \subsection{Drawing the shape}  \subsection{Drawing the shape}
580    
581    The type of offsetting in Eq.(\ref{eqoffset}) is implemented
582    in modern texture shading hardware, such as the NV25 architecture.
583    The image of the undistorted shape can be stored in a texture and accessed
584    with texture coordinates offset by (read from) another texture.
585    This is called an offset (dependent) texture access.
586    
587  The shape is given by Eq.~(\ref{eq:inside}), which under the  The shape is given by Eq.~(\ref{eq:inside}), which under the
588  assumptions can be written as a point $(x,y)$ being inside the tearout,  assumptions can be written as a point $(x,y)$ being inside the tearout,
589  iff  iff

Legend:
Removed from v.1.106  
changed lines
  Added in v.1.107

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