How do I Apply absolute color programmatically?

0 favourites
  • 7 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • Hi there,

    I have a project i'm working on where I have a series of tiles that are set by RBG values, the problem is that i'm having issues where my webgl effect "set color" seems to have a few that display the RGB values I define correctly. See image below:

    nevermind that the word blue is green.. that's part of the game. What I want is for the world "blue" to be the exact same green as what you see in the box on the left. for some reason it comes out faded looking. i have 9 colors and most of them are dead on, however orange, purple and pink

    The image below should make the text look orange done like this:

    but instead it comes out a yellow with a weird hint of red around the edges:

    The text you see are white (255,255,255) and i'm wondering if that might be the issue, but i'm not sure what other color / effect I could use that would absolutely assure a sprite is the exact color it needs to be.

    here is what i have it setup with in the effect of the text sprite object:

    I've been stuck on this for a couple days trying things and for awhile i thought it was a logic thing, but the objects are right in the game and appear as they should, it's just that a few of them refuse to show the right exact color

    Thanks!

    Caleb

  • The color values should be between 0 and 100.

  • ooooooo .. but then how do i calculate colors from RGB? if i use a color picker I get these values.. also strangely enough.. colors like blue:

    r - 0

    g - 0

    b - 204

    look perfect as best I can tell, however looking closer blue isn't perfect.. it is off.. just not as noticeable. do i still use the parameter 0 1 and 2 for RGB?

  • doing some mad math.. i did try just now to divide a value say.. green which is:

    R - 51

    G - 153

    B - 51

    and i simply divided the value above by 255 (maybe i should do 256?) and i got basically:

    R - 20

    G - 60

    B - 20

    which looks dead on.. weird they would use a color range like this. is there some standard system that uses color in a range of 100? I've never seen that before.. or overlooked it in photoshop

  • You can divide by 255 and multiply by 100. So, your orange value will be:

    parameter 0: 226 / 255 * 100

    parameter 1: 146 / 255 * 100

    parameter 2: 28 / 255 * 100

    I suppose if you use a value larger than 100 it just gets rounded down so (0,0,204) = (0,0,100) which is pure blue.

  • Took a while to find but I knew there was an old thread discussing why 0-100:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yea i think you're right about the round off stuff... and ok yea 0-100.. percent.. duh.. didn't even think of it like that.

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