Performant transparency when iterating
Posted: Fri Mar 08, 2024 5:44 pm
I use random triggers a lot with iterators, often to randomise the colour across iterations. In this case, I want to use a random trigger to control the transparency of polygons. In Magic there are two ways to add transparency - using a colour node or a transparency node. A colour node requires both brightness and alpha to be adjusted to get a fully transparent element, so the random trigger must be applied to both.
. .
However, there is no way to connect them (that I can think of) and this means that brightness and alpha can be one of four values. 0 brightness and 0 alpha gives full transparency. 1 brightness and 1 alpha gives no transparency. 00 and 11 is what I want, but the random trigger on two separate parameters can also be 01 and 10. .
A shared global won't do, because it won't work with the iterator. A transparency node will, but the iterator makes a copy of the transparency node for each iteration and the frame rate drops quickly. I can have 1000 polys with a colour node but barely 40 with a transparency node before 60fps starts to degrade.
So is there either a performant transparency (for the iterator) with a single param (for the trigger) or is there a way to use a global to connect the two parameters that I've missed?
. .
However, there is no way to connect them (that I can think of) and this means that brightness and alpha can be one of four values. 0 brightness and 0 alpha gives full transparency. 1 brightness and 1 alpha gives no transparency. 00 and 11 is what I want, but the random trigger on two separate parameters can also be 01 and 10. .
A shared global won't do, because it won't work with the iterator. A transparency node will, but the iterator makes a copy of the transparency node for each iteration and the frame rate drops quickly. I can have 1000 polys with a colour node but barely 40 with a transparency node before 60fps starts to degrade.
So is there either a performant transparency (for the iterator) with a single param (for the trigger) or is there a way to use a global to connect the two parameters that I've missed?