Previous topicNext topic

Transparency vs Opacity

Questions, comments, feedback, etc.
Post Reply
blackdot
Posts: 528
Joined: Sun Jul 06, 2014 10:18 pm

Transparency vs Opacity

Post by blackdot »

I noticed the Transparency module under Effects2D>Transparency. How does it compare to the customGLSL shader "Opacity" from the tutorials forum? Is the behaviour the same, and if so, which one is recommended to use?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Transparency vs Opacity

Post by Magic »

They are exactly the same, but opposite :). So transparency of 0 is the same as opacity of 1. Whichever one is more convenient.

However, I *highly* recommend you instead use one of the ColorRGB/HSB modules, when you can. They use much less fps. I only added the opacity/transparency options because they are less complicated to understand at first.

This post briefly shows how to do it (in terms of Transparency vs. ColorHSB): viewtopic.php?f=2&t=403#p1721

Depending on how you're going to use it, you may also want to invert the parameter value: viewtopic.php?f=3&t=11
blackdot
Posts: 528
Joined: Sun Jul 06, 2014 10:18 pm

Re: Transparency vs Opacity

Post by blackdot »

ah, im using an -1 multiply and +1 offset to invert the behaviours. Also to get stuff transparent with the colorhsb module you have to turn down alpha *and* brightness, so two things. Using opacity or transparency seemed more easy because of that :). but ok, color modules it is.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Transparency vs Opacity

Post by Magic »

Also to get stuff transparent with the colorhsb module you have to turn down alpha *and* brightness, so two things. Using opacity or transparency seemed more easy because of that :)
Yup that's exactly why I added Opacity/Transparency -- one thing instead of two. But the ColorHSB module will use much less fps if you have the patience to do the two things :).
blackdot
Posts: 528
Joined: Sun Jul 06, 2014 10:18 pm

Re: Transparency vs Opacity

Post by blackdot »

would be cool if we could hook multiple rgb or hsv's behind each other. eg. for when i want do manually "blend in" (meaning make opaque) an object, which itself is changing its visibility according to the music.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Transparency vs Opacity

Post by Magic »

Unfortunately, just because of the way color works in OpenGL, setting a color and then setting it again doesn't alter the output color using both adjustments. Only the first (most recently) set color is respected. You can think of the ColorRGB/HSB modules as picking the "paintbrush" color, rather than actually adjusting the image. Kind of like clicking on the color swatch in Photoshop or something. It makes it a bit easier to understand why setting the color twice in a row doesn't actually work like one might think. Also it helps explain why using a Color module is faster for color/brightness/transparency adjustments, since you're not actually adjusting all the pixels of the image, but only the things that are being drawn.

To do what you're looking for you'd have to use Opacity or Transparency for any additional visibility adjustments beyond the first ColorRGB/HSB module.

Does that make sense? I guess maybe it's a bit technical.
blackdot
Posts: 528
Joined: Sun Jul 06, 2014 10:18 pm

Re: Transparency vs Opacity

Post by blackdot »

no it does make sense. i also had succes by using one of the colour manipulating ISF's. i guess they're like a filter on the pixel while your modules set kinda like a color parameter?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Transparency vs Opacity

Post by Magic »

Yup exactly. Opacity and Transparency filter the whole image like any other effect, so there's all the overhead of doing an effect (capturing the image, applying the effect to every pixel, drawing the finished image). As opposed to just setting the color of things, which has much less overhead.
blackdot
Posts: 528
Joined: Sun Jul 06, 2014 10:18 pm

Re: Transparency vs Opacity

Post by blackdot »

There's no "Opacity" parameter native to openGL i assume :). Anyways, thanks for the clarification.
blackdot
Posts: 528
Joined: Sun Jul 06, 2014 10:18 pm

Re: Transparency vs Opacity

Post by blackdot »

Would it be possible to have these openGL parameter still influence each other to determine the final operator value? eg. if i have colorHSB with brightness and alpha 1, and then a colorHSB with bright and alpha 0 and they get multiplied so the first one would be 0 too? or is that not possible because of the way magic works and the modules have no idea what the other modules are doing (as you explained in another thread iirc)?
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Transparency vs Opacity

Post by Magic »

It could theoretically be possible to track the current color in the built-in Magic modules, but the problem is that any other third-party modules (FFGL, MDK, ISF) wouldn't know to respect the color state.

Any other method besides that would be inefficient because the graphics card would have to be queried directly, and it would slow all the modules down.

I can't think of any other way to do it at the moment, but I will certainly keep it in mind.
Post Reply