nleseul / obs-shaderfilter

OBS Studio filter for applying an arbitrary shader to a source.
The Unlicense
101 stars 119 forks source link

Unable to change transparency #15

Open Jademalo opened 5 years ago

Jademalo commented 5 years ago

In the past, I've used the drop shadow from this addon frequently.

I recently bought a new PC, and attempted to reconfigure everything. However, changing the transparency of the drop shadow in the colour picker no longer saves correctly. It will always set the value back to 255, which is too dark of a shadow for my liking.

I tried importing my old profiles, and they still worked correctly with the 50% transparency. However, if I opened the colour picker and attempted to change anything, the transparency was set back to 255 every time.

nleseul commented 5 years ago

Reproduced locally on OBS 22.0.2. My guess is that something in OBS's API for color properties changed in the last few versions. I'll investigate. You might check what OBS version your old PC was on, if reverting to that version is a plausible option.

Another workaround would be to manually specify these values in your scene files; I'm guessing it would be handled properly then, since your old files apparently worked fine. Your scenes should be .json files in AppData\Roaming\obs-studio\basic\scenes. Here's an example of the relevant section from one of my scenes:

{
    "deinterlace_field_order": 0,
    "deinterlace_mode": 0,
    "enabled": true,
    "flags": 0,
    "hotkeys": {},
    "id": "shader_filter",
    "mixers": 0,
    "monitoring_type": 0,
    "muted": false,
    "name": "Drop shadow",
    "private_settings": {},
    "push-to-mute": false,
    "push-to-mute-delay": 0,
    "push-to-talk": false,
    "push-to-talk-delay": 0,
    "settings": {
        "expand_right": 5,
        "from_file": true,
        "is_alpha_premultiplied": false,
        "shader_file_name": "C:/Program Files (x86)/obs-studio/data/obs-plugins/obs-shaderfilter/examples/drop_shadow.shader",
        "shadow_blur_size": 5,
        "shadow_color": 4278190080,
        "shadow_offset_x": 3,
        "shadow_offset_y": 2
    },
    "sync": 0,
    "volume": 1.0
},

JSON isn't the easiest format to search through, sadly, but hopefully you can find something similar by looking for the names of your sources and filters.

The important thing here is the "shadow_color" property, which is set to 4278190080. That's 0xff000000 in hex, i.e., black with full alpha. You'd have to do some ugly hex conversion, but you could manually change the value in the JSON to 2147483648 (= 0x80000000 in hex) to change it to half alpha.

Jademalo commented 5 years ago

Alright, good to know it's reproducable! I should be fine reconfiguring the scene files, since it only breaks if I open the colour picker.

Unfortunately I can't check my old PC's version, since the reason I got a new one was due to an HDD crash. I was able to salvage AppData, but the drive gave out before I got anything else :(

nleseul commented 5 years ago

Found it. Looks like transparency wasn't meant to be supported in OBS's properties and was intentionally disabled as of 22.0.3. obsproject/obs-studio@78d566916bfd9847e8777a031f590106de17aa36.

Jademalo commented 5 years ago

Aaah, well spotted!

In that case, is there any way to implement transparency in the drop shadow filter as a separate slider?