Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

► Texture Adjustments ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, May 20, 2015.

  1. HotButton

    HotButton

    Joined:
    Feb 19, 2018
    Posts:
    4
    1. 2019.4.0
    2. Gamma
    3. I am calling RenderAll on both:
    TextureAdjustments.RenderAll(texture, ref adjTexture_T2D, crop);
    TextureAdjustments.RenderAll(adjTexture_T2D, ref adjTexture_T2D, resize);

    ...but, I'm not seeing any Apply method.

    4. Texture2D...
    texture = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
    texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false);
    texture.Apply();
    --- Then the above adjustments happen ---
    byte[] bytes = adjTexture_T2D.EncodeToPNG();

    5. Tested in a coroutine (called in the start function) that runs right after WaitForEndOfFrame yield. It successfully ran, and successfully resized as usual, but still didn't crop.

    // Last post edit, will wait for response
     
    Last edited: Jul 8, 2020
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Just tested on Android using Unity 2019.4 and CropByAlpha works without problem.

    Is crop shader included in the build? Without shader it will not work in build.
    You can include all required shaders from Texture Adjustments editor window or from your scrip:


    If all required textures are included in build and still CropByAlpha does not work, problem may be in texture you are using. You are trying to read pixels from RenderTexture (screen), are you sure it has Alpha channel on android?


    As for Apply method: If you are using only one adjustments you can use Apply method:
    Code (CSharp):
    1. crop.Apply(sourceTexture, ref resultTexture);
    TextureAdjustments.RenderAll method is suitable when you have list of adjustments.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Jul 8, 2020
  3. HotButton

    HotButton

    Joined:
    Feb 19, 2018
    Posts:
    4
    It was that I was not including the shader in the build. Working perfectly now. Thank you so much!
     
  4. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    996
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    SunnySunshine likes this.
  6. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    258
    This asset looks really nice! What we seem to be missing for us is inner glow and inner shadow, otherwise it would be a perfect fit in our workflow.

    Alternatively, a way for us to implement an effect ourselves.
     
  7. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    258
    Like this
    inner_outer_glow.png
     
    Arkhivrag likes this.
  8. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    258
    I found that I can easily implement my own adjustment with its own property drawer, awesome! :)

    But when it comes to the editor window, there's no way to let it know that a new type has been
    added.
    So it looks like I'm going to be forced to reimplement batch processing?
     
  9. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    258
    If this is something you would want, I could share my shader code/technique.
    I just spent a day figuring out how to do it efficiently, using 2 passes (starting from the edge), or 4 (from center, which looks smoother).
     
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Unfortunately, currently I am very busy with my other assets updates and can not implement any new features. Added to a wish-list.
    Of course, you can send me your shader or share it here.



    Amazing Assets - YouTube Facebook Twitter
     
  11. MinoanStudios

    MinoanStudios

    Joined:
    Dec 10, 2017
    Posts:
    11
    Great asset! Is there a way to just import textures on top of each other? As an example i might want to put an icon on a certain background surrounded by a certain frame and combine those to one asset.
     
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Yes, you can do it with Color Over filter.


    Set color value to white and use your "top-most" texture. Additionally you can use Mask for adjusting blending.



    Amazing Assets - YouTube Facebook Twitter
     
    MinoanStudios likes this.
  13. JuanJSAR

    JuanJSAR

    Joined:
    Feb 21, 2014
    Posts:
    47
    How could you combine two textures for example add a watermark?
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Using Color Overlay filter with Watermark blend mode:
    upload_2020-12-29_13-1-37.png



    Amazing Assets - YouTube Facebook Twitter
     
    JuanJSAR likes this.
  15. dreamer2017helloworld

    dreamer2017helloworld

    Joined:
    Apr 7, 2020
    Posts:
    16
    color overlay is not working on android, Unity edtior is working
    the Texture has not changed
    1.I tried to change the value of the Shader return colour to half(0,0,0,0) but it still doesn't work on the phone.
    2.Using the Debug Tool to connect to the phone and expand the Shader in the Material Property is also correct.
    3.Logcat does not show any warnings or errors

    i using Unity 2019.4.18f1

    help
     
    Last edited: Mar 10, 2021
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Is Color Overlay shader included in the build? Without shader it will not work in build.
    You can include all required shaders from Texture Adjustments editor window or from scrip:




    Amazing Assets - YouTube Facebook Twitter
     
  17. dreamer2017helloworld

    dreamer2017helloworld

    Joined:
    Apr 7, 2020
    Posts:
    16
    still not working
     
    andyz likes this.
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Send me more details about your problem on support E-mail (support@amazingassets.world)
    1) Unity version (it is 2019.4.18f1)
    2) Project render pipeline
    3) Project color space
    4) Target device info
    5) Is there problem only with one particular adjustment (color overlay in your case) or non of the adjustments work?
    6) Do you use any custom script or even included example scripts do not work?
    7) Does problem exist in empty project only with Texture Adjustments only. May be in your project some other script with conflict with Texture Adjustments.
    8) Asset purchase invoice.

    I need max info to reconstruct your problem at my side to help you.



    Amazing Assets - YouTube Facebook Twitter
     
  19. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    996
    I've discovered a bug.

    Just using this system, w/o even applying any effects, will degrade quality.

    This is my gradient (before texture adjustments):


    After texture adjustments:


    In this case, I'm not even rendering any effect.



    Code (CSharp):
    1.             //Adjusting 'originalTexture' and saving results in 'adjustedTexture'
    2.             TextureAdjustments.RenderAll(originalTexture, ref adjTexture_RT, false, noise, hue, blur, contrast);
    3.  
    4.             //Assigning 'adjustedTexture' to the material
    5.             activeMaterial.mainTexture = adjTexture_RT;
    That is seemingly enough to get this.
     
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    That is strange. Can not reconstruct this at my side.
    Can you share more details?
    1) Unity version
    2) Render pipeline
    3) Color space
    4) Build target
    5) OS
    6) Source texture file format and Unity compress settings.



    Amazing Assets - YouTube Facebook Twitter
     
    SunnySunshine likes this.
  21. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    996
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    It is not because of degrade quality (Texture Adjustments does not use any compression), but some incorrect grayscale conversion in Linear color space (it does not exist in Gamma). It'll take some time to find out why this happens.
    Common colored textures have no such problem.



    Amazing Assets - YouTube Facebook Twitter
     
    SunnySunshine likes this.
  23. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    Great Tool! It is amazing!
    Simultaneously, I found that it will take about 4ms for every "Renderer" update( according to the Example_1_Texture script in the demo scene),is there some opinions or alternatives for optimization ?
     
  24. FiveXGames

    FiveXGames

    Joined:
    Apr 27, 2016
    Posts:
    43
    I'm afraid there is a bug with the conversion tool, I have performed some Debugging:

    I will try to be clear as possible since the bug looks like is the same but it happens in several scenarios:

    1) If you use a texture with "sRGB" enabled and save it as .JPG it works as expected.
    2) If you use a texture with "sRGB" enabled and save it as .PNG or .TGA it washes the image a little.
    3) If you use a texture with "sRGB" disabled and save it as .PNG or .JPG it washes the image more
    4) If you use a texture with "sRGB" disabled and save it as .TGA it washes the image a lot.

    upload_2021-8-2_16-44-57.png

    From what I can see it looks a problem managing color space, the tools applies an unwanted sRGB conversion (or inverse, in some cases it happens twice) to the textures and that modifies the result texture destroying it.

    The only operation I apply is the following one:
    upload_2021-8-2_14-33-34.png

    P.S. When checking the bug, careful and verify that you are comparing the correct import configuration, because the default behavior is to enable the "sRGB" conversion so you may be comparing a sRGB to a NON-sRGB texture and if they look similar then, that is a bug.

    P.S. For the purpose of simplicity , when I say "sRGB textures" is an abbreviation of "a texture with sRGB processed by Unity" or not.
     
  25. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    After calculating adjustments, pixels are read from GPU RenderTexture to Texture2D. This requires some CPU time and speed of conversion depends on target device.
    Suggestion #1: Do not apply multiple adjustments to Texture2D, instead create list of required adjustments and use RenderAll method.
    Suggestion #2: Instead of use Texture2D file, create RenderTexture and apply as many adjustments as you need. When it is done, convert that RT to Texture2D.



    Unity version?
    Render pipeline?
    Project color space?
    Selected build target?



    Amazing Assets - YouTube Facebook Twitter
     
    Bagazi likes this.
  26. FiveXGames

    FiveXGames

    Joined:
    Apr 27, 2016
    Posts:
    43
    1. Unity 2019.4.28f1
    2. Built-in
    3. Linear
    4. Windows x86
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Confirm bug. But unfortunately it will not be fixed within current TA version, which does not support Unity 2019.4.
    New TA designed for Unity 2019.4 - 2020.3 - 2021 LTS versions requires complete asset re-written and is planed to be released in October.



    Amazing Assets - YouTube Facebook Twitter
     
  28. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    Hello,

    Does this asset support URP?

    and when do you expect 2020.3 LTS support?
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    New Texture Adjustments supporting Unity 2019.4, 2020.3, 2020.2 will be released in January 2022.



    Amazing Assets - YouTube Facebook Twitter
     
    Duffer123 and SunnySunshine like this.
  30. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,999
    Hi @Arkhivrag
    any plans for building a Shader Graph version of Texture Adjustments?
     
  31. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    ok, thanks. And my other question was whether URP was supported?
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    In Unity 2019.3? No.
    URP and HDRP will be supported in new version, releasing in January 2022.



    Amazing Assets - YouTube Facebook Twitter
     
  33. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    ok, if one buys this version (since it is currently on sale), will the upgrade to the 2020.3 LTS + URP version in January 2022 be a free upgrade or is that going to be a different asset?
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Update will be free.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Nov 5, 2021
    SorraTheOrc likes this.
  35. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    996
    @Arkhivrag
    Did you ever figure out a solution to this issue? We are currently unable to use texture adjustments since any texture that has a gradual color change will turn out worse after applying a texture adjustments filter.

    I noticed that the linear color behavior of unity can be circumvented if using floating point textures. Hardly ideal, but at least the issue is circumvented. Maybe it should be an option at least so the texture quality won't degrade?
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Unfortunately problem is in the Unity's old API used by the current Texture Adjustment version and it has no fix.
    New version uses Unity's latest API and rendering methods and such problem does not exist here.



    Amazing Assets - YouTube Facebook Twitter
     
    JuanJSAR likes this.
  37. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Super asset!!! Thank developer!!!
     
    Last edited: Dec 3, 2021
    Arkhivrag likes this.
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
  39. xharkx

    xharkx

    Joined:
    May 17, 2017
    Posts:
    26
    Hi.
    I just build Example_1_Texture
    It work fine on PC, but not work on iOS.
    What should I do?

    Unity 2020.3.8f1
     

    Attached Files:

  40. xharkx

    xharkx

    Joined:
    May 17, 2017
    Posts:
    26
    Unity 2020.3.30f1 not working too.
     
  41. xharkx

    xharkx

    Joined:
    May 17, 2017
    Posts:
    26
    I'm sorry. My bad.
    I forget to include them into Always Include Shaders. Now it's work fine.Thank you
     
  42. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    ProGameDevUser likes this.
  43. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    69
    Hello, does this new version support URP? Please see your comment #336. If yes, it might be a good idea to update the main asset store page with this information.

    thanks,
     
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    All render pipelines are supported.



    Amazing Assets - YouTube Facebook Twitter
     
  45. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    996
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
  47. r137

    r137

    Joined:
    Mar 12, 2018
    Posts:
    47
    Hi, Is demo on the asset store page Editor only?

    Editor:

    2022-04-18 16_32_02-Window.png

    Windows Build:
    2022-04-18 16_24_15-Window.png

    Android Build on Emulator:
    2022-04-18 16_23_47-Window.png

    I am trying on:

    Windows 10 21H2 19044.1645
    Unity 2020.3.28f1
     
    Last edited: Apr 18, 2022
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    r137 likes this.
  49. r137

    r137

    Joined:
    Mar 12, 2018
    Posts:
    47
  50. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    996
    @Arkhivrag

    Any idea how to use texture adjustments in a command buffer added to camera? Is it even possible?

    All the best.