Unusual colour problem?

0belisk0belisk PRO Posts: 189
edited December 2011 in Working with GS (Mac)
I'll let the pictures do the talking.

What it looks like on my Mac:
image

What it looks like on my iPhone:
image

Notice almost like the sudden gradient effect that appears out of no where? Any ideas to why this is happening? It may not be THAT visible on this thread, but trust me playing it from the device, instantly noticeable.





«1

Comments

  • 0belisk0belisk PRO Posts: 189
    edited December 2011
    okay for some reason both pictures appear to look exactly the same for some reason, great! let me try this again:

    On Mac:
    image

    On iPhone:
    image

    look at the background, mainly the darker areas, notice how its no longer smooth, looks like a deliberate gradient effect

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    what your seeing is called gradient banding. To fix that you add a little bit of grain or noise to the image in photoshop.
  • CloudsClouds Member Posts: 1,599
    edited December 2011
    @0belisk

    Like John said - it's just banding - without knowing the details of the process you used I can't say for sure what introduced the banding . . . but (again like John said) adding a little bit of noise to diffuse the banded areas helps . . . .

    . . . but, of course, your image will look grainy rather than smooth and - importantly - your file size will greatly increase - as a rough guide I would say you should assume adding noise will increase the file size *at least* by 150% - 200% with busy complex images - and as much as 1000% (yes 10 times as large !) will simpler/more 'graphic' images.

    You probably don't want to know the details, but put simply noisy images are much harder to compress (even with lossless formats like PNG).
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    It's any gradient using the Box2d iOS engine that gets banding and Gamesalad runs on this engine.

    Ace
  • 0belisk0belisk PRO Posts: 189
    edited December 2011
    @Tynan

    "without knowing the details of the process you used I can't say for sure what introduced the banding"

    does this help? (edited in photoshop)
    image size 960x640
    DPI: 72
    color model: RGB
    PNG-24 format
    depth: 8
    interlace type: 0
    quality: bicubic

    so theres no solution to this except for adding in grain/noise? obviously i would prefer it to look smooth, and the increase in file size doesnt sound appealing either!
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Nope doesn't help... Gamesalad still uses the Box2D engine lol.

    Add grain until just before it's visible and should help.

    Ace
  • 0belisk0belisk PRO Posts: 189
    thanks for the help, just added a 2% noise to the affected images, the noise is barely even noticeable, but yet seems to cancel out the gradient banding effectively, cheers!
  • CloudsClouds Member Posts: 1,599
    @0belisk "so theres no solution to this except for adding in grain/noise?"

    Well, there are solutions, but they are all, necessarily by definition, compromises.

    One solution would be to make the steps in your gradient finer or make the contrast between the darkest shade and the lightest shade more pronounced.

    Look at it like this, imagine we only have 8 colours to play with (let's assume 8 levels of grey - from pure black to pure white)
    Now imagine we make a box that is 8 pixels wide - and place our gradient across that box - each of the 8 colours will cover a single pixel - the gradient will look smooth.
    Now lets try the same thing with a box that is 165 pixels wide - again we place our gradient across the box - but due to the extra resolution - each shade in our palette of eight tones needs to cover 20.625 pixels = the result is 'banding' - each shade covers a band of pixels.

    Now back to the idea of making the contrast between the darkest shade and the lightest shade more pronounced . . .

    If we have an area to cover (let's say 256 pixels wide this time) and our palette of colours is limited to 256 shades of grey - you will get a pretty smooth gradient if we place our gradient across this 256 pixel wide box - as each tone (of the 256) will cover 1 pixel. But that is going from pure black to pure white.

    If we were to go from . . say 33% grey to 66% grey we are effectively reducing out pallet to 85 shades of grey - and with only 85 shades of grey across a 256 pixel wide box we will start to see banding (each tone (of the 85) will cover 3 pixels.

    So to decrease banding we can increase the range of the tones used to cover an area (ie: pure black to pure white will always band less than - for instance - mid grey to dark grey - (given the same bit depth)).

    So, increase the contrast between your gradient's two extremes (to maximise the tones available to build the gradient) - make sure 'dither' is switch on if doing this in Photoshop and then add a little noise to troublesome areas.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    edited December 2011
    Gamesalad could add the feature for us to access the Box2D dithering which helps immensely, but I can't see them adding this for a long while. The reasoning being that they are behind with the roadmap, have more important bugs to fight and performance enhancements that are justifiably more important than this feature (that is, if we ever get this feature, which I doubt we will).

    I've never tried what @Tynan said, but all looks like stellar information. I've always just added a little noise and things have sorted themselves out :)

    image

    Mario managed to get away with it, so we can ;)

    Ace
  • Rob2Rob2 Member Posts: 2,402
    Box2D is a physics engine not envolved with rendering.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    I'm pretty sure it's a bug with the physics engine that causes the banding.

    Ace
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    @ Rob2 it is indeed a bug that box2d introduces. And its not just gamesalad specific.
  • Rob2Rob2 Member Posts: 2,402
    Nothing to do with Box2d. The solution is to make sure you have transparency in your image (which then keeps the rendering at RGBA8888) and you will have perfect gradients.
  • Rob2Rob2 Member Posts: 2,402
    edited December 2011
    From my 3GS
    image
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Nice find @Rob2! - We were always under the impression it was a Box2D error!

    Ace
  • CloudsClouds Member Posts: 1,599
    Excellent stuff Rob2 !!

    Fantastic piece of information to have !!

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Ditto! Excellent piece of info to know, Rob, thanks! :-)

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gamedivisiongamedivision Member Posts: 807
    I don't know why but since I've been exporting my images using save for web and devices in illustrator it's stopped and all my gradients look great
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi GD, maybe because you've got transparency ticked in Save for Web so it works out nice as Rob said... :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • CloudsClouds Member Posts: 1,599
    Yep like gyroscope said, transparency is on by default in illustrator.
  • gamedivisiongamedivision Member Posts: 807
    seems weird but if i export as a straight png, i get poor gradient,if i save as web and devices i get very smooth gradients,both have transparency,hey it works so why change it.
  • gamedivisiongamedivision Member Posts: 807
    just when i thought id solved the problem of the gradient it throw a spanner in the works,ive tried adding noise alone didnt work until i added so much the image looked terrible,so i started reading on the internet and found some bits and pieces ,so what i did was make the gradient which started of black at the bottom then at the top light blue,so its very heavy on the gradient side,it was already double the size of the iphone screen @ 960 x 640 i then doubled it again 1920 x 1280 exported just the background then imported added noise resized to 480 x 320 added the other bits to the image and i got a perfect gradient, i know it seems alot of messing around but i couldnt have that horrible gradient id rather not release a game.
  • RPRP Member Posts: 1,990
    edited January 2012
    That is good to know and saved me a couple of exports for testing. I got banding on my backgrounds that was only visible when I ran the simulator.
    Thanks for sharing the info.

    *edit* Should this be moved over to graphics?
  • RPRP Member Posts: 1,990
    edited January 2012
    Hey guys, I had to mess with adding noise to clean up the banding (in this case thick azz banding) that was going on in my backgrounds using gradients. If you want I can post some pics of before and after effects using various levels of noise.

    I will say that banding is not always a bad thing depending on the visual message you are trying to convey, just like with games that use simplistic geometry in their design (think Katamari Damacy and Gregory Horror House), sometimes it can work in your favor.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi RP, not sure why you're happy with the compromise of adding noise to your images to avoid banding, instead of Rob's suggestion of keeping transparency selected so you get nice gradients...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RPRP Member Posts: 1,990
    edited January 2012
    @gryoscope Hey dude! As always, thanks for your help, but I am not happy with the compromise and the suggestion does NOT work. I have illustrator, photoshop and fireworks. Same issue across the board. I always keep the transparency/alpha channel and I am not new to graphics laws, but gamesalad seems to play by its own rules. Adding noise X4 seems to have cleared up any issues I have with the BGs I am using. Suckage...perhaps...but it works.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi RP; thanks for that info; as it happens, I haven't tested out Rob's suggestion; I'm sure you're right about GSC playing by it's own rules, working with transparency and not other times... I wonder what the criteria are? I'll have to do a bit of experimenting when I've got time. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RPRP Member Posts: 1,990
    It's weird right?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Does seem that, for certain!

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gamedivisiongamedivision Member Posts: 807
    It is crazy some of my images are fine with transparency ,some are not,so I added noise to it didn't work so then I doubled the size exported imported reduced added noise then exported again worked fine I wonder if it has anything to do with the colour your using,dark blue didn't work,orange and reds work fine
Sign In or Register to comment.