Author Topic: <Solved> Making Opacity an On/Off Binary Switch  (Read 3356 times)

I want to control the VISIBILITY of something in a BINARY fashion.

Currently I'm using a Blend node, and by sliding Opacity from 1 to 0, the item fades away from my substance.


I have successfully exposed the Opacity using the default "float" slider, and it works fine in Substance Play.

I would like the User Control to be a binary thing (True/False), since semi-transparent makes no sense.

EXAMPLE: A coin on the ground.  It is either there or not.  So 30% opacity doesn't make sense.

I was hoping I could just use a "Binary" function in place of the float slider, but no success.  I tried multiplying the binary times a float constant of "1" in the function, hoping that would make the Opacity function happy, but it seemed stuck in the Off position.

I would rather not have to rebuild my graph, so if you can think of a good way to make Opacity behave like a binary switch, I'd love to hear about it.  But if I have to re-think my approach, I'll do what I have to do.
Last Edit: November 10, 2015, 01:36:55 am
Hobbyist
----------
Common "Help" suggestions:
- LOG FILE tips - https://forum.allegorithmic.com/index.php/topic,22451.0.html
- LICENSING issues https://www.allegorithmic.com/contact
- ATTACH files and pictures to posts: https://forum.allegorithmic.com/index.php/topic,23670.0.html

You could expose a Boolean variable named "Visible?" and connect it to an if-else statement, with a 0 float connected to the else and a 1 float connected to the if, then set that as your output for the opacity

Thanks.  I'll give that approach a try (or two) and let you know how it goes.
Hobbyist
----------
Common "Help" suggestions:
- LOG FILE tips - https://forum.allegorithmic.com/index.php/topic,22451.0.html
- LICENSING issues https://www.allegorithmic.com/contact
- ATTACH files and pictures to posts: https://forum.allegorithmic.com/index.php/topic,23670.0.html

Hey justaviking,

this is how it should look like, basically. (Screenshot)
The bool parameter drives the if/else-function.

If the bool parameter is set to true, the if-else will return 1/visible.
If the bool is set to false, the function will return 0/invisible.


Best Regards
Environment Artist - Twitter

I'm getting stuck somewhere in Exposing this properly, I think.

I can expose "Opacity" as a 0-to-1 slider (default situation) and it works fine in Preview Mode, and in Substance Player.

But if I "Clear" or "Empty Function" and then Edit it to put in the Boolean operation, I can't get it Exposed and functioning correctly.

I'll try to browse through some more reading material and YouTube tutorials tomorrow, but if you have any other thoughts, please share.

If a more detailed step-by-step of what I'm doing will help, I can provide that, too.

Thanks for trying to help.  I really appreciate it.
Hobbyist
----------
Common "Help" suggestions:
- LOG FILE tips - https://forum.allegorithmic.com/index.php/topic,22451.0.html
- LICENSING issues https://www.allegorithmic.com/contact
- ATTACH files and pictures to posts: https://forum.allegorithmic.com/index.php/topic,23670.0.html

You could take the route of adding a multi switch node with only 2 inputs, one of which is your effect, the other being a black uniform color node. Perhaps not the optimal approach, but exposing the input selection parameter with a maximum of 2 is pretty much the same as having an On/Off switch.

Hey justaviking,

what I did step by step after opening a new Substance package in Designer:

1. I click on the small plus-button in the graph properties to add a new parameter. (screenshot 1)
2. I edit the parameter so that I get a boolean (screenshot 2)
3. Expose the blend nodes Opacity slider by choosing 'empty function'
4. Edit the function as I've shown in the screenshot above (don't forget that you need to use the 'get boolean' and refer to the just created parameter :))
5. Set the output node correctly by right-clicking the last node and say 'set output'


Best Regards
Last Edit: November 09, 2015, 01:24:50 pm
Environment Artist - Twitter

@cSly,

Thanks for the suggestion.  I was thinking along those lines, too, and was prepared to head down that path in necessary.  I can totally see that being a great option.

@Fabian,

Ah, I suspect it's the "Add New Parameter" step I was missing.

I can't wait to get home from work and try it again, and then, hopefully, report good news.

While editing my function, I noticed sometimes things I'd done before showed up and sometimes not (like input parameters).  When you're stumbling around in the dark, it's hard to remember exactly what you did and connect "cause and effect" correctly.

Lastly, funny you should mention the Set Output step.  I did do it (after a while) on this function, which made me think back to my "$TIME" thread, only to discover Nicolas had already posted the solution.
Hobbyist
----------
Common "Help" suggestions:
- LOG FILE tips - https://forum.allegorithmic.com/index.php/topic,22451.0.html
- LICENSING issues https://www.allegorithmic.com/contact
- ATTACH files and pictures to posts: https://forum.allegorithmic.com/index.php/topic,23670.0.html

SUCCESS!   :)

I might actually have had it working once before, but didn't know it.

Due to my random and similar naming, I might have simply had my function "hidden" in the Preview mode.  In a moment of cleverness, I put my new control in a Group.  I'm sure at least once I overlooked my exposed control, and couldn't figure out why it wasn't show up, assuming I did something wrong in a previous step.  Even tonight I almost missed that the little triangle was pointing to the right instead of downward.  D'oh!   :-[

Feeling brave and encouraged by my success, I tried multiplying my Boolean times "1" but that's a type mismatch.  So then I thought I could simply "Cast" the Boolean to a float, but the Cast node only accepts Integers, not Booleans.  Too bad.

Bottom line... It's working now.  Thanks for the kind and patient guidance.
Last Edit: November 10, 2015, 01:39:25 am
Hobbyist
----------
Common "Help" suggestions:
- LOG FILE tips - https://forum.allegorithmic.com/index.php/topic,22451.0.html
- LICENSING issues https://www.allegorithmic.com/contact
- ATTACH files and pictures to posts: https://forum.allegorithmic.com/index.php/topic,23670.0.html