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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Do alpha&rgb mask/channel textures work in Unity?

Discussion in 'General Graphics' started by Jakers12, Apr 26, 2018.

  1. Jakers12

    Jakers12

    Joined:
    Nov 23, 2016
    Posts:
    10
    In Blender, and I suppose other 3d software as well, you can have a main texture for a terrain that is just black and white and then you can assign black to be a....for example green grass texture and white can be desert or gravel texture. You then control (size, specularity, normal maps,etc.) the grass/gravel textures separately from the main black/white image and you can have very large terrains, but you don't need extremely large textures to prevent the terrain looking pixelated. If I am correct, essentially this is what you are doing in 99% cases in map editors in various games when you have a brush that paints a texture on the terrain.



    So, how does Unity deal with this? I have a black/white image, a grass and a gravel texture, so 3 images in total and I just need to assign them to work somehow in Unity. Also, if this works, is there a way to add more textures? In Blender you can add 3 textures using a RGB channel, so instead of painting black and white, you paint red, green or blue, but I think that that is the maximum in using this in Blender.
     
  2. GuyStreamsStuff

    GuyStreamsStuff

    Joined:
    Dec 22, 2017
    Posts:
    27
    Also looking for an answer to this. Trying to texture a map for my game but even in smaller chunks it is too big.
     
  3. Jakers12

    Jakers12

    Joined:
    Nov 23, 2016
    Posts:
    10
    Apparently this is what we are searching for: https://docs.unity3d.com/Manual/StandardShaderMaterialParameterDetail.html

    "Secondary Maps (or Detail maps) allow you to overlay a second set of textures on top of the main textures listed above. You can apply a second Albedo colour map, and a second Normal map. Typically, these would be mapped on a much smaller scale repeated many times across the object’s surface, compared with the main Albedo and Detail maps.

    The reason for this is to allow the material to have sharp detail when viewed up close, while also having a normal level of detail when viewed from further away, without having to use a single extremely high texture map to achieve both goals.
    "

    However either I am too dumb to understand or it's simply not explained how to have 2 textures that are based on the main black/white one. :(
     
  4. GuyStreamsStuff

    GuyStreamsStuff

    Joined:
    Dec 22, 2017
    Posts:
    27
    Man I have no idea...
     
  5. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    This is basically what Unity terrain is doing. But there is no built-in way to import a map to use as a "mask" on it, you'll need to paint it directly to the terrain.

    Else, this can be done on any arbitrary mesh with a proper material (this can be called layering), but there is no built in shader to do this. You either have to write your own, or get one from the asset store / internet.

    In a similar way, you can use PolyBrush to do this, but instead of using a texture to handle the masks, it's using vertex colors : https://unity3d.com/unity/features/worldbuilding/polybrush
     
  6. Jakers12

    Jakers12

    Joined:
    Nov 23, 2016
    Posts:
    10
    Can I then turn meshes into terrains somehow, but while still keeping their regular textures? Regular as in just average, not masking textures or anything, just a average diffuse texture. If I need to paint the high res texture inside Unity on a terrain object, then maybe I can paint a low res version in Blender, save it as a regular low res texture and then bring it in Unity and repaint it with a higher resolution brush in Unity?

    I know that I can bring a mesh into Unity and turn it into a terrain, there is a free script you can download to do that, but that just gives you a white terrain without anything and I need something to base where I paint high res textures on, because I want to paint over a satellite imagery terrain and I want a gravel texture where there's gravel in real world and so on. I can do that in Blender and already have, I just want to know how I can get that to work in Unity.
     
  7. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642