vvvv / VL.StandardLibs

A collection of standard libraries for vvvv including VL.Stride, VL.Skia, VL.ImGui, msgpack.org[VL]
https://visualprogramming.net
GNU Lesser General Public License v3.0
35 stars 14 forks source link

SkiaRenderer: Colors are wrong #623

Closed antongit closed 1 year ago

antongit commented 1 year ago

Describe the bug Colors are rendered not the way they defined. Is it sRGB / RGB troubles?

Which version are you experiencing the bug with? Currently tested in 5.0 preview-700, 0634 - already broken,

Is there an earlier version where this still works? 0566 - colors are correct

To Reproduce SkiaRenderer-ColorBug.zip

Screenshots image

azeno commented 1 year ago

See my comment in code.

joreg commented 1 year ago

see if those can be updated:

azeno commented 1 year ago

Had a look at the above threads: 1) If I setup a Texture manually I can get correct results by specifying _Typeless for the texture and _Srgb for the view. However I don't see any easy way to make this the default for the end-user. These things are setup rather deep down in our nodes and changing those nodes is for sure a bad idea. So maybe waiting on that Skia update is still the best option. 2) Nothing new to report here. 3) That one is solved since the move to ANGLE - it's not about color spaces at all.

I'll also repeat here what I wrote in the latest commit:

// Output looks correct in the following cases:
// - Rendering to swap chain, the render target is non-srgb while the view is srgb
// - Rendering to a typeless texture with a srgb view
// In those cases we can assume the hardware is taking care of interpreting the bits correctly.

// In all other cases we can somewhat "fix" the colors by telling Skia to use a linear colorspace,
// but alpha blending is still somewhat broken leading to wrong output. For example use the "Randomwalk" Skia help patch.

// Blending results are even worse when using a floating point texture. This also seems independent of the used color space.

// TODO: Should we change the default of the RenderTexture node to use a typeless format? Or at least adjust the SkiaTexture node?
// TODO: Re-evaluate this part once Skia has the srgb flags (see comment in https://discourse.vvvv.org/t/combining-stride-and-skia-render-engine/19798/8)