Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to create normal Maps and Masks for Sprites using with 2D light

Discussion in '2D' started by trcdev, Sep 24, 2020.

  1. trcdev

    trcdev

    Joined:
    Sep 18, 2018
    Posts:
    5
    Hello everyone,

    I am trying to create normals maps and masks for my sprites in my 2D game using the new 2D light feature.
    In the Lost Crypt demo by Unity there are some preset sprites with beautiful normal maps and mask textures.

    Since I don't find anything on the forum I would like to ask, if any of you know, how to create those textures.

    This is for example the preset texture from Unity.
    Sprite_Foliage_1_Color.png

    Additionally they have provided a normal map for this texture.

    Sprite_Foliage_1_Normal.png

    As well as some mask for the 2D sprite shader.

    Sprite_Foliage_1_Mask.png


    I know that there is some option to auto-generate a normal map in photoshop however I am not able to achieve the same results as the unity team.
    Also I have no clue at all how to create the pink mask which is responsible for ligthting of the textures.
    Are there some tricks or do I have to paint it by hand?

    I would appreciate any help.


    Thanks a lot and best regards
     
    zhukster95 likes this.
  2. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    246
    Hey trcdev, I'm not sure if this would answer your question in any way but while waiting for someone who knows more about this subject matter to share more with us, I would like to chime in here.

    I recently chanced upon this tutorial on Normal Map Creation using Photoshop which was very helpful to me:


    From this video, I learned that it sometimes helps to convert your diffuse map into black and white first and then bump up your contrast for Photoshop to be able to better detect and generate better pixel height difference for normal maps.

    Also, I was playing around with an open-source Online Normal Map Generator which I thought might interest you too: https://cpetry.github.io/NormalMap-Online/
     
  3. trcdev

    trcdev

    Joined:
    Sep 18, 2018
    Posts:
    5
    Thanks a lot for the links!

    This already helped me a lot to create better normal maps.
     
    Xiangting_Su likes this.
  4. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    246
    You are most welcome! ;)
     
  5. ursxiz

    ursxiz

    Joined:
    Jun 18, 2020
    Posts:
    6
    Thank you for answer on Normal map, but I am still hoping somebody could provide an answer on how to create those "pink" mask, that is then used by Lit shader.
     
  6. mishakozlov74

    mishakozlov74

    Joined:
    Aug 8, 2018
    Posts:
    133
    Bump, I can't find any information about those pink masks.
    Could somebody explain how to create them or just what are they?
     
    cdr9042 and jeduhy0 like this.
  7. SintDaBuzz

    SintDaBuzz

    Joined:
    Nov 24, 2020
    Posts:
    6
    https://blog.unity.com/technology/get-to-know-dragon-crashers-our-latest-2d-sample-project

    "Mask maps can also be harnessed by the 2D Renderer data asset (RenderData_2D.asset in the project), part of the Light Blend Styles feature. The Light Blend Style called “Fresnel” is used to accentuate the rim light around characters and sprites. To achieve the fresnel effect, for instance, select to use the R channel information from the Mask maps. In this particular project, we only have one Light Blend Style, so the three channels – R, G and B – look the same (black and white). This makes the process of creating Mask maps more convenient."

    And:
    https://blog.unity.com/technology/download-our-new-2d-sample-project-lost-crypt
     
    Last edited: Apr 13, 2022