Search Unity

Colorify - realtime color-swapping and recolor map baking

Discussion in 'Assets and Asset Store' started by CatsPawGames, Sep 8, 2014.

  1. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Yes, I'm going to research options for integrating Colorify to Playmaker. From the looks of it this isn't that time-consuming, so it'll probably be included in v1.5.
     
  2. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Excellent - thanks
     
  3. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I found a minor problem with specular variant of Standard shader (specular map recoloring is patchy when specular hue is significantly different from albedo hue). Fix will be avaliable in 1-2 weeks.

    Edit: Fix will also include recolor option for other maps, such a luminance.
     
  4. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Good stuff. Already playintg with this Asset.
     
  5. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Just a thought - but how about making Colorify 'Playmaker compatible' (just adding Playmaker actions) - would make it more marketable!
     
  6. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Yes, version 1.5 will include Playmaker support.
     
  7. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Excellent!
     
  8. RavenWoodsDE

    RavenWoodsDE

    Joined:
    Jul 13, 2015
    Posts:
    12
    Would it be possible to add more colors?
     
  9. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.
    Realtime mode is restricted to 2 colors only and I don't see any way to change that.
    I'm working on possible solutions for increasing number of colors in masked mode, but it's still in early stages.
     
  10. danreid70

    danreid70

    Joined:
    Aug 28, 2010
    Posts:
    225
    Just want to confirm: if I use Colorify on multiple instances of same model in same scene (ie, multiplayer with multiple players using same model) and each has a different chosen set of "player colors", I don't need a separate material for each player? Just the Colorify plugin attached to the main prefab, and each instance can be individually colored per each user's chosen color sets? (Also: status of more than 2 color selections - 3 would be absolutely ideal for my setup - I wouldn't need to waste time and memory creating a separate texture and material for each faction times the number of models which are a LOT in my game... And would allow for insane number of combinations of player/clan/faction color schemes instead of only 6: black/white/red/blue/green/gold)...
     
  11. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Yes, you would need to setup just 1 material and you can change colors of each of your instances at runtime individually(Under the hood, Unity will automatically create different instances of materials).
    You don't need to attach "Colorify plugin" to your objects, you just have to use shaders from Colorify group.
    To change color at runtime, you can use renderer.material.SetColor (more info on parameters naming in the manual).

    I'm playing around with 3 color variations, but I can't give you ETA on that.

    P.S. Just noticed that link to online manual was 404, sorry for that. I updated the link in forum post and will upload info update to asset store.
     
    Last edited: Aug 26, 2015
  12. RavenWoodsDE

    RavenWoodsDE

    Joined:
    Jul 13, 2015
    Posts:
    12
    Given you'd have a breakthrough with 3 colors.. do you think more than that might be working out too?
     
  13. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Theoretical maximum I can bake into one map is 4 colors (1 per channel). More than that will require some complicated map format that will probably have very poor performance.
     
  14. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.5 is uploaded to Asset Store.
    Changes:

    - Added Unity 5-compatible Toon and Toon Outline shaders

    - Standard PBS shader:
    -- Added backface and cull-off versions
    -- Added luminosity recolor mode
    -- Added color multipliers
    -- Added specular recolor and smoothness control
    -- Updated shaders based on new 5.2 pipeline. (5.2 version only)

    Playmaker integration will be released as 1.5a update.
     
    Last edited: Sep 11, 2015
  15. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @CatsPawGames ,

    Looking better and better.

    You know those game icon packs (with transparency etc) - will this also colorify those?
     
  16. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Thanks!
    My own project uses Colorify for icons generation, and Colorify includes unlit shaders for sprites and UI, so it probably will. But I didn't test it with Unity new GUI, so I can't tell for sure.
     
  17. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi, can I use this asset to change textures easily as I expect? You know it's very awful if we change shader's color, the whole diffuse(or similar color no matter where they are on the model) is multiply that color and make things ugly, and that final color is also very hard to control(is Colorify a WYSIWYG asset?)
     
  18. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello, that's exactly the reason I created this Asset. It applies recoloring only on designated areas (either by defining a color range or providing recolor mask - you can also automatically generate recolor masks), and recoloring algorithm isn't based on simply multipliying colors - there's RGB difference algorithm and luminosity-based multiplication algorithm. You can see the effect of the changes you make immedeately in the editor.
     
    zhuchun likes this.
  19. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    I'd like to have a try :)
    What's that mask base on? Color or UV? I have used others and it looks dumb because my character's face and shoes is very similar and that asset change them both :p
     
  20. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Mask is in the same UV-space as diffuse texture with red and green channels representing recoloring coefficients (red for color #1 and green for color #2), and blue channel containing baked luminosity of diffuse texture for luminosity recolor mode.
     
  21. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    If your character face and shoes are on the same material and texture, and have same color, then Colorify will recolor them both by default, so you'll have to edit mask that Colorify generated for you by hand to differentiate them.
     
  22. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    413
    Just wanted to say thanks...sale was perfect timing as this is saved me alot of time.
    I created a substance to do the same, but this is so much easier to work with.
     
  23. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    Hi does this have playmaker actions? if not will you be adding them?

    thanks
     
  24. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hi,

    I want to use Colorify in strategy game (to recolor unit details to player color). First thing I tried didn't work very well but that is probably because recoloring was not taken into account when creating original unit textures. So my question is:
    what is the best practice for material/texture design for objects that will be recolored?
     
  25. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.

    Since you're creating your textures yourself, best way of doing would be creating recolor mask alongside your texture, with red channel being recolor strength for color #1 and green channel for color #2.
    If you don't want to draw recolor mask yourself, then it's best to have distinct colors in recolored areas (for example, red and green) so Colorify can easily distinguish them from areas that shouldn't be touched by recoloring algorithm.
     
  26. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Thanks! Will try custom recolor mask now. Would that be the right way to go:

    1. make grayscale version or original texture
    2. remove parts that I don't want to recolor
    3. use grayscale image as red channel in RGB mask for color #1 when recoloring
     
  27. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    You don't need to use grayscale version as mask, just paint parts you need to recolor 100% red on your mask. You can also blur that if you want to smoothen recoloring effect. Basically, value of red channel is a mix coefficient, R=1 gets you full recolor, R=0 gets you no recolor, and R=0.5 (for example) gets you a 50/50 mix of recolored and original color.

    Note that if you want to use luminosity recoloring mode, you'll need to put grayscale image into your blue channel (more info on luminosity recoloring in the manual).
     
  28. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Looking forward to Playmaker support... v1.6?
     
  29. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    As I said earlier, Playmaker support will be released as 1.5a update, I'm working on it right now. I originally planned to include it in 1.5 release, but I had to rush 1.5 release because Colorify got put on sale.
     
  30. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    That's great. More strength to you arm!
     
  31. Paynaldo

    Paynaldo

    Joined:
    Aug 14, 2014
    Posts:
    4
    Hey! This looks like a super useful thing. However, I see there's no support for Sprite Diffuse shader. Is this something you would be able to add? All of our games sprites are using that shader, if would be great if it was supported....

    Thanks!
     
  32. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello! There's unlit family of shaders included specifically for sprite rendering.
     
  33. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @CatsPawGames ,

    How is it going? How is Playmaker integration coming along?
     
  34. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    It's currently pending review by asset store team, should be avaliable sometime during next week.
     
  35. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Brilliant. Wasn't expecting it that quickly!
     
  36. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.5a with Playmaker support is available on Asset Store!
    To enable Colorify playmaker actions unpack unitipackage from "Colorify/Playmaker" folder.
     
  37. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Great! Thanks.
     
  38. Paynaldo

    Paynaldo

    Joined:
    Aug 14, 2014
    Posts:
    4
    Hi CatPawGames. I finally bought Colorify and the colour changing is very useful... however, our sprites were all using the Sprite-Diffuse shader so that they could receive lighting. You suggest using the Colorify Unlit shaders for sprites, but they don't work with lighting. Do you have any plans to support the sprite diffuse shader?

    Thanks!
     
  39. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello, send me a message to leonidmv@gmail.com, and I'll reply with a sprite diffuse variants within a couple of days. They also will be included in the next version of Colorify, thanks for pointing out that this shader family was missing.
     
  40. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    HI any demo scenes to play around with it?
     
  41. schplurg

    schplurg

    Joined:
    Mar 21, 2009
    Posts:
    208
    Just so I understand this - my game has a motorcycle and I'd like to give the player the option of changing the color of it (side panels, tank, fenders etc). Your tool can accomplish this, correct?

    It's a mobile game so performance is a concern. Thanks, and a simple yes or no answer will suffice! ;)
     
  42. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Yes, that's exactly what this asset was made for.
    Performance is a non-issue for Colorify, especially for mask mode - performance of mask shaders are almost completely identical to usual Unity shaders.
     
  43. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Coming soon - overlay texture extraction for UMA.
     
  44. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
  45. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    It's pretty easy to include Colorify support to 3rd party shaders. If source for Unity-chan shader is accessible and its license allows modifications, I can plug Colorify in - send me a letter with invoice and shader source if you want me to do it.
     
    Last edited: Jan 17, 2016
  46. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    OK! i'll send you.
     
  47. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    Looks very promising, however ...

    I read your manual. I want to do runtime dynamic color change of parts of an animated character via script. For runtime in code adjustments, your manual says to refer to unity manual.

    "Usage for dynamic recoloring in your code:
    You can change your material parameters during runtime by using
    Material.SetFloat
    and
    Material.SetColor
    .
    More info available at Unity Script Reference:
    http://docs.unity3d.com/ScriptReference/Material.SetFloat.html
    http://docs.unity3d.com/ScriptReference/Material.SetColor.html
    "

    Do I even need this asset if what I want to do is already covered in the Unity manual?

    Again I have an animated character that I want to change the color of various parts (i need a mask apparently) at runtime in game.

    Is there a demo included to show how to do runtime in code changes to a character?
     
    Last edited: Feb 13, 2016
  48. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Link to the Unity manual just explains how to change shader parameters at runtime through code. You still need a shader that will accept these parameters.

    There's no example included of runtime manipulation, but it's something along these two lines of code:
    Code (CSharp):
    1. Renderer rend = GetComponent<Renderer>();
    2. rend.material.SetColor("_NewColor", Color.red); //Use Color variable with desired color instead of Color.red
    P.S. There's also Playmaker support, so if you're not comfortable with scripting, you can use that.
     
  49. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    I seem to be having problems.
    Maybe the tools do not do what I was expecting.

    I have a mage robe that comes with 5 different detail colors that use a detail mask.
    I am also using mesh baker to bake all textures/ meshes together for performance.

    The problem is if I use a red detail color for gloves then all the other parts that use that mask also change(because they are all on the same shader).

    So I figure I can take each one of those mask/detail color combos and bake them into a texture.
    Then mesh baker will add all of the new textures together and switching the color of one part will not cause a problem.

    So first question is can that be done using Colorify?

    Second question is if so how? I have tried many times and can't get it to work.
    No offence but the manual seems lacking.
    How do I use an existing detail mask and only bake the detail color into a texture?

    https://www.dropbox.com/s/89uad9793yoewhk/Capture.JPG?dl=0
     
  50. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    1) If you're using Mesh Baker that produce mesh with only 1 material, you only have 2 recolor intervals for that material when using Colorify. Note that this restriction is per material, not per shader. There's no way around that.

    2) Detail mask for the gloves would of course affect other parts if they're part of the same material, regardless of Colorify usage.

    Overall I don't understand why you're using Colorify alongside recoloring with detail masks. It's two different types of recoloring, so stick to one or the other. They will not work satisfyingly together.