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

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.

Additionally they have provided a normal map for this texture.

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

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

1 Like

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: NormalMap-Online

Thanks a lot for the links!

This already helped me a lot to create better normal maps.

1 Like

You are most welcome! :wink:

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.

Bump, I can’t find any information about those pink masks.
Could somebody explain how to create them or just what are they?

3 Likes

“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:

My search began with a similar question as trcdev, and led me to a bunch of non-Photoshop alternatives, of which Materialize was my favorite. Worth checking out.

My follow-on question though has to do with the use of these Normal Maps as Secondary Textures. Lost Crypt applies these Maps from the Sprite Editor/Secondary Textures window as _NormalMap. However, if you look at the actual Normal and Mask Sprites from the Assets window, they are designated in the Inspector as Texture Type/Default. I would assume that they would be Texture Type/NormalMap. Sara’s Normal files are designated Texture Type/Sprite2D rather than (again) a Normal Map.

Is there a reason that these images that are specifically being used as Normal Maps are not being designated correctly in the Inspector?
9544246--1348096--upload_2023-12-22_12-35-1.png

9544246--1348096--upload_2023-12-22_12-35-1.png

If you leave it in default state (as sprite) and use it as normal map, you will get default values. If you change to normal, you can tweak some things. Mask maps don’t have any special options, so they are just sprites.
As for normal map - ControlNet for Stable Diffusion creates great normal/depth maps. It’s maybe bit overkill to use AI like that, but it’s useful to know Stable Diffusion and ComfyUI.

What things can be tweaked when using texture type “Normal map”?