keijiro / NNCam

Virtual background with Unity Barracuda
Apache License 2.0
249 stars 35 forks source link

Compositor shader transparency #11

Closed michaelj909 closed 3 years ago

michaelj909 commented 3 years ago

Hey, thanks for the work you've put into this; it works great!

I've been running a few experiments with the Compositor shader, feeding it backgrounds from a variety of sources (videos, RenderTextures from other cameras, etc) to great effect. I've hit a bit of a wall with transparency, though - I tried to give it a fully transparent image as a background, but the shader just outputs this as black.

I was just wondering if you have any idea why this might be the case, and any if tips for resolving it?

keijiro commented 3 years ago

Could you provide the shader?

michaelj909 commented 3 years ago

Here it is: Compositor.zip

I zipped it up, as github wouldn't accept files with the .shader extension.

It's just the 'Compositor' shader from the 'Room' unity scene, with a slight modification to give a hard edge to the area that's removed. I've tried inputting transparent (and partially transparent), but it doesn't seem to be respecting the transparency of those backgrounds. I'm admittedly a complete novice when it comes to shaders, so hopefully it only requires a trivial change.

Thanks in advance for any help!

keijiro commented 3 years ago

This is not a transparent shader. Setting the Queue and RenderType tags is not enough to make a shader to be transparent.

I'm closing this issue now because the question is not relevant to the project. I'm sorry about it, but please understand that this issue tracker is dedicated to track bugs and technical issues caused in this specific project. I'd recommend using the Unity forum or other similar communities for general questions about shader programming.