Page 1 of 1

How to create a panel light with switches on top

Posted: Tue Feb 02, 2021 9:52 am
by freedom
I have been trying to create a night panel using a black mask for dimming and light mask for lighted texts but in vane. The layers are as follows:

Light texture
----------------
Black mask
----------------
Switches graphics
----------------
Panel graphics

How would you make it work properly so that when the panel is dimmed, all the switches are dimmed as well but the light texture will not mask the switches (which move depending on positions)

Help is deeply appreciated thanks!

Freedom

Re: How to create a panel light with switches on top

Posted: Sun Feb 13, 2022 9:23 am
by astroseus
Hi,

I would like to offer my assistance if it's purely graphics that you're struggling with.
The coding part, I'm struggling with myself unfortunately.
However, I fail to understand what the problem is you're having.
Can you explain a little bit with images what you're trying to do and where the blocker is.

Thanks
P.

Re: How to create a panel light with switches on top

Posted: Sun Feb 13, 2022 7:08 pm
by JackZ
Hi

The easiest way is to create "holes" in your light and black masks where you want the underlying masks to show thru. This using boolean operations in Skinman.
Could you post here the 4 masks png resources?

Jacques

Re: How to create a panel light with switches on top

Posted: Mon Feb 14, 2022 2:44 am
by freedom
Thx, here are my graphics, not sure if there is a better way to do it though.

I have a basic panel
panel.png
A backlight texture
panel_bl.png
I have a 3 pos switch
ldg_sw_down.png
ldg_sw_down.png (11.2 KiB) Viewed 3092 times
ldg_sw_mid.png
ldg_sw_mid.png (11 KiB) Viewed 3092 times
ldg_sw_up.png
ldg_sw_up.png (11.4 KiB) Viewed 3092 times
Plus a 1x1 black pixel as a dimming mask

How would you mask the switches? Do you need 3 individual masks?

Re: How to create a panel light with switches on top

Posted: Sun Feb 20, 2022 10:18 am
by JackZ
Hi

The problem is in the 1x1 dimming mask.
It should instead be a full sized black mask with « holes » in it at the switches locations so this part is not dimmed.
And switches graphics should be located on the very top layer, (in reality, declared further down in the Lua code) since the switches are not lighted nor affected by the black mask itself
The switches should contain the graphics of the lever only, not the casing which is normally dimmed as well and should be in the main panel..

As per the switches, I think the shadow should be mirrored vertically, as the shadow being ABOVE the switches make them weird

Re: How to create a panel light with switches on top

Posted: Sun Feb 20, 2022 12:29 pm
by JackZ
There you go.
In your sample, the lighted text are not exactly flush with the panel text.
image.png
use this mask and play with the opacity() function to achieve the desired result
black_mask.png
black_mask.png (3.41 KiB) Viewed 2983 times
If you want more sophisticated effects, you'll have to create three separate images of the switch which have been darkened, and add a second set of switch as an overlay, with no action.
, like this one:
image.png
image.png (17.09 KiB) Viewed 2981 times
which yields the following result:
image.png
Then move both switches (the day and the night version) simultaneously using switch_set_position() in the callback function of the switch.
Then play with the opacity() function for the darkened switch according to the current lighting condition
image.png
Jacques