Transparency Issues
I noticed some slight transparency issues when using the new widget components (which are awesome by the way!!)
Blending from a color to full transparency has this muddy in-between color. The yellow background here is the camera background in Unity.
For comparison, here's what it looks like when the yellow background is within the rive file itself:
In addition, there's a slight dark outline around rive graphics with alpha transparency, most visible with a bright object against a bright background. My guess is that this is the same problem as the above interacting with the anti-aliasing.
Thanks for reporting this, we're looking into it internally!
It sounds like the same issue mentioned here. There's a workaround in that thread that you could try in the meantime for the dark outline.
Thanks! Is there any way to apply that legacy shader to the rive canvas object material through a script? Or would I need to render to a texture and then display it manually?
For now, you can create a material that uses the legacy shader, then use GetComponent on the RivePanel to get the CanvasRendererRawImage and apply it directly there.
We're going to expose a way to pass in materials directly in an upcoming release.
When I try running this script, I get an error saying "CanvasRendererRawImage" is inaccessible due to its protection level.
Sorry if I'm missing something obvious, I'm new to Unity!
No worries! If you do transform.GetComponent<RawImage>() instead, does that work for you?
That works, thanks so much! I see now that the transparency issue has to do with pre-multiplied alpha vs straight alpha (same as the current unreal runtime build)
Someone mentioned the same problem in the community here: https://community.rive.app/c/support/color-accuracy-issue-in-unity-if-background-is-transparent-gamma-color-space
Someone mentioned the same problem in the community here: https://community.rive.app/c/support/color-accuracy-issue-in-unity-if-background-is-transparent-gamma-color-space
that's me! thanks for the discussion it helped me fix it, and if you still need to use Linear color space when using Rive, I posted a shader there that can fix this and allow you to use Linear color space, just use UI/Rive Linear instead of the Legacy Shader once you put that shader in your project
I just found out the Rive Canvas Renderer has this Custom Material field which does exactly what the suggestions here tells us to do. So we do not need to add any custom code:
note that if you want to also display it in Editor with the linear space correction you can override the default shader directly in the inspector (debug mode) for the Raw Image ... note that unless you make a small change in the code it will override it if you don't want to switch it again at runtime:
RiveCanvasRenderer.cs line 153: if (DisplayImage != null && m_customMaterial != null)