kinsi55 / CS_BeatSaber_Camera2

Adds a lot of options / tools for creating more advanced desktop viewing experiences with multiple camera angles and much more in Beat Saber
MIT License
118 stars 13 forks source link

Change the maximum opacity value of Transparency #98

Open rynan4818 opened 1 year ago

rynan4818 commented 1 year ago

Even if I set the 'Transparency Threshold' of 'EFFECTS' to the minimum (0.5), the maximum alpha value is clamped at 0.9. I would like to be able to change the clamp value.

The reason is that we want to display the avatar as an overlay, but it is a bit transparent.

image

The right side shows this clamp replaced with a shader that has been changed to 1.0 https://github.com/kinsi55/CS_BeatSaber_Camera2/blob/aa93200cd4553254958fe8202dc39d7ae65f0ca4/Shaders/LuminanceKey.shader#L55

kinsi55 commented 1 year ago

Hm, I did have some reason before why I clipped it at 0.9... But I dont remember any more. I'll just change it to 1 with the next version

rynan4818 commented 1 year ago

I didn't see any reason to set it to 0.9 either, so if it's fine to set it to 1, that's fine.

kinsi55 commented 1 year ago

Actually, I remembered why I do thave that in there. That statement is only relevant when you do not use the depth buffer - Have you enabled the depth texture for that camera?

rynan4818 commented 1 year ago

image Transparency remains the same whether depth texture is enabled or disabled. The left side is enabled and the right side is disabled.

kinsi55 commented 1 year ago

I suppose the Shaders on your Avatar do not write to the Depthbuffer then. Alright I'll just change the clamp value.

rynan4818 commented 1 year ago

By the way, the avatar display mod we are using is Custom Avatars 5.3.0.

I am very grateful for this feature of Camera2, as it is essential for this kind of overlay display using Custom Avatars.

kinsi55 commented 1 year ago

The problem here is with the specific model that you use not with the Avatar Mod - The Materials / Shaders do not write to the depth buffer, thus Cam2 doesnt properly know which pixels are supposed to be transparent or not, but yeah this issue shouldnt exist anymore when I change the clamp value.

rynan4818 commented 1 year ago

Okay, I understand. I don't know if changing the clamp value has any impact or problem on the others, but I will leave it to you to decide on the modification.