Search Unity

► uNormal ◄

Discussion in 'Works In Progress - Archive' started by Arkhivrag, Dec 21, 2016.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Social.png

    uNormal is tool for fast generating Normal, Specular and AO maps from a simple Heightmap texture.

    For editor and run-time use.
    No hardware or software requirements. Works on any device.








    VacuumShaders - Facebook Twitter YouTube
     

    Attached Files:

    Last edited: May 16, 2018
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    pixelsteam likes this.
  3. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    Can you talk a bit about the intended usage here?

    Is the idea to store just albedo and heightmap textures, and let the game produce any needed normal, specular, and AO textures on the fly?
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Exactly.



    VacuumShaders - Facebook Twitter YouTube
     
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    jonfinlay likes this.
  6. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    This is very interesting. I would love to see a video of how you set it up for runtime use. It seems rather mysterious at the moment. Also, can this be used to make texture maps from a diffuse in the editor? Or is it only during runtime? What ab out changing settings on the maps during runtime?

    Basically, can you give an demonstration on how to use this? Thanks.
     
    Knightmore likes this.
  7. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I am interested in having a smaller drive footprint and faster download for my game, but I'm not sure this method translates well to all types of art.

    Is this intended mainly for something like low poly art? Or architecture more than characters? Or is it more broadly applicable than I think?
     
  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Editor and run-time functionality are the same. Options can be changed dynamically.

    Run-time API is very simple, just like this:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. using VacuumShaders.uNormal;
    4.  
    5.  
    6. public class uNormal_Runtime : MonoBehaviour
    7. {
    8.     public Texture sourceHeightmap;
    9.  
    10.  
    11.     public uNormal_NormalMap normal;
    12.     public uNormal_SpecularMap specular;
    13.     public uNormal_AmbientOcclusionMap occlusion;
    14.  
    15.     // Use this for initialization
    16.     void Start ()
    17.     {
    18.         //Normal map
    19.         Texture2D tN = normal.RenderToTexture2D(sourceHeightmap);
    20.         GetComponent<Renderer>().sharedMaterial.SetTexture("_BumpMap", tN);
    21.  
    22.  
    23.         //Specular map
    24.         Texture2D tS = specular.RenderToTexture2D(sourceHeightmap);
    25.         GetComponent<Renderer>().sharedMaterial.SetTexture("_MetallicGlossMap", tS);
    26.  
    27.  
    28.         //Ambient Oclusion map
    29.         Texture2D tAO = occlusion.RenderToTexture2D(sourceHeightmap);
    30.         GetComponent<Renderer>().sharedMaterial.SetTexture("_OcclusionMap", tAO);
    31.     }
    32. }
    33.  

    Run-time API offers two functions only:
    • public Texture2D RenderToTexture2D(Texture _heightmap) - Resultant texture is returned as Texture2D object.
    • public void RenderToRenderTexture(Texture _heightmap, RenderTexture _dstTexture) - Generated texture is saved inside _dstTexture RenderTexture object.
    uNormal.png


    Normalmap, Specular and Occlusion maps are generated from Heightmap. If Diffuse texture is used instead then R channel will be used as Heightmap source.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 14, 2017
    SAOTA likes this.
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Last edited: Jan 14, 2017
    theANMATOR2b likes this.
  10. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    The code is almost meaningless to anyone not a coder, but thanks for sharing anyway. The gifs are great, thank you.

    So the only problem I see is that I wanted to use this to make maps for artwork that does not have them (3rd party models) but not all artists supply a height map. I can make from diffuse though as you said so that might work.

    Looks very interesting and I will probably get it. It is priced so that I don't mind an experiment although I imagine it might be worth more than your price. :)

    Thank you!
     
    theANMATOR2b likes this.
  11. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    For others, make sure you preload shaders and have those materials in resource folders for this to work at runtime!.
     
  12. mgrugl

    mgrugl

    Joined:
    Mar 1, 2017
    Posts:
    23
    Hi, I just wanted to say that I find your asset a great addition to my workflow. Any plans to update it for Unity 2017?
     
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    After official release.
    Beta versions can not be supported.



    VacuumShaders - Facebook Twitter YouTube
     
  14. GoRolyGo

    GoRolyGo

    Joined:
    Jul 7, 2015
    Posts:
    27
    so you whould need just acolour texture like tiles, and it whould be converted? Awsome if true:)
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    It must be heightmap. If you use regular diffuse texture then tool will read height info from Red channel.



    VacuumShaders - Facebook Twitter YouTube
     
  16. GoRolyGo

    GoRolyGo

    Joined:
    Jul 7, 2015
    Posts:
    27
    1 - what whould be the best and easyest way to create a heightmap if only have a picture or a regular photo?
    EDIT: atm i am using Oculus Meduim with opacity painter, but havent mastered it yet tho:)

    2 - whould it be a idea to auto name as the type of map when export, having hard time knowing what map it is when export :)

    3 - Whats the Roadmap, are theer plans for to suport more map types?
    Anyway i am hapy as it is, but curioas if there is a roadmap, i am new to unity maping stuf :)
    and this looks very intresting and powerful tool, even more so if it gets more feutures. it is realy cheap. sale or no sale :)

    intrested in:

    - Metalic,heightlight,reflection map
    - Emission map
    - Detail map
    - Translucent map
    - secondary Detail albedo x2
    - Secondary Normal map

    dont know if those are the way it works, i am new but very intrested in maping:)

    Kind Regards
    Daniel
     
    Last edited: Sep 29, 2017
  17. quadspinner

    quadspinner

    Joined:
    Mar 11, 2017
    Posts:
    3
    Hi Davit,

    Just got this yesterday, and it is a wonderful tool! Just like TerrainToMesh and Beast, which I use a lot too. I asked this on FB, but thought I'd ask here as well. The result seems to be clamped to 255 bytes, so detailed heightmaps are giving out quantized normals. I'm assuming you are clamping it to a byte's max value. Would it be possible to add an option to use a float's max value? That way, higher quality normals would be an option.

    Thanks,
    Dax
     
    hopeful likes this.
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    I'll check it what can I do.



    VacuumShaders - Facebook Twitter YouTube
     
  19. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Hi there!

    Could you please extend the tool so that it can use a normal to generate an approximate heightmap as well?

    I've seen some approaches/tools to such task, and I'd be glad to just use uNormal instead of having to resort to multiple tools.

    Also, it's more frequent to just have albedo and normal maps available, so that would extend the field of use of uNormal quite a lot!

    Best,
    Alessandro
     
    hopeful and transat like this.
  20. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Does this work on 2018.3 as well?
     
  21. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    bump :)
     
    hopeful and NeatWolf like this.
  22. cultureulterior

    cultureulterior

    Joined:
    Mar 15, 2015
    Posts:
    68
    The preview doesn't work in 2020
     
  23. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,982
    Tool supports all Unity version including 2019.3
    Unity 2020 will be supported after it is officially released.



    Amazing Assets - YouTube Facebook Twitter
     
    cultureulterior likes this.