Jump to content

How do mask maps work in URP?


vdeijk
Go to solution Solved by vdeijk,

Recommended Posts

  • Solution

Hi, I've been trying to create mask maps in URP, and this has led to a significant improvement in the quality of my terrain. However, as the official docs are so lacking, I'm not sure whether I've done this 100% right.

My textures from gametextures.com have an opacity map, an emission map, and a height map, but it doesn't seem like I can integrate them into my mask maps. Is that correct? Is there any other way to add these maps to my terrain? 

Conversely, the mask map's alpha channel seems to be for a smoothness map, which I do not have. 

To solve this problem, I made the alpha channel completely white in GIMP, but this led to an extreme amount of glittering. I solved this using Unity's channel remapping feature, but again, this may not be the optimum approach. 

Also, is it true that URP cannot handle Detail Maps, meaning the blue channel of my mask maps should remain completely black?

Based on the above, is there anything I can do to improve my mask maps? Could the Glyph terrain shader help with this in some way? 

 

Link to comment
Share on other sites

I know this post is a bit more involved than most, but I could really use some feedback! Also, I'd be happy to buy the Glyph terrain shader or whatever else is needed to improve my current workflow. Many thanks!

Link to comment
Share on other sites

Hi @vdeijk, the unity mask maps are documented in the terrain layer page of the Unity Manual
https://docs.unity3d.com/Manual/class-TerrainLayer.html

The coding for the different channels of the mask maps in HDRP / URP is:

 

R => Metallic
G => Ambient Occlusion
B => Height
A => Smoothness (Diffuse Alpha becomes Density)

You can put the height map in the blue channel, but if I remember correctly the URP terrain shader does not do anything with height blending. For the alpha channel remapping like you did already is the way to go, you could put a gray tone in there, but if you have white in there you can just freely adjust with the remapping from full to partial smoothness whereas you would not have the full range available if you put in a dark gray texture for example.

There are also tools that allow you to create those mask textures from the remaining other textures that you have available, take a look at "Materialize" for example, it is free:
http://boundingboxsoftware.com/materialize/
With this you should be able to create a smoothness texture that even if it is not 100% correct should look a bit more interesting because the smoothness will not be evenly applied across the texture.

Glyph will not help you with the missing mask map textures as it uses the same format, but I would dare to say if you want to maximize the look of the terrain itself it is a no-brainer to get because it would give you a lot of additional terrain rendering features that you simply do not have with the default unity terrain shader.

 

Link to comment
Share on other sites

Hi Peter, thanks for the reply and the info. Yes, you're right about height blending in URP (at least that is what I gathered from other sources). Materialize sounds like a great tool, although there doesn't appear to be a version for macOS.  

Yes, Glyph should work very well for my terrains, as the game is set on Mars, and Mars has no vegetation whatsoever. I'll definitely get it down the road, but first I need your stamp bundle to create terrains that are more appropriate for Mars (crater fields, sand dunes, eroded valleys and mountains, etc.). You can probably guess how that would make a difference from the screens here: https://vdeijk.itch.io/mars-commander

Glad to hear I made my mask maps exactly the right way!

 

Link to comment
Share on other sites

This is for anyone reading this in the future. 

Not sure why I can't edit the above post, but I'll write my thoughts like this. As it turns out, URP can do height blending, but only when you have a maximum of 4 terrain textures. That means I had to delete one of my terrain layers, but the result was well worth it. 

In URP, height maps go in the blue channel. In HDRP, detail maps go in the blue channel. Both have different functions but are beneficial. 

  • Like 1
Link to comment
Share on other sites

  • Bryan locked this topic
Guest
This topic is now closed to further replies.
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...