300 |
again using a function $f(p)$ of location $p$, a given point is {\em inside} the curve, |
again using a function $f(p)$ of location $p$, a given point is {\em inside} the curve, |
301 |
iff $f(p) < |p - n_C(p)|$, where $n_C(p)$ is the nearest point to $p$ on the curve $C$. |
iff $f(p) < |p - n_C(p)|$, where $n_C(p)$ is the nearest point to $p$ on the curve $C$. |
302 |
|
|
303 |
|
% XXX: the irregu_gears.jpeg issue should be addressed here, i.e., the shape |
304 |
|
% of the torn edge should ideally not depend on normal in/out direction. |
305 |
|
|
306 |
Although these algorithms seem different and produce different results, there is |
Although these algorithms seem different and produce different results, there is |
307 |
actually a reasonable generalization which yields to a visual explanation. |
actually a reasonable generalization which yields to a visual explanation. |
308 |
Both algorithms can be represented as a point being inside the final curve if |
Both algorithms can be represented as a point being inside the final curve if |
318 |
parametrized by $\alpha$ |
parametrized by $\alpha$ |
319 |
with usually $0 \le \alpha \le 1$. |
with usually $0 \le \alpha \le 1$. |
320 |
|
|
321 |
|
% \alpha = 1 corresponds to projecting the cutting plane to the paper |
322 |
|
% \alpha \ne 1 requires stretching the cutting plane before projection |
323 |
|
% with stretch factor 1 / \alpha (i.e, \infty for \alpha = 0) |
324 |
|
|
325 |
A suitable choice for $f$ would be |
A suitable choice for $f$ would be |
326 |
a function with noise at different frequencies, but with lower frequencies |
a function with noise at different frequencies, but with lower frequencies |
327 |
emphasized more, such as turbulence\cite{perlin-noise-intro}. |
emphasized more, such as turbulence\cite{perlin-noise-intro}. |
435 |
|
|
436 |
Image-space algorithm: ... slow on NV10 |
Image-space algorithm: ... slow on NV10 |
437 |
|
|
438 |
\subsubsection{Mutltitexture/access} |
\subsubsection{Mutltitexture} |
439 |
|
|
440 |
Similar to image-space algorithms: values of surrounding fragments |
Similar to multi-pass perturbed edge: values of surrounding fragments |
441 |
computed in parallel for each fragment. |
computed in parallel for each fragment. |
442 |
|
With four texture units, it is possible to do the texture accesses |
443 |
|
corresponding to four different perturbed edges for each fragment |
444 |
|
and use GL\_NV\_register\_combiners to determine if any of them |
445 |
|
is inside the torn edge. |
446 |
|
|
447 |
Attached edges: texture coordinates do not change along a |
Attached edges: texture coordinates do not change along a |
448 |
normal of the tearing line. |
normal of the tearing line. |
453 |
from the tearing line. |
from the tearing line. |
454 |
A fragment is inside the outer edge, if its distance from |
A fragment is inside the outer edge, if its distance from |
455 |
any of the adjacent inner edge points is less than the line width. |
any of the adjacent inner edge points is less than the line width. |
456 |
This computation can be carried out using GL\_NV\_register\_combiners |
This computation can be carried out using GL\_NV\_register\_combiners. |
457 |
or with an NV30 fragment program. |
|
458 |
Also, with NV30, a single texture unit can be accessed multiple |
With NV30, a single texture unit can be accessed multiple |
459 |
times with displaced texture coordinates computed in the program. |
times with displaced texture coordinates computed in a fragment program. |
|
|
|
|
For sprinkled edges, one-dimensional displacements of the |
|
|
texture coordinates are not enough, because the texture slice |
|
|
mapped on the edge is two-dimensional. |
|
|
Most OpenGL hardware do not have enough texture units for this, |
|
|
but with NV30, one could compute |
|
|
XXX pixel and four surrounding pixels. |
|
460 |
|
|
461 |
\subsubsection{Optimizations} |
\subsubsection{Optimizations} |
462 |
|
|