Recoloring Static Images

Discussion in 'Mod Discussions' started by wondible, September 27, 2014.

  1. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Not quoting everything, follow the quote links to see originals.



  2. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Proof of concept. This is hue replacement; he example is the two hues swapped, would have to figure out an appropriate method to work in saturation/lightness of a team color. Since one of the base colors is yellow, I don't think it's possible to avoid the construction stripes without an image-specific exclusion area.

    Screen Shot 2014-09-27 at 08.06.05 .png
  3. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Hueswap is possible when isolating team colored regions, beware of color bleeding or other occlusion effects. Same goes for saturation, well, at least partly since bit depth isn't sufficient to fully avoid color banding.

    Brightness is impossible to scale this way. There is just no math which would allow you to do that, since lightning is applied after the color is determined, not before.
  4. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I don't understand. Why would you want to change the brightness?
  5. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Because there are the colors black&white?
  6. Prezombie

    Prezombie New Member

    Messages:
    21
    Likes Received:
    9
    Wow, I didn't expect my little suggestion to explode like this.

    For black and white, It seems that the easiest way to create the conversion would be to filter the team color areas of the image to greyscale, and then applying a transformation which compresses the "before" full gray range into the brightest and darkest 40% of the grayscale spectrum.

    Making it look good as pure black would be insanely difficult without the raw render data, but compromising with very light and dark grays would make passable and recognisable equivilants.
  7. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Those were rather tricky. I believe my solution can best be described as weighting between a L^2 and sqrt(L) curve, where L = lightness in HSL space. Meanwhile, secondary color isn't available on the cinematic screen without further hacking, so I had to use gray.

    Screen Shot 2014-09-27 at 15.41.41 .png
  8. Prezombie

    Prezombie New Member

    Messages:
    21
    Likes Received:
    9
    Wow, even without secondary color that's stunning!

    Will the main menu commander be randomly recolored too?
  9. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    That's what it currently does, as much for testing as anything; albeit with a delay - can't really do anything until the image loads and they are large - 1780^2
  10. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    what if you photo shopped every image that every base color was bright pink and every secondary was bright orange and had it fixed that it knew bright pink was the base color and bright orange was secondary instead of having to do it on a case to case basis that may cause problems depending on what the base image is
  11. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I don't want to do the image editing (now and as each commander is released) and I'd rather not include a ton of images in the mod either.
  12. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Test version on github. It's not a cheap operation and there well be visual hiccups - trying again with webgl shaders is left as an exercise for the reader.

    https://github.com/JustinLove/commander_image_color

    Known pixel issues that could use refinement of selection or replacement:

    - Centurion shoulder
    - Nemicus highlights
    - Rallus chest
    - Theta inner surfaces/edges
    Fr33Lancer likes this.
  13. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    Looks really cool, very well done ;)
    [​IMG]
    Of course, nitpicky as I am ( :D ), I noticed some "pixel party" areas on the main screen :
    [​IMG]
    But I can live with it ;)

    Quick question : Would it be possible (if it's easy enough) to read Favourite Colour's mod preference (if mounted) and apply primary colour set (or a random between primary and secondary set) instead of completely random colours for the start screen ?
  14. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Yeah, I haven't tried hacking in any of the extended commander images.

    Almost certainly; I've expected that would be an enhancement at some point, but I've already spent too much time on this for the current week.
    Fr33Lancer likes this.
  15. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    No pressure, it's already awesome as it is, and the request from @Prezombie was done only yesterday ! :eek:
    Great work, as usual ;)
  16. Prezombie

    Prezombie New Member

    Messages:
    21
    Likes Received:
    9
    Goodness me wow, the little pixel errors are totally forgivable given this amazing job.

    Thank you so much, I was getting so tired of the bland blue/orange portraits!
  17. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089

Share This Page