How do I find the correct settings (RGB) to set a color to sprite?

  • Hey guys, i try to set a color to a sprite but can't understand why the settings need to be different.

    Please check the image below to understand more..

    As you can see, I use the same RGB settings for background and sprite but i get different color result.

    Any help? Thanks!

  • "Set color" effect accepts values from 0 to 100 (percentage). So 204% is rounded down to 100%. And your background has Green=204, which is about 80% green

  • Ok, so is there any effect for rgb only? Do you suggest other solution? Thanks!

  • Simply change "204" to "80" in effect parameter.

  • Thanks man, but my question is not to change all time manually the colors, you know.

    I need a solution with events or an effect, maybe to use a slider for rgb for both background and sprite. For example:

    1 Slider for R

    1 Slider for G

    1 Slider for B

    So, when i change the sliders to give the same results for the background and for a sprite which use set color.

    Can work this?

  • It's a simple formula: percentage=100 * ColorChannel/255

    For example if your color in RGB is (0,204, 255), to convert these numbers for "Set color" effect you divide each by 255 and multiply by 100, result: (0, 80, 100)

    .

    To convert back: ColorChannel=percentage*2.55

  • Cool bro, thank you! :)

  • By the way, I made just a test, I edit "setcolor.fx" this line:

    gl_FragColor = vec4(red * a, green * a, blue * a, a)

    to this:

    gl_FragColor = vec4((100*(red * a)/255), (100*(green * a)/255), (100*(blue * a)/255), a);

    .. It works when you open construct.. but when i run it to a browser i get bug warning.

    Where is the problem you think, what need to fix?

    Thanks again for your help!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • "Set color" effect accepts values from 0 to 100 (percentage). So 204% is rounded down to 100%. And your background has Green=204, which is about 80% green

    Simply change "204" to "80" in effect parameter.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)