Draw Strokes in Sky Rendering in GLSL
- Pass a list of strokes to the shader as an array
- For each fragment, compute its stroke force by:
- Transform the fragment coordinate to the stroke coordinate system (similar to uv space in texture mapping)
- Find the strokes the fragment belongs to
- For each stroke the fragment belongs to:
- Compute the fragment’s distance to the main stroke
- If the distance is within certain threshold of the width of the main stroke, randomize the fragment’s stroke force. Otherwise, the fragment doesn’t have stoke force.
- Accumulate the stroke force of current stroke to the fragment’s stroke force.
Transform the fragment coordinate to the stroke coordinate system (similar to uv system)