Search Unity

► Texture Adjustments ◄

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

  1. Babacool321

    Babacool321

    Joined:
    Feb 25, 2015
    Posts:
    8
    Yes, I use the same material
    I have to use different material if I would like different value ?
     
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Yes, of course.



    VacuumShaders - Facebook Twitter YouTube
     
  3. Babacool321

    Babacool321

    Joined:
    Feb 25, 2015
    Posts:
    8
    So what is the method to do it ?
    I have a prefab, in which I want to change his color through the shader. And these instantied gameobjects will be destroyed ~10s later. So I dont want to save the created material.
    Code (CSharp):
    1. obj.renderer.material = new Material (Shader.Find(" shader_name"));
    Is this method fine ?
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    It's fine. Do not forget to destroy material after using.



    VacuumShaders - Facebook Twitter YouTube
     
  5. Babacool321

    Babacool321

    Joined:
    Feb 25, 2015
    Posts:
    8
    Ok, Thank you ! :)
     
  6. tametick

    tametick

    Joined:
    Aug 29, 2014
    Posts:
    6
    Hey, trying to write a scaled screenshot using this asset and the result always comes out as a blank gray PNG:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using VacuumShaders.TextureAdjustments;
    4. using System.IO;
    5.  
    6. public class ScreenCapture : MonoBehaviour {
    7.     public Camera cameraToCapture;
    8.  
    9.     public void SaveScreenshot(){
    10.         StartCoroutine(SaveScreenshotRenderToTex());
    11.     }
    12.  
    13.     IEnumerator SaveScreenshotRenderToTex() {
    14.         //Wait for graphics to render
    15.         yield return new WaitForEndOfFrame();
    16.  
    17.         RenderTexture rt = new RenderTexture(Screen.width, Screen.height, 24);    
    18.         Texture2D screenShot = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
    19.  
    20.         cameraToCapture.targetTexture = rt;
    21.         cameraToCapture.Render();
    22.         cameraToCapture.targetTexture = null;
    23.  
    24.         RenderTexture.active = rt;    
    25.         screenShot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
    26.         RenderTexture.active = null; //Added to avoid errors
    27.         Destroy(rt);
    28.  
    29.         //Split the process up
    30.         yield return 0;
    31.  
    32.         // 1. works - original image comes out fine
    33.         byte[] bytes = screenShot.EncodeToPNG();
    34.  
    35.         // 2. doesn't work - scaled image produces a blank gray file
    36.         /*var h = (int)256;
    37.         int w = (int)(Screen.width * 256f / Screen.height);
    38.         Texture2D scaledShot = new Texture2D(w, h, TextureFormat.RGB24, false);
    39.         Adjust.CopyAndScale (ref screenShot, ref scaledShot, w,h, false);
    40.         byte[] bytes = scaledShot.EncodeToPNG();*/
    41.  
    42.         File.WriteAllBytes(Application.persistentDataPath + "/capture.png", bytes);
    43.     }
    44.  
    45.     void Update(){
    46.         if (Input.GetKeyDown (KeyCode.C)) {
    47.             Debug.Log ("saving screenshot to "+Application.persistentDataPath);
    48.             SaveScreenshot ();
    49.         }
    50.     }
    51. }
    52.  
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    RenderTexture.active = rt;
    screenShot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
    RenderTexture.active = null; //Added to avoid errors

    Add: screenShot.Apply();



    VacuumShaders - Facebook Twitter YouTube
     
  8. mlary

    mlary

    Joined:
    Dec 26, 2015
    Posts:
    1
    Hello,
    CopyAndScale works well. But I have to resize textures more than Max Texture Size allowed GPU. How can I do that using Texture Adjustments
     
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    You can't, if GPU does not allow.



    VacuumShaders - Facebook Twitter YouTube
     
  10. Magoga

    Magoga

    Joined:
    Jan 24, 2013
    Posts:
    134
    hey man)
    i bought asset.
    and there have no selective color for hue saturation
     
    Last edited: Feb 20, 2016
  11. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    It will be available in the next update.



    VacuumShaders - Facebook Twitter YouTube
     
  12. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Any release date for next update (w/ selective hue/saturation color)?
    I'm waiting for it to buy this interesting package.
     
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    It's planed for April, 2016.



    VacuumShaders - Facebook Twitter YouTube
     
  14. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Great! Thanks
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Menion-Leah likes this.
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Some info about Texture Adjustments v2.0:

    • New redesigned fastest API
    Convertion speed 2.png

    • New API is completely oriented on textures and is not compatible with previous one.
    • Per-mesh adjustment shaders will not be supported and are removed. Save them if you need.
    • Package category will be changed to Editor Extensions.
    • New adjustments (and even more to come)
    • Adjustments can be added/removed arbitrary and reordered.

    • Most adjustments will have custom mask options.
    • Most wanted batch converter.

    • Saving textures to png, jpg and new Encode To TGA
    Banner.png

    Releasing in May, 2016.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 11, 2016
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Just finished working on v2.0.
    Need one more week for preparing package for the asset store (documentation, example scenes, video tutorials, ...).
    Those who can not wait more just send purchase invoice to vacuumshaders@gmail.com and get early access.



    VacuumShaders - Facebook Twitter YouTube
     
  18. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Trying to see if this will do what I need it to do. After saving the texture, will I be able to use that texture on any model? Will I be able to change the shader after saving the changes?

    Thanks. Looks very nice.
     
  19. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    v2.0 is very optimized and works extremely fast with RenderTextures and Texture2D files.
    Adjusted textures can be used on any model and shader without problem.
    Tool also can be used as Image effects processor in run-time. It is so fast.



    VacuumShaders - Facebook Twitter YouTube
     
    Teila likes this.
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Last edited: May 20, 2016
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    v2.0 released!
    • New redesigned fastest API (not compatible with previous versions).
    • Adjustments can be added/removed dynamically.
    • Adjustments order can be changed.
    • Adjustments can be applied per-channel.
    • Added Mask option.
    • Added Batch Converter.
    • Added option to save final textures into Default Folder.
    • New adjustments (total 20). Even more to come.
    • Final textures can be saved in PNG, JPG and TGA (using Encode To TGA plugin) formats.
    • Added RenderTextures support.
    • Adjustments can be used as Image Effects too.

    Note!
    Per-mesh adjustment shaders are removed. Save them if you need before updating.



    VacuumShaders - Facebook Twitter YouTube
     
  23. ozgurhazar

    ozgurhazar

    Joined:
    Aug 30, 2014
    Posts:
    19
    Error...
    When I use "Color Replace".I get this error and a sweet black screen
    PNG Texture which I used and my unity is Unity 5.3.4f1

     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    It looks like the error is coming from Unity's Editor GUI having a corrupted stack.
    Does it happen only with ReplaceColor or with other adjustments too?
    When did it happen? After adding adjustment or during parameters changing?



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: May 30, 2016
  25. PygmyMonkey

    PygmyMonkey

    Joined:
    Jan 13, 2014
    Posts:
    306
    Hello,

    This version 2 looks awesome and we can tell you put a LOT of work on it! Congrats :)
    I've just bought it!

    Quick questions:
    - Do you have an API to load a file from disk? I currently use File.ReadAllBytes but maybe there's something faster?
    - Also, do you have an API to read width/height from a file on disk?

    I know those are not really Texture manipulations, but hey, maybe you did them anyway? :)
     
  26. PygmyMonkey

    PygmyMonkey

    Joined:
    Jan 13, 2014
    Posts:
    306
    Also, do you plan on adding a rotate API? That would be nice... :D At least rotate 90°?
     
    Last edited: May 30, 2016
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    I have no API for working with image files outside Unity.

    Good idea.



    VacuumShaders - Facebook Twitter YouTube
     
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Just submitted update v2.1
    • Added new adjustment Transform/Rotate.
    • Shader keywords used by plugin reduced on 75% (from 97 to 24).
    (Delete project Library folder after updating for releasing unused keywords).

    texture-adjustments-image-rotate.gif



    VacuumShaders - Facebook Twitter YouTube
     
    PygmyMonkey likes this.
  29. PygmyMonkey

    PygmyMonkey

    Joined:
    Jan 13, 2014
    Posts:
    306
    Works like a charm! Thanks a lot :)
    Just a small question, why did you limit it to 0, 90, 180 and 270°? Why can't we specify the angle we want (something like 37° for example)?
     
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    It is difficult to define what user wants from rotating image on 37°
    texture-adjustments.png



    VacuumShaders - Facebook Twitter YouTube
     
  31. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Rotating textures is nice when you are trying to fit a wood texture to roof trim or to a cross bar.
     
  32. PygmyMonkey

    PygmyMonkey

    Joined:
    Jan 13, 2014
    Posts:
    306
    Well yes, you're totally right, but maybe the best (and default) thing to do is what you did on the bottom left, having a transparent background when it's rotated?
    Transparent or white on the bottom works for me at least :D
    Maybe you can add that first, and implement the other things you did on the screenshots then (when you have time)?
     
  33. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    So this is the rotation you are asking. With customizable background and wrap mode?
    I'll try when have time for it.






    VacuumShaders - Facebook Twitter YouTube
     
    PygmyMonkey and Teila like this.
  34. PygmyMonkey

    PygmyMonkey

    Joined:
    Jan 13, 2014
    Posts:
    306
    Seems more than perfect! Looks awesome.
    Does it handle the fact that you maybe first render your texture in a 1280x720 rectangle for example, and when you rotate the texture, the texture stays in this 1280x720 rectangle?
     
  35. PygmyMonkey

    PygmyMonkey

    Joined:
    Jan 13, 2014
    Posts:
    306
    Well of course no problem, just wanted to give a "hint" of a feature that could be nice.
     
    Last edited: Jul 19, 2016
  36. PygmyMonkey

    PygmyMonkey

    Joined:
    Jan 13, 2014
    Posts:
    306
    Hello again!

    Just to drop a feature request. It would be nice to have a crop feature, to not resize, but crop from a texture to another, by specifying the desired width/height and crop method (left, right, top, bottom or center) :D
     
  37. tametick

    tametick

    Joined:
    Aug 29, 2014
    Posts:
    6
    Is there an example for how to use the new API that's not in video format? It would be a lot easier to google for stuff if you wrote it instead :)
     
  38. IggyZuk

    IggyZuk

    Joined:
    Jan 17, 2015
    Posts:
    43
    @Arkhivrag Does this plugin work for a texture of type Sprite (2D and UI) with sprite mode set to Multiple?
    I have multiple sprites in a spritesheet and I would like to change a specific color, expecting all sprites to be affected automatically.
     
  39. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Add to wishlist.

    Example scripts are included.

    Sprite is just a texture file yes (.png, .tga, ...)? so plugin will work.



    VacuumShaders - Facebook Twitter YouTube
     
  40. hierro__

    hierro__

    Joined:
    Sep 22, 2014
    Posts:
    59
    Hi, I just buyed your asset for a delivery i have these hours (...) actually I need to contrast a texture, coming from a camera.
    It's working really fine in editor, but as build it doesn't work, from debug I saw that is missing shaders in path Hidden/....,
    I'm currently using Unity 5.4.f3 pro, and gtx 1080, how can i have this working in a build ?

    Thank you
     
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Add all used TextureAdjustment shaders into Always Included Shaders array, in Graphics Settings window.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Sep 14, 2016
  42. SteveXu

    SteveXu

    Joined:
    Jul 22, 2013
    Posts:
    15
    version 2.21
    How to scale texture2d smoothly? TextureResizePro.ResizePro is not smooth, is there a scale mode can be set? such as:Linear etc
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    It includes ResizePro plugin (example here). There is only one scale mode (name is not defined).



    VacuumShaders - Facebook Twitter YouTube
     
  44. SteveXu

    SteveXu

    Joined:
    Jul 22, 2013
    Posts:
    15
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    The quality is excellent!
    It is GPU accelerated and interpolation algorithm name is irrelevant.
    ResizePro.png



    VacuumShaders - Facebook Twitter YouTube
     
  46. SteveXu

    SteveXu

    Joined:
    Jul 22, 2013
    Posts:
    15
     
  47. SteveXu

    SteveXu

    Joined:
    Jul 22, 2013
    Posts:
    15
     
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    If using editor there are no unused files. If only run-time API then Shaders folder can be deleted.



    VacuumShaders - Facebook Twitter YouTube
     
  49. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    241
    This asset looks pretty great! I'm looking for something quite similar but also with support for multiple images to be used and blend modes to be applied between combinations of Hue Saturation and Luminosity nodes. Also I need this to work on mobiles (So not using RenderTextureFormat.ARGBFloat / TextureFormat.RGBAFloat). Would this package be suitable for what I'm after / could it be?
     

    Attached Files:

  50. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Two textures can be blend with built-in 18 blend modes. Additionally can be used Mask texture options.
    texture-adjustmetns.png

    As for RenderTextureFormat, default settings are used.
    If SystemInfo.SupportsRenderTextureFormat returns true, plugin should work.



    VacuumShaders - Facebook Twitter YouTube