Karan -

i don't know why i bother to email my questions to the list instead of directly to you :) thanks for all your quick answers to my newbie questions.

the thought had occurred to me to try swapping the rendering "layer" that each candle was on based on its Z coordinate, but that's not possible, or so i have been led to believe. i had not thought to duplicate everything and enable/disable. it's a little disheartening to know that this is necessary, as my original thought on this project (a prettified CPU meter) was to be able to scale to 8 processors...

oh well.





  charles mangin | Alpha Geek and Chief Mental Hygienist
  [EMAIL PROTECTED]
  http://mentalhygiene.com


On Jan 11, 2008, at 6:45 PM, Karan Lyons wrote:

Here's your composition (I didn't realize you had attached one, sorry!) with my alpha fix inserted. Hopefully it should make sense (there's some comments in the javascript patch) but if not, feel free to send me any questions. Here's how it works: The javascript patch takes the z position of both candles, and figures out which candle has a higher z position, therefore being in front. Now the sprite in the front has to be at a higher layer than the sprite in the back, or rendering issues will occur (although they're not really /issues/). So it takes this data and turns sprites on and off for this to happen. Here's what it does:

Candle 1 Sprite Layers:         1       4
Candle 2 Sprite Layers:         2       3

If Candle 1 is in front:        0       1
                                1       0

If Candle 2 is in front:        1       0
                                0       1

0 is off, 1 is on.

This can be expanded to a virtually infinite number of sprites (all depends on your hardware) and doesn't use any other patches besides the ones Quartz Composer has built in. I think it's a good solution, but depending on what you're trying to do, your mileage may vary. For instance, you'd have to set a preset limit on the number of candles that can be used, since you can't use the iterator patch to replicate the sprites in the proper order, or set the javascript patch to automatically increase it's number of inputs and outputs. Also, if you rotate these patches in 3D space, the alpha problem comes back again, although this can easily be remedied by having two 3D patches, one with the sprites in the inverse order, and a quick rotation check to turn the right one on and off. But it should work in most cases. And if you want to see this expanded to three sprites, that version has been attached in a previous email in this thread.
        Good luck!<rotating candles fixed.qtz>
Namaste,
Karan
Karan "The Architect" Lyons: Web Design & Development at Geek Ramblings | Student | Omnigeek contact | email: [EMAIL PROTECTED]| cell: 857-544-9527 | skype: taoofkaran | aim: taoofkaran



On Jan 11, 2008, at 1:41 PM, Charles Mangin wrote:

this may be a newbie question, but what exactly is going on in this composition?

<rotating candles.qtz>

i have two sprites rotating in space, and they're stacking nicely - one sprite is clearly in front, and shows the one behind through its transparent parts. the other one, though, is on a higher rendering layer, and doesn't show the other sprite through its transparent parts.

i imagine i'm missing something fundamental about "depth testing" and sprites, but i've played around a bit and haven't found a magic bullet yet.

any help from the more advanced would be greatly appreciated.

note: i'm running Tiger.




charles mangin | Alpha Geek and Chief Mental Hygienist
[EMAIL PROTECTED]
http://mentalhygiene.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (Quartzcomposer- [EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/karan% 40geekramblings.com

This email sent to [EMAIL PROTECTED]


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to