[Fluxus] pixels-renderer weirdness
gabor papp
gabor.lists at mndl.hu
Sun Jan 30 23:45:11 PST 2011
> Check. Then that covers the blur. Actually, what I thought about here was
> that it could be nice to "poke holes" in solid planes using the pixel
> renderer and getting the silhouette of a model as the "hole". I think I can
this can be done with a shader easily for example by inverting the alpha
values.
(clear)
(define p (build-pixels 256 256 #t))
(with-primitive p (scale 0))
(define hole-vert
"
void main(void)
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
}")
(define hole-frag
"
uniform sampler2D txt;
void main(void)
{
vec4 c = texture2D(txt, gl_TexCoord[0].xy);
gl_FragColor = vec4(vec3(c), 1. - c.a);
}")
(define (animate)
(with-pixels-renderer p
(with-state
(identity)
(clear-colour #(0 0)) ; transparent clear colour
(rotate (vector (* 82 (time))
(* 11 (time))
(* 8 (time))))
(scale 5)
(colour #(1 1)) ; opaque cube
(hint-unlit)
(draw-cube)))
(clear-colour #(0 0 1))
(with-state
(translate #(-.1 .5 -1))
(draw-cube))
; plane with a cube hole using a shader inverting alpha
(with-state
(texture (pixels->texture p))
(shader-source hole-vert hole-frag)
(draw-plane)))
(every-frame (animate))
> do that too already, with a transparent clear colour, a plane to cover it,
> then a object before that plane that has it's origin behind it. That would
> make the transparency go "wrong" which would be exactly what I'd like.
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 :).
best,
gabor
More information about the Fluxus
mailing list