Search Unity

[Released] PBR-Ready HueShift shader

Discussion in 'Assets and Asset Store' started by TomH, Apr 16, 2015.

  1. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    I'd like to present my latest shader that has just been released:
    Hueshift (PBR-ready)
    Colorizing made easy

    AssetStore Link

    Features

    Change the hue of your materials quickly (can be limited to a custom color range)


    Change the saturation of your materials (combinable with hue changes)


    Supports complete Unity5 PBR-workflow including details maps


    Custom material inspector for quicker workflows



    What can I do with it?
    • Avoid repeating things by slightly changing the color or saturation.
    • Reuse assets for different scenarios without needing to create new variations. A good example would be a tree. You can limit the hue shift to the green colors of the leafs and turn them into a orange or red to create an autumn tree.
    • Colorize parts of your characters and assets for team-based games.
    Limitations
    • Legacy Vertex shading is not supported (no fragment shading possible in this render path. This is no limitation of the HueShift shader, but rather of the rendering technique itself)

    Planned features
    • Shwocase/Tutorial video
    2D solution
    A 2D-Solution for Textures and Unity Sprites is already available in the AssetStore (Link)
     
    Last edited: May 3, 2015
    Flickayy likes this.
  2. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Nice. Do you have a demo web player?
     
  3. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    Not yet. I will prepare one - probably next week. Although it's a bit tough to showcase, because the workflow is much more interesting than the final result itself. So maybe I will make a video instead.
    Is there anything you would like to see in the demo in particular?
     
  4. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    Some quick news:
    The package is currently available with a 50% discount for all Level11 users.

    A new version with full support for Forward Rendering in in development. It will also include a demo scene.
    A short video showing the workflow and the examples is also coming soon.
     
  5. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    A new version with support for forward rendering and a very simple demo has been submitted to the AssetStore. It might take a couple of days before it is available for download. If anyone needs support for forward rendering in advance, drop me a mail with your invoice number.

    A tutorial video and extended web player demo will take some days to be made. Be patient...
     
  6. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    This looks pretty cool. It sounds like you're replacing a certain color range from the albedo texture, though. Is that right? If so, would it be possible to do this based on a detail map, possibly with two different colors? And what is the impact on performance?
     
  7. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    Currently, I extended the default fragment shader by a selective color shift. Basically, it converts the RGB value into HSV color space, does the shifting (if needed) and transforms it back to RGB.
    The shader currently only changes a single color range (Albedo Main Texture only). Adding additional ranges would lead to additional instructions and would reduce performance. Do you have an example, where you would need to have multiple ranges?
    Concerning performance: The color space conversion is identical to my 2D Version (separate package in the AssetStore). The 2D version fits into shader model 2.0, which means that the whole 2D version (including all color space conversions) has less than 64 instructions. It does not need additional passes or other fancy stuff, so there should be no performance issues.
     
  8. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Ah, I see. I don't know too much about shader performance but that seems especially useful for assets where color changes were more of an after thought. It could definitely work for something I'm working on, though.
    The part where multiple colours would be great is for "extended" team colors (with secondary colors) or customisation. My use case is basically that I have a relatively large amount of actors whom I want to look as uniquely as possible. Having multiple patterns for colorising clothes would be a great way to do that. We've been experimenting with vertex colors, for example, which are great performance-wise but they don't allow for patterns and there's other mesh-related issues. I've actually been looking for a solution to this for quite a while and I was always under the impression that the most common way to do it was coverage textures that define where the custom colors are applied to, and multiply the color in those areas with the diffuse texture (as an example).
    Either way, multiple ranges aren't a necessity for us now and if we can use this to colorise hundreds of meshes differently with not much of a performance impact, that would be great already.
     
  9. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    Just a quick note: The last package in the store was missing the custom inspector files. Already added a new version that will hopefully be available soon
     
  10. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    Zeruel gave some good inspiration on improvements. So here is a sneek peek what I am currently working on...
    First of all: You can specify a mask that determines the areas that have their color changed (instead of the Albedo texture color). Should make it easier in some cases. You can still specify a color range, but it is only applied on areas, where the mask specifies.
    upload_2015-5-13_17-30-25.png

    Additionally, you can specify an influence mask. It adds an additonal mask to specify, how each area should be affected. It also supports grayscale values, so with a slight gradient, you can achieve the following:
    upload_2015-5-13_17-33-34.png

    Last but not least: You can scale and shift the Influence mask to control the area of effect even more (I did not adjust the mask, so the blue area on the hands are still affected, but I think the basic idea of the effect should be clear):
    upload_2015-5-13_17-34-50.png

    It will take while to finish it up, test it and polish it. But any comments are already very welcome.

    Additionally, I will probably add a property to affect the areas brightness (since the HSV model grants access to that rather easily).
     
    one_one likes this.
  11. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
  12. yusefkerr

    yusefkerr

    Joined:
    Apr 5, 2011
    Posts:
    179
    Hello, I bought this shader to use in Unity 2017.3.0b8 and I'm using Direct X 11. However its only rendering as pink and clicking on "PBRHueShiftShader" in the "Assets>>HueShiftShader" folder brings up an error message in the inspector "invalid subscript 'boxMax'.

    I downloaded the package into a completely empty scene and I'm still getting the issue - can you tell me what I need to do to make it work?
     
  13. yusefkerr

    yusefkerr

    Joined:
    Apr 5, 2011
    Posts:
    179
    Hello, I noticed that when I load my project up, the shader renders fine for a fraction of a second and then turns pink.
     
  14. TomH

    TomH

    Joined:
    Jul 10, 2012
    Posts:
    41
    There seems to be a problem with Unity 2017.3.0b8. I will look into this. Some shader syntax has changed. I'll fix this
     
  15. majorthom13

    majorthom13

    Joined:
    Nov 16, 2016
    Posts:
    2
    Tried to send you an e-mail, but it said that your e-mail isn't up, and your website is down.
    Questions I was going to ask:
    Does your asset allow change of hue via C# scripting?
    Is it only hue (H) being changed via C#? Not S or V? And not the alpha channel or existing gradients?