Had a bit of time to spare. Should have cleaned up my room or done
laundry, instead I made a simple study on (scale -1) and using the
combination of colours that go over 1 and lighting to get colour
ranges as the number gets clipped for brighter sections. Well, it does
on my video-card, not sure that is defined behaviour :-)

This last bit becomes more clear by switching the relevant line to
(colour (vector 2 0 1)). I believe that for perfectly lit sections
this get clamped to (vector 1 0 1) and for half-lit sections it would
become (vector 1 0 .5), which is clearly not just more dim but also
more red. I seem to remember Gabor commenting on colours working in a
slightly different way, leading me to suspect that the results of this
depends on your card.

Copy/remix/extend/destroy/use as you see fit.

Yours,
Kas.

(clear)

(define rot (vector 0 0 0))

(define block
     (let ((b (build-cube)))
         (with-primitive b (recalc-normals 1))
         b))

(define (ani)
     (set! rot (vadd rot (vmul (vector 30 35 40) (delta))))
     (let* ((P1 (vmul (vector
                         (* (sin (* (time) 3)))
                         (* (sin (* (time) 4)))
                         (* (sin (* (time) 5)))) 2))
             (P2 (vector (vector-ref P1 1) (vector-ref P1 2) (vector-ref P1 
0))))
         (with-state
             (colour (vector (+ 1 (cos (time))) 0 1))
             (rotate rot)
             (for* ((x (in-range -3 4)) (y (in-range -3 4))(z (in-range -3 4)))
                 (when
                     (<
                         (vdist (vector x y z) P1)
                         (+ 1 (abs (* 3 (sin (time))))))
                     (with-state
                         (translate (vector x y z))
                         (scale (if (< 1.5 (vdist (vector x y z) P2)) -1 1))
                         (hint-wire) (wire-colour 0) (line-width 2)
                         (draw-instance block)))))))

(every-frame
     (ani))
Very nice effect! There is some glitchs with too close faces. Apart from that, it render beautyful.

Reply via email to