Skip to content

Commit

Permalink
Ratio interval half way 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenCiao committed Sep 3, 2024
1 parent a200a65 commit 1dadc5e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
6 changes: 3 additions & 3 deletions docs/Basics/Stamp/Stamp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ $L$ is the length of the current edge.
By replacing $r(x)$, we get a quadratic equation $ax^2 + bx + c = 0$:

$$
\begin{align}
\begin{aligned}
a &= 1 - \cos^2\theta \\
b &= - 2(r_0\cos\theta + x_p) \\
b &= 2(r_0\cos\theta - x_p) \\
c &= x_p^2 + y_p^2 - r_0^2
\end{align}
\end{aligned}
$$

Remind that $\cos\theta = (r_0 - r_1)/L$.
Expand Down
13 changes: 7 additions & 6 deletions docs/Basics/Stamp/stampRound.frag
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ void main() {
x2 = temp.y;

// With the distance to the polyline's first vertex, we can compute a "stamp index" value.
// which indicate the number of stamp from the first vertex.
float index0 = l0/interval; // The stamp index of vertex0.
float startIndex, endIndex; // The stamp index's begin and end integral values
startIndex = x1 < 0.0 ? ceil(index0):ceil(index0 + x1/interval); // if x1 is less than zero, start the loop from vertex0.
// which indicate the number of stamp from the first vertex to current point.
float index0 = l0/interval; // The stamp index at vertex0.
float startIndex, endIndex; // The stamp index's begin and end values
float x1Index = index0 + x1/interval; // The stamp index at x1.
startIndex = x1 < 0.0 ? ceil(index0):ceil(x1Index); // if x1 is less than zero, start the loop from vertex0.
float index1 = l1/interval;
float backIndex = x2/interval + index0;
endIndex = index1 < backIndex ? index1 : backIndex; // if x2 is larger than L, end the loop at vertex1.
float x2Index = x2/interval + index0;
endIndex = x2 > len ? index1 : x2Index; // if x2 is larger than L, end the loop at vertex1.
if(startIndex > endIndex) discard;

// The main loop to sample and blend color from the footprint, from `startIndex` to `endIndex`
Expand Down
13 changes: 0 additions & 13 deletions docs/Introduction/Introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,6 @@ SIGGRAPH 2023 Talk
}
```

:::note Research Tip

To demonstrate your research work about brush rendering, select vector drawings have variable radius or pen pressure data.
Regular vector graphics datasets don't contain them.

- OpenSketch: [Paper](https://dl.acm.org/doi/10.1145/3355089.3356533)
- [Tracing versus freehand](https://zachzeyuwang.github.io/tracing-vs-freehand.html)
- [DifferSketching](https://chufengxiao.github.io/DifferSketching/)
- [Blender Grease Pencil](https://cloud.blender.org/p/gallery/5b642e25bf419c1042056fc6)
- ... Tell me more in the [discussion](https://github.com/ShenCiao/brush-rendering-tutorial/discussions/1).

:::

[code repository]: https://github.com/ShenCiao/brush-rendering-tutorial
[Ciallo]: https://github.com/ShenCiao/Ciallo
[_The Book of Shader_]: https://thebookofshaders.com/

0 comments on commit 1dadc5e

Please sign in to comment.