HSCB brightness below zero?

Hey there,
today i stumbled upon some funky behaviour of the HSCB node. When going lower then 0.05 of luminance as the clear value in the sceneWindow or the sceneTexture and then feeding back the texture in a loop by additionally going through the HSCB node. It looks like there are values fed back that are lower then zero because it looks clipped as shown in the image


I am not very good with shaders and i didnt completly understand the lower section of the code but i tried to clamp the rgb values and the problem was gone.
This patch describes the problem. You can also find the added lines in there.
HSCBFeedbackProblem.vl (67.8 KB)
I don’t know if this is the right way to do that. Maybe someone can find a better solution when fixing this.
Cheers :D

Hi, @knoeterich

Shaders work with signed values. A negative value is also a value. So if you subtract something in a shader, it will probably not be displayed correctly because positive values are used for display. Negative values are used for calculations.

There are a few ways around this problem, one of which I can think of is to use an additional shader that only performs one operation - saturate(colour). This operation is equivalent to Clamp in maths, but truncates the values to ‘visible’ values.

1 Like