livekit / client-sdk-unity-web

Official LiveKit SDK for Unity WebGL
https://livekit.io
Apache License 2.0
54 stars 20 forks source link

Sharing screen seems to be a bit washed out #53

Open peca123 opened 11 months ago

peca123 commented 11 months ago

Describe the bug Hey there!

When sharing screen in Unity, it appears a bit washed out, is it supposed to be like this, or could this be changed/ configured? This is not the case for camera sharing, camera sharing's colors are true and vivid.

Thanks in advance! :)

Client

To Reproduce Steps to reproduce the behavior:

  1. A client is connected to the room
  2. A clients starts sharing screen by creating a streaming track
  3. Shared screen is a bit washed out (paler than expected)

Expected behavior Screen share's colors should be true just like share webcam's

Screenshots livekit-washout

277861535 commented 4 months ago

I also encountered the same problem. Have you solved it

peca123 commented 4 months ago

Hey there! Yes, after a lot of research, I determined the reason behind this is because I was using Linear color space instead of gamma, for which livekit unity sdk is made. Colors can be converted between gamma and linear color spaces, so a solution for me was making a very simple shader for live kit, and use it for every material on objects I want live kit on. The only thing shader does is color power 2.2 (that's the formula for converting gamma > linear) when streaming is happening (if you need it reverted to static regular image, revert the pow to 1). This has proven to work like a charm, if you need any more insight into this, feel free to ask :)