[Fluxus] pixels-renderer weirdness

Kassen signal.automatique at gmail.com
Mon Jan 31 00:24:45 PST 2011


Hi Gabor,


> this can be done with a shader easily for example by inverting the alpha
> values.
>
>
Cool, going to try this. Shaders are on my "to look into" list.


> i'm not sure how it would work with your method. i would be curious to see.
> other option would be to use stencil buffers, which are especially for these
> kind of things, but we have to implement them in fluxus first :).
>
>
Well, we just do something I'm really good at; completely muck up the
distance to the camera of the objects, then use transparency. Except this
time we do it on purpose ;¬). I knew this "works" as I did it by accident a
few times.

;stand clear; severe abuse ahead.

(clear-colour 0)
(clear)
(reset-camera)
(hint-depth-sort)
(define p (build-pixels 256 256 #t))



(with-pixels-renderer p
    (clear-colour (vector 0 0 0 0)) ;transparency

    (with-primitive (build-plane) ;fake background
        (translate (vector 0 0 -20))
        (scale 60)
        (hint-depth-sort))

    (with-primitive (build-polygons 3 'triangle-list) ;the hole
        (translate (vector 0 0 -21))    ;origin behind the fake background
        (colour (vector 0 0 0 0))
        (pdata-set! "p" 0 (vector -5 0 22))
        (pdata-set! "p" 1 (vector  5 0 22))
        (pdata-set! "p" 2 (vector  0 5 22))
        (hint-depth-sort)
        (recalc-normals 0)))


(with-primitive (build-cube) ;peek a boo
    (colour (vector 0 1 0))
    (translate (vector 0 0 -5)))


This won't fly for (build-cube) and the like as those have their origin in a
sensible spot, but with some work you could probably turn the hole into a
moving outline as well, as long as the origin stays behind the fake
background and the real background is transparent. It'd just mean a whole
lot of pdata-set!, or somehow moving the origin.

Yours,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20110131/598d68aa/attachment.html>


More information about the Fluxus mailing list