Skip to content

Commit

Permalink
use an inverse-smoothstep to put more samples in center than edges
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Nov 13, 2024
1 parent 7204e2e commit f545958
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/shimmers/math/equations.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,6 @@

(comment
(map (fn [x] [x (flatstep x 1.2)]) (range 0 1 0.1)))

(defn inv-smoothstep [x]
(- 0.5 (math/sin (/ (math/asin (- 1.0 (* 2.0 x))) 3.0))))
8 changes: 6 additions & 2 deletions src/shimmers/sketches/cilia_phase.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
(+ 0.025 (eq/gaussian amp 0.5 -0.125 y)))
:pts
[(dr/weighted {:equal 1.0
:gaussian 1.0})
:gaussian 1.0
:inv-smooth 1.0})
(dr/weighted {150 1.0 200 5.0 250 4.0
300 2.0 400 0.75 600 0.25})]
:phase
Expand Down Expand Up @@ -136,7 +137,10 @@
:equal (range -0.05 1.05 (/ 1.0 density))
:gaussian
(dr/gaussian-range (/ 1.0 density) (/ 1.0 (eq/sqr density))
true [-0.05 1.05]))
true [-0.05 1.05])
:inv-smooth
(for [x (tm/norm-range density)]
(eq/inv-smoothstep x)))
cilia
(cilias {:samples samples
:screen-space screen
Expand Down

0 comments on commit f545958

Please sign in to comment.