Glowing Star Demo

This particular demo was made, but never used, in a talk. As such there is more code here than is actually used.

Try experimenting with commenting and uncommenting the various 'draw' functions below to get an idea of how the star is built up.

If you checkout this repo, you can run the demo locally (on mac / linux, slightly more work on Windows...) with:

./mill 'examples.fragment.demos.glowing-star.runGame'

Demo

▶ Click to play
def fragment(color: vec4): vec4 =
  // val circleSDF = sdCircle(env.UV - 0.5f, 0.25f)

  // drawSdfCircle(circleSDF)  // Simple SDF
  // drawSdfCircle2(circleSDF) // Using it as a cos wave

  val starSDF = sdStar5((env.UV - 0.5f) * vec2(1.0f, -1.0f), 0.25f, 0.6f)

  // drawStarStep1(starSDF) // SDF
  // drawStarStep2(starSDF) // Annular
  // drawStarStep3(starSDF) // Glow
  drawStarStep4(starSDF) // Putting it all together in color