Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Custom Compiz color filter

  1. #11
    Join Date
    Oct 2010
    Beans
    1

    Re: Custom Compiz color filter

    Quote Originally Posted by yahooshua View Post
    Wow, the documentation on this is intense.
    I am not sure if this coincides with night vision BUT when blue light hits your eyes it basically tells your brain not to produce melatonin. I have been using blue blockers sunglasses (remember those?) at night to use my computer to not mess up my sleep. The white in the text using the above filters has to much blue light in the white.
    Exactly! I need it for the same purpose as you!

    I experimented a bit, and here it is:

    !!ARBfp1.0
    TEMP tex, temp;
    TEX tex, fragment.texcoord[0], texture[0], RECT;
    DP3 temp.r, tex, {0.9, 0, 0, 0};
    DP3 temp.g, tex, {0, 0.9, 0, 0};
    DP3 temp.b, tex, {0, 0, 0, 0};
    MOV temp.a, tex.a;
    MOV result.color, temp;
    END
    Melatonin, you can come!

  2. #12
    Join Date
    Jan 2011
    Beans
    2

    Re: Custom Compiz color filter

    Is there a way to conditionally use a negative filtered color only if the overall light intensity is lower than the original one?

    The Problem


    With a dark color scheme, the dark areas (which would be quite OK as they are...) becomes incredibly bright.
    This is a nightmare for working up late at night.

    Shader Assembly Language (ARB/NV)
    I've found this link as a reference for creating filters: http://www.renderguild.com/gpuguide.pdf

    ...but I really can't get mine working.

    Possible solutions could involve:
    Code:
    Instruction   Output  Input     Description 
    -----------   -----  ------     -----------
    LIT           v       v         compute light coefficients
    SGE           v       v,v       set on greater than or equal
    SLT           v       v,v       set on less than
    MAX           v       v,v       maximum 
    MIN           v       v,v       minimu
    I'll try again but if anyone else comes up with a viable solution... well... post it here please (maybe with screenshots too)

  3. #13
    Join Date
    Jan 2011
    Beans
    2

    Re: Custom Compiz color filter

    Haven't found a solution yet.
    Has anyone else tried to solve the issue?

  4. #14
    Join Date
    Apr 2011
    Beans
    22
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Custom Compiz color filter

    Thank you!

    I'm working on a skin filter, to make skin only turn inverted.

    Edit: after alot a work, i found that inverting skin would ruin some text with anti alias.
    so instead I made skin gray. you can find the filter here:

    http://malefreedom.blogspot.com/2011...inux-beta.html

    Quote Originally Posted by t1010011 View Post
    Never mind solved adding to startup a scrip with the following code

    Code:
    #!/bin/bash
    
    sleep 20s && dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/colorfilter/allscreens/toggle_screen_key org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4}'` &
    I'm working with a fake RGBA color filter:
    Code:
    !!ARBfp1.0
    TEMP texv, rep;
    TEX texv, fragment.texcoord[0], texture[0], RECT;
    MOV rep, {0.196078431, 0.196078431, 0.192156863};
    SUB rep, rep, texv;
    ABS rep, rep;
    MAX rep.b, rep.b, rep.r;
    MAX rep.b, rep.b, rep.g;
    SUB rep.b, rep.b, 0.0001;
    CMP rep.b, rep.b, 0.9, 1;
    MUL texv, texv, rep.b;
    MOV result.color, texv;
    END
    but I'd like to filter more than 1 color... Is there a way to load more than one filter at once in colorfilter? Or anyone knows how to change the code above to add more colors?
    Last edited by oldarney; July 15th, 2011 at 10:58 AM.

  5. #15
    Join Date
    Apr 2011
    Beans
    22
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Custom Compiz color filter

    Quote Originally Posted by Michl0x07 View Post
    Exactly! I need it for the same purpose as you!

    Melatonin, you can come!
    I love the way you are thinking, however, that filter makes everything yellow lol.
    Here is one that turns 85% of blue into other colors.

    Code:
    !!ARBfp1.0
    TEMP tex, temp;
    TEX tex, fragment.texcoord[0], texture[0], RECT;
    DP3 temp.r, tex, {1, 0, 0, 0};
    DP3 temp.g, tex, {0, 1, 0, 0};
    DP3 temp.b, tex, {0.425, 0.425, 0.15, 0};
    MOV temp.a, tex.a;
    MOV result.color, temp;
    END
    I also made the oposite, which makes every color bluer, except white. Its like sephia,
    but for blue, and leaves colors.

    Code:
    !!ARBfp1.0
    TEMP tex, temp;
    TEX tex, fragment.texcoord[0], texture[0], RECT;
    DP3 temp.r, tex, {1, 0, 0, 0};
    DP3 temp.g, tex, {0, 1, 0, 0};
    DP3 temp.b, tex, {0.5, 0.5, 1, 0};
    MIN temp.b, temp.b, 1;
    MOV temp.a, tex.a;
    MOV result.color, temp;
    END
    Last edited by oldarney; July 15th, 2011 at 06:15 AM.

  6. #16
    Join Date
    Jun 2008
    Location
    Russia
    Beans
    42
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Custom Compiz color filter

    Quote Originally Posted by lian1238 View Post
    and maybe that's just me
    You're not alone! I was search for exactly this filter for many years. And now, using your solution, i can write big, bold and embossed final point in my journey. Armed with your code, i'm able now fight any non-human-friendly software like most professional CADs and development systems. I was use 'invert' plugin before, but it damage colours.
    The only problem i found in your code (i mean first original code) is the colors not so intensive as must be. (But, it is *much* better than wrong colours). Ideally, we must invert image and then turn *hue* value by 180 degrees to get precisely correct colours, please see screenshots here.

    Thank you very much for your work and for saving people's eyes! You rock!

  7. #17
    Join Date
    Aug 2011
    Beans
    2

    Re: Custom Compiz color filter

    Hi,

    I've recently been diagnosed with irlen syndrome, a sensitivity to certain wavelengths of light that makes reading very difficult. I'd like to make a color filter that changes the white to a light blue color. I'm not a programmer and so this along with my condition is making learning how to write filters very difficult. I'd really appreciate some help.

    I've got some questions:
    Are the color codes written in CSV?

    I've annotated the color filter below (sepia) to show what I understand so far. Would you mind telling me if I'm wrong and mention anything that I'm missing.

    !!ARBfp1.0

    //sets temporary variables 'tex' and 'tem'
    TEMP tex, temp;

    TEX tex, fragment.texcoord[0], texture[0], RECT;

    //sets the color value for red
    DP3 temp.r, tex, {0.393, 0.769, 0.189, 0};


    //sets the color value for green
    DP3 temp.g, tex, {0.349, 0.686, 0.168, 0};


    //sets the color value for blue
    DP3 temp.b, tex, {0.272, 0.534, 0.131, 0};

    MOV temp.a, tex.a;
    MOV result.color, temp;
    END

    How would I change the the white to a blue colour given the csv value {0.552500,0.719644, 0.947500, 0}?

    Thanks for any help,

    Ben.

  8. #18
    Join Date
    Jun 2008
    Location
    Russia
    Beans
    42
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Custom Compiz color filter

    Hi!
    I suddenly did some research and probably find solution that can preserve colors more precisely than original inversion filter. It works perfectly with grays, blacks, whites, and saturated colors. But halftones may be a bit grayed or lighted. Please see comments in code.

    Use it and give to your friends. This filter will save your eyes, like lian1238's original filter.

    Code:
    !!ARBfp1.0
    # Compiz Color Filter, negative but preserve colors v0.1
    # Based on various ideas and examples.
    # author of portions: jopka1@gmail.com, www.bdyssh.ru
    # (select 'Ruby' in `gedit` for proper text highlight and show of keywords and comments)
    
    TEMP temp, lightness, diff, saturation, delta, grayness;
    TEX temp, fragment.texcoord[0], texture[0], RECT;
    
    # saturation 0...1 - show how rich the colour.
    #  i calculate it as max difference between r, g, b parts of colour.
    #  it is linear operation, so it's incorrect for half-tones, see HSL color model.
    # grayness = 1 - saturation. (it is 'anti-saturation').
    
    MOV saturation, 0;
    SUB delta, temp.r, temp.g;
    MAX saturation, saturation, delta;
    SUB delta, temp.g, temp.r;
    MAX saturation, saturation, delta;
    
    SUB delta, temp.r, temp.b;
    MAX saturation, saturation, delta;
    SUB delta, temp.b, temp.r;
    MAX saturation, saturation, delta;
    
    SUB delta, temp.g, temp.b;
    MAX saturation, saturation, delta;
    SUB delta, temp.b, temp.g;
    MAX saturation, saturation, delta;
    
    # simple method used... Not sure if it is precisely correct.
    MUL lightness, temp.r, 0.333;
    MAD lightness, temp.g, 0.333, lightness;
    MAD lightness, temp.b, 0.333, lightness;
    
    # -0.5 to 0.5 range and inverse
    ADD lightness, -lightness, 0.5;
    
    # -1 to 1 range
    MUL lightness, lightness, 2.0; 
    
    # inverse slope - calculate grayness, 1 = not coloured pixel, 0 = full saturation
    SUB grayness, 1, saturation;
    
    # here we invert pixels, and amount of inversion is inverse relative of saturation.
    # so, black colour become white, white turns to black, but red remains red.
    MUL diff, lightness, grayness;
    
    ADD_SAT temp.r, temp.r, diff;
    ADD_SAT temp.g, temp.g, diff;
    ADD_SAT temp.b, temp.b, diff;
    
    MUL temp, fragment.color, temp;
    MOV result.color, temp;
    END

  9. #19
    Join Date
    Jun 2008
    Location
    Russia
    Beans
    42
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Custom Compiz color filter

    Hi!
    Ubuntu 12.10 lacks of ColorFilter plugin. Also Neg plugin kicked from mainstream, but installable as separate option via command line.
    This plugin was main reason for me to vent from Windows to Ubuntu six yrs ago, and now, latest Ubuntu just can't be used at all, due to lack of it.
    But don't let your eyes cry.
    I take some weeks and find a way to modify Neg plugin so it can match my color filter processing. So, Ubuntu 12.10 still can be turn to useable. (I can't imagine what else can be worse in 13.04, but it becomes worse each new release, and blind to my bugreports.)

    Well, here is the (pseudo-diff of the) code of neg.cpp. You will need to recompile Compiz. It is full of tricks, but doable by inexperienced people like me. Tip: Never do 'make install', else you need to reinstall complete system. Just take libneg.so after build and push it to /usr/lib/compiz/.

    Code:
    // read more at http://ubuntuforums.org/showthread.php?t=1419702&page=2
    // was: Compiz Color Filter, negative but preserve colors v0.1
    // Based on various ideas and examples.
    // author of portions: jopka1@gmail.com, www.bdyssh.ru
    static std::string fragment_function =
    	"void neg_fragment () {; \n"
    	"float lightness; \n"
    	"float diff; \n"
    	"float saturation; \n"
    	"float delta; \n"
    	"float grayness; \n"
    	"vec3 temp; \n"
    // saturation 0...1 - show how rich the colour.
    // i calculate it as max difference between r, g, b parts of colour.
    // it is linear operation, so it's incorrect for half-tones, see HSL color model.
    // grayness = 1 - saturation. (it is 'anti-saturation').
    	"saturation = 0.0; \n"
    	"delta = abs (gl_FragColor.r - gl_FragColor.g); \n"
    	"saturation = max (delta, saturation); \n"
    	"delta = abs (gl_FragColor.r - gl_FragColor.b); \n"
    	"saturation = max (delta, saturation); \n"
    	"delta = abs (gl_FragColor.g - gl_FragColor.b); \n"
    	"saturation = max (delta, saturation); \n"
    // simple method used... Not sure if it is precisely correct.
    	"lightness = gl_FragColor.r * 0.333 + gl_FragColor.g * 0.333 + gl_FragColor.b * 0.333; \n"
    // # -0.5 to 0.5 range and inverse
    	"lightness = 0.0 - lightness + 0.5 ; \n"
    // -1 to 1 range
    	"lightness = lightness * 2.0 ; \n"
    // inverse slope - calculate grayness, 1 = not coloured pixel, 0 = full saturation
    	"grayness = 1.0 - saturation; \n"
    // here we invert pixels, and amount of inversion is inverse proportional of saturation.
    // so, black colour become white, white turns to black, but red remains red.
    	"diff = lightness * grayness; \n"
    // WARNING. Originally ADD_SAT instead of ADD used.
    // but i don't know its equivalent for fragment function,
    // to prevent values run out of 0...1 boundaries. So just add (`plus`) functions used.
    	"temp = vec3(gl_FragColor.r + diff, gl_FragColor.g + diff, gl_FragColor.b + diff); \n"
    	"gl_FragColor = vec4(temp, gl_FragColor.a); \n"
    	"} \n"
    ;
    Hope it helps.

    ADD: Please remember to change fonts antialiasing mode from rgb to grayscale via gnome-tweak-tool.
    Last edited by jpka; December 9th, 2012 at 10:33 AM. Reason: Added important comment about font antialiasing

  10. #20
    Join Date
    Feb 2011
    Location
    Somewhere...
    Beans
    1,543
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Custom Compiz color filter

    Ya know, another option is to stick with 12.04 if you're really dependent on the feature. It has 5 years of support, so you can stick to it until Compiz got all the unsupported plugins sorted out

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •