[Fluxus] what about procedural textures on fluxus?
Dave Griffiths
dave at pawfal.org
Thu Nov 1 03:58:27 PDT 2007
On Wed, 2007-10-31 at 22:41 -0300, Glauber Alex Dias Prado wrote:
> Hey Dave i was thinking here what about some basic procedural textures
> with fluxus? perhaps something like noise, bands this sort of thing
> extended trough scheme? would be good not to rely on gimp for all sort
> of textures isnt? what do you think about? maybe the glsl shader already
> got everything and my point is missing? I would like to know your ideas
> about it as you certainly has thinked about this a lot, you can answer
> to me on the list if you feel like it.
They are not widely advertised, but you can use pixel-primitives for
this. You'll need to get cvs to run this script as I tried it in the new
style (tm) and had to add pdata-index-map! (and pdata-index-fold) which
supply the pdata element index to the first argument of the procedure:
(clear)
(with-state
;; simple random noise
(with-primitive (build-pixels 100 100)
(pdata-map!
(lambda (colour)
(vector (flxrnd) 0 0 1))
"c")
(pixels-upload))
(translate (vector 1.2 0 0))
;; colourful stripes
(with-primitive (build-pixels 100 100)
(pdata-index-map!
(lambda (index colour)
(vector (/ (modulo index 10) 10)
(/ (modulo index 50) 50)
(/ (modulo index 20) 20) 1))
"c")
(pixels-upload))
(translate (vector 1.2 0 0))
;; b/w stripes
(with-primitive (build-pixels 100 100)
(pdata-index-map!
(lambda (index colour)
(let ((v (floor (/ (modulo index 20) 10))))
(vector v v v 1)))
"c")
(pixels-upload))
)
(translate (vector 0 1.2 0))
(with-state
;; colourful circles
(with-primitive (build-pixels 100 100)
(pdata-index-map!
(lambda (index colour)
(let* ((x (quotient index 100))
(y (remainder index 100))
(d (vdist (vector 50 50 0) (vector x y 0))))
(vector (sin d) (cos d) 1)))
"c")
(pixels-upload))
(translate (vector 1.2 0 0))
;; b/w circles
(with-primitive (build-pixels 100 100)
(pdata-index-map!
(lambda (index colour)
(let* ((x (quotient index 100))
(y (remainder index 100))
(d (vdist (vector 50 50 0) (vector x y 0)))
(v (floor (* 2 (sin (* d 0.3))))))
(vector v v v)))
"c")
(pixels-upload))
(translate (vector 1.2 0 0))
;; psychedelic mess
(with-primitive (build-pixels 100 100)
(pdata-index-map!
(lambda (index colour)
(let* ((x (quotient index 100))
(y (remainder index 100))
(d (vdist (vector 50 50 0) (vector x y 0)))
(r (* (sin d) (cos (* y 0.5))))
(g (* (sin d) (cos (* x 0.3))))
(b (* (sin d) (cos (* y 0.2)))))
(vector r g b)))
"c")
(pixels-upload))
)
More information about the Fluxus
mailing list