Redshift: invert gamma ramps in

Created on 6 Feb 2017  ·  5Comments  ·  Source: jonls/redshift

Hi, I have been trying to invert the gamma ramp on redshift, I edited colorramp.c and negated all the entries in blackbody_color but instead of invert I get a psychedelic flashing multicoloured screen.

I think this is because of a primitive understanding on my part as to how the gamma ramps work, can someone think of a patch?

Many thanks- lynysys.

static const float blackbody_color[] = { -1.00000000, -0.18172716, -0.00000000, /* 1000K */

question

Most helpful comment

It's it the same file you already edited. And yes, inverted colour are like negative photos, however, the maths is a bit more completed. For negative photos the colour 1 − x where x is the real colour and 1 is full brightness. Inverted colours is basically the same, except 0xFFFF is full brightness, and you have to consider all other effects that are applied, the best way to invert the colours without messing up all other effects is to reverse the gamma ramps after all other effects have been applied. If there were no other effects, this with be equivalent to 0xFFFF.

All 5 comments

Instead of −x, use 0xFFFF - y where y is the final values calculated by the program, and you will get an approximate inversion. However, for a proper inversion you should not change those values, but instead of the new gamma ramp has been constructed, reverse its the arrays (f(size − n)).

Edit: I've correct the first part.

At a first look, what you did looks like it should work, however redshift applies gamma, which is an exponential function, and that doesn't work well with negative values.

Thank you for the guidance, which file/function is that in?
I will have a go at hacking the code and maybe I can release a patch with a command line switch to work with a inverted gamma ramp

I hope others would find that useful also.

-----Original Message-----
From: "Mattias Andrée [mˈa.tːiː.ˌas ˈanː.drˌeː]" notifications@github.com
Sent: ‎07/‎02/‎2017 06:34
To: "jonls/redshift" redshift@noreply.github.com
Cc: "lynysys" lynysys@gmail.com; "Author" author@noreply.github.com
Subject: Re: [jonls/redshift] invert gamma ramps in (#434)

Instead of −x, use 1−x and you will get an approximate inversion. However, for a proper inversion you should not change those values, but instead of the new gamma ramp has been constructed, reverse its the arrays (f(size − n)).

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Hi maandree, and also making sure I understand- this is to make the screen inverted color, like an old photo negative?

It's it the same file you already edited. And yes, inverted colour are like negative photos, however, the maths is a bit more completed. For negative photos the colour 1 − x where x is the real colour and 1 is full brightness. Inverted colours is basically the same, except 0xFFFF is full brightness, and you have to consider all other effects that are applied, the best way to invert the colours without messing up all other effects is to reverse the gamma ramps after all other effects have been applied. If there were no other effects, this with be equivalent to 0xFFFF.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

6arms1leg picture 6arms1leg  ·  5Comments

hjweide picture hjweide  ·  4Comments

gamalan picture gamalan  ·  4Comments

xxcriticxx picture xxcriticxx  ·  3Comments

deutrino picture deutrino  ·  6Comments