Dear list,<br><br>I'm still having a few problems with particles, transparency and depth. The code below represents a field with a cube (for scale) and a random amount of clouds. This is supposed to be joined with my "teach myself Fluxus by building a village" project, to explain the colours and theme. Some of the previous steps are in this album;<br>
<span><a href="http://www.facebook.com/album.php?aid=2001396&id=1391163181&l=f8f7ecc07a">http://www.facebook.com/album.php?aid=2001396&id=1391163181&l=f8f7ecc07a</a><br>(I think that should be visible to non-FB-users)<br>
</span><br>So far I set the clouds, which are particle primitives, to depth-sort which avoided glitches. When I made a "place clouds" function with random placements it turned out that there were still glitches when one cloud was place more or less on top of another. I fixed that with a hint-ignore-depth inside of the place-clouds function... this made the glitches there go away but created a new issue of all of the clouds being visible from through the plane/field and the house/cube. By now I was getting the hang of it so I placed some depth-sort hints outside of the build-clouds scope again. This brings us to the current situation. As it is it mostly works in a mostly correct way and often even looks good; I've seen worse in some games, I think. However now the clouds don't always disappear when the plane should obscure them, they are seen through the plane until some point where they suddenly blink out of sight. <br>
<br>What would be the proper way to address this? Is this some fundamental limitation to particles or am I doing something wrong? I think I could live with the current situation but I'd rather see it behave 100% correctly.<br>
<br>Yours,<br>Kas.<br><br><br>(clear-colour (vector 0 0 .9))<br>(clear-texture-cache)<br>(hint-depth-sort)<br>(clear)<br><br><br><br>(with-primitive (build-plane)<br>    (scale  30)<br>    (hint-depth-sort)<br>    (colour (vector 0 .9 0)))<br>
<br>(with-primitive (build-cube)<br>    (translate (vector 0 0 .5)))<br><br>(define (build-cloud)<br>    ( let ((x 0))<br>    (with-state<br>    <br>    (hint-depth-sort)<br><br>;================<br>;see attachment for this file<br>
<br>    (texture (load-texture "/home/ghost/Fluxus/experiment1/cloud.png")) <br>    (with-primitive <br>        (build-particles (floor (+ 6 (* (rndf) 8)))) <br>            (pdata-index-map! (lambda (index c) 1) "c")<br>
            (pdata-index-map! (lambda (index s) (+ (* (rndf) .2 )(- (/ (pdata-size) 2 ) (abs (- (/ (pdata-size) 2) index ))) .7)  ) "s")<br>            (pdata-index-map! (lambda (index p) (set! x (+ x (* .25 (- (/ (pdata-size) 2 ) (abs (- (/ (pdata-size) 2) index )))))) (vector <br>
                                        (+ x (* (grndf) .3))<br>                                        (* .4 (rndf) (- (/ (pdata-size) 2 ) (abs (- (/ (pdata-size) 2) index ))))<br>                                        (* .15 (rndf))<br>
                                    ) ) "p")<br>           (translate (vector (- 0 (* .5 x)) 0 0))<br>        ))))<br><br><br>(define (place-clouds n)<br>    (cond<br>        ((not (zero? n))<br>    (with-state<br>
        (hint-ignore-depth)<br>        (identity)<br>        (translate (vector ( * 15 (crndf)) ( * 15 (crndf)) (+ 8 (* 4 (rndf)))))<br>        (build-cloud)<br>    (place-clouds (- n 1))))))<br><br><br>(place-clouds (floor (* 8 (rndf) ) ))<br>