Home Technical Talk

Blending textures

polycounter lvl 6
Offline / Send Message
D4N005H polycounter lvl 6
Hello. I am making an island... I am investigating some popular games to learn about it and so that I can make a better island for my game. There is a question for me, I'd be happy if you help and try to answer it according to your experience.
The question is, how to mix two textures and blend them OR more importantly, make one texture over an other one exactly like the images that are shown below? I want to know the techniques and also I use Autodesk 3DS Max 2016 service pack 2.







Replies

  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Anyone know anything about this? Could it be a vertex color or two planes which the second plane is on top of the first one?
  • .Wiki
    Offline / Send Message
    .Wiki polycounter lvl 8
    The textures are blended by vertex-colors on the terrain mesh. The white lines for the parking-lots are usally decals. Decals are polygon-meshes that are on top of the actual geometry.
  • Michael Knubben
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    .Wiki said:
    The textures are blended by vertex-colors on the terrain mesh. The white lines for the parking-lots are usally decals. Decals are polygon-meshes that are on top of the actual geometry.
    Thank you so much, so I'll be studying "Decals" soon.

    MightyPea said:
    http://wiki.polycount.com/wiki/MultiTexture
    http://wiki.polycount.com/wiki/TexturingTutorials
    http://polycount.com/discussion/68716/vertex-painting-texture-blending

    For future reference, I found this all in the first four hits on Google with the topic title as a search term, plus "polycount":




    Well ... a good trick :smile: . Okay I'll search google in this way. Seems I would get better results with this trick. Thanks.


  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Hmm there is small but important problem. When I paint the vertexes in 3DS Max with Pure R, G and B, I can assign each color an image in Unity3D (See below) with a custom shader, but I don't know how to assign those images in 3DS Max, I've searched the Net and nothing is shown but "Blending in max" which is about painting the vertexes with black and white, I am painting the vertexes with red, green and blue so Black/White is not my business. So how would I be able to assign each vertex color an image?
    Download the custom shader here (I created it with ShaderForge) :
    http://www.filedropper.com/vertexcolor

  • Eric Chadwick
    You need to make a custom shader in 3ds Max. You can use Shader FX to make the shader.

    But instead, I recommend you use the Terrain object in Unity to blend your textures. It has good tools for painting blends, and it already has a built-in shader.

    For blending on non-terrain meshes, you could use VPaint or ProBuilder.
    https://www.assetstore.unity3d.com/en/#!/content/9100
    https://www.assetstore.unity3d.com/en/#!/content/11919
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    You need to make a custom shader in 3ds Max. You can use Shader FX to make the shader.

    But instead, I recommend you use the Terrain object in Unity to blend your textures. It has good tools for painting blends, and it already has a built-in shader.

    For blending on non-terrain meshes, you could use VPaint or ProBuilder.
    https://www.assetstore.unity3d.com/en/#!/content/9100
    https://www.assetstore.unity3d.com/en/#!/content/11919
    Thank you for the answer. But correct me if I'm wrong, I should go with ShaderFX because I am making the island according to a big detailed Google Map image, so I am making the island with the help of the tools that are available in 3DS Max, for example I made the plane (terrain) transparent (with the alt+x keys in 3DS Max) so that I can see through the mesh (so that I can see the Google Map image which is under the plane) and paint the vertexes carefully. I guess I can't do these advanced operations in Unity3D.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay, I've made a shader in ShaderFX and now 3DS Max can do what I wanted. Download the shader here:
    http://www.filedropper.com/3dmaxvertexcolor-shaderfx

    Here is what I see in 3DS Max:




    And here is what Unity3D shows with the shader I've talked about in my previous post:
    So everything is okay somehow.

    Two Important Questions:
    1) Decals in 3DS Max (according to my research) are created by Composite map, Unity3D doesn't support that, so I should use a plane with a transparent texture in 3DS Max so that I can recreate the decal I showed in the first image of my first post in this thread, in Unity3D (something similar to the video below). Wouldn't that affect performance? I think there should be a better way to add decals in Unity3D.
    https://www.youtube.com/watch?v=qdZYxSG9WIA
    2) The terrain you've seen is actually a part of my game (it is 0,12%  of all of the city) (however I'll re-paint the vertexes and re-adjust the UV coordinates) but I don't know whether it is too much highpoly or it is fine?

  • Eric Chadwick
    You should use the Unity Terrain system for large meshes like this. It is optimized for game rendering.

    You can bake the vertex color from Max into a "splat map" for the Terrain. You can also bake the height map. There are 3rd party tools for importing Terrain data.

    Once it is in Unity, you can paint directly into the splat map, and sculpt the heights directly.

    Decals are expensive, because of alpha blending. Instead, blend the road edges to a terrain texture, and project the UVs in World space. You will need a Unity shader editor, like Shader Forge.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    OK, I just got confused.
    ... You can bake the vertex color from Max into a "splat map" for the Terrain. You can also bake the height map. There are 3rd party tools for importing Terrain data ...
    Do you mean I should do these steps:
    1) Make a small part of the city in 3DS Max (As I did and you saw in my last post in this thread)
    2) Paint the vertexes of that part of the city, then export the painted vertexes as a "splat map" and also I should bake a height map of the mesh
    3) Open Unity3D and create a terrain there which the size of the terrain is not important (?)
    4) Import the splat map and also the height map into the terrain in Unity3D
    4.1) I guess after this step, the newly created terrain would look like the mesh I've made in 3DS Max
    5) Paint the vertexes exactly according to the splat map
    6) Repeat all of the steps for another part of the city
    7) Put all the terrains near each other so that I can have the final city (whole city)
    ?
    And another question is below:
    ...  blend the road edges to a terrain texture, and project the UVs in World space. ...
    Thanks for the tip, but what about the parking lines, the drain covers and the manholes and potholes on a road?


  • Eric Chadwick
    Yeah that's basically it. Although I would recommend you make individual meshes in Max, but do all the assembly in Unity, including starting the Terrain from nothing. If you've done a bunch of work already, you can import that, then continue editing terrain in Unity.

    I have some links for creating Unity terrains. 
    http://docs.unity3d.com/Manual/terrain-UsingTerrains.html
    https://alastaira.wordpress.com/2013/12/07/custom-unity-terrain-material-shaders/
    http://acegikmo.com/shaderforge/wiki/index.php?title=Basic_Terrain_Setup
    https://www.google.com/?gws_rd=ssl#q=terrain+site:http://forum.unity3d.com/

    I use this tool to import terrain data, works pretty well.
    https://www.assetstore.unity3d.com/en/#!/content/21223

    For the road lines, I would recommend using making a custom road shader, so you can blend those into the pavement surface.

    For the drain covers, potholes, etc. I think decals are best. Some won't need alpha blending. For potholes to look indented, you could use parallax mapping.

    There are also many road systems on the Unity store, worth a look.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Great thank you Mr.Chadwick. I will study parallax mapping soon, but now I know what to do.
    There are also many road systems on the Unity store, worth a look.
    Yes, I've seen them and even I had a conversation with the author of one of the best road systems and then I came to this conclusion that the best method of creating the roads is to make them manually in the 3DS Max. Fortunately, it's been about a year that I am making the roads in 3DS Max and I do it faster than before but still more than 75% of the roads are still not created. Also creating manually would give me an opportunity to add stuff (like speed breakers, trash, small 3D potholes and also decals) on the road randomly while those road systems are not advanced enough to do so.
    Anyways, thank you all for your helps.

  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Well I did paint the vertexes according to a google map image.
    Here are the images:

    Is everything right about it? Should I continue this or is there something wrong? I asked this because I don't want to waste time.
  • Eric Chadwick
    How well does it work in Unity? If you use a large mesh for the ground, it will make the game render slowly, because the distant triangles are very small on screen which is difficult for the graphics card to render. This is why the Terrain system is better, because it decreases the vertex count for distant surfaces.

    Other than that, it looks OK so far. The road-to-ground transition is not very good yet though.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    How well does it work in Unity? If you use a large mesh for the ground, it will make the game render slowly, because the distant triangles are very small on screen which is difficult for the graphics card to render. This is why the Terrain system is better, because it decreases the vertex count for distant surfaces.
    I do want to use the Unity3D Terrain system I think there is a misunderstanding here.
    According to what you've advised, I am doing the second step of the steps that are described in the 11th message of this thread. Which means I am painting the vertexes and then after I finished doing this, I should make a "splat map" as you've advised and then I should do the rest of the steps. 
    Other than that, it looks OK so far. The road-to-ground transition is not very good yet though.
    I'll paint the side of the roads in Unity3D later.

    Now I hope there is no misunderstanding, other than the road to ground transition, do you see anything bad?
  • Eric Chadwick
    It is better to do a smaller test scene, so you can verify all steps, before you make the whole thing. If you make the whole scene, one step at a time, you will have to re-do a lot of work if a particular step does not work properly. It is better to work small, so you can learn quickly.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay I will make a test scene now. I'll edit this post and share the results as soon as possible.
  • Eric Chadwick
    Better to reply with a new post. It will send an email notification to anyone who has marked the thread as a favorite.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Better to reply with a new post. It will send an email notification to anyone who has marked the thread as a favorite.
    Okay.
    Well before I continue, would you explain a bit more about the colored sentence below.
    ... I would recommend you make individual meshes in Max, but do all the assembly in Unity, including starting the Terrain from nothing. If you've done a bunch of work already, you can import that, then continue editing terrain in Unity.
    This is weirdly became complicated... or I am tired ... exactly 12 hours passed and I didn't make the terrain successfully...  :| I thought it is way easier...
  • Eric Chadwick
    It is difficult to import terrain. It is possible though.

    The red sentence means to make meshes in 3ds Max, and arrange them in Unity.

    All except for the ground. Make that mostly in Unity with Terrain objects.

    You should be able to import the work you've done already. But you should do the rest of the work in Unity. This will give you the best results.

    If you were doing a small playable area, then it would be ok to work with only meshes. But you are making a large area.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    It is difficult to import terrain. It is possible though.

    The red sentence means to make meshes in 3ds Max, and arrange them in Unity.

    All except for the ground. Make that mostly in Unity with Terrain objects.

    You should be able to import the work you've done already. But you should do the rest of the work in Unity. This will give you the best results.

    If you were doing a small playable area, then it would be ok to work with only meshes. But you are making a large area.
    Ah... I thought you said I should make all the meshes including the ground in 3DS Max and then recreate the ground meshes in Unity3D... :D:D I was wrong then.
    I'll try to create exact terrain same as the ground I made in 3DS Max. will share the results in a new post ASAP.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay finally I can make exact terrain in Unity3D, here is what I did:

    1) Split the terrain in 3DS Max and export a part of it to the Unity3D.
    1.a) I made sure the units are the same for Unity3D and 3DS Max. now we have this mesh in Unity3D:

    2) download and install this C# script, this script makes a terrain in unity3D then with the help of the Raycast it makes a height map (apparently) and then there we go, we have a terrain exactly same as the one that we had in 3DS Max:


    That was the easy part, the harder part is how to import the vertex colors, you (Mr.Chadwick) mentioned "Splat maps" I should now try to find a way to do so with the map.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    You can extract the vertex colors with Xnormal.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay, I was totally wrong with the idea of RGB vertex painting in 3DS Max. I just now understood more of what Mr.Chadwick actually meant with "creating terrains from nothing in Unity3D" and "Splat maps", I must have painted the "terrain" vertexes in "Unity3D" with RGB and A which means I need a tool for this in Unity3D. So now I am interested in this tool, have a look at this video of:
    https://www.youtube.com/watch?v=Vv2vdCqwRg4&list=UU2Q1r32_A7k_ygcWioKWVJQ&feature=iv&src_vid=rJOn8SJ4zAI&annotation_id=annotation_3235012535
    Still the problem is how to paint the vertexes with RGBA according to a google map image in 3DS Max. I'll try to find out and show here.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Obscura said:
    You can extract the vertex colors with Xnormal.
    Oh okay that helps a lot. Thanks... I have no idea why I haven't seen your post before I send my previous post. By the way, I guess I should do something to paint alpha too, I have already done painting vertexes with RGB but I haven't done anything with A. so logically after I paint the ground in 3DS Max with RGBA, I can export the RGBA colors with the Xnormal (modifier?) and then import it to Unity3D and assign it to the terrain. Am I right or did I messed up something again?
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Xnormal is not a modifier, its a standalone application, and it can be use to extract different kind of maps. So all you need to do is to download Xnormal (its free), import your model into Xnormal, and bake down the vertex colors, and then use that as a splat map. But... I would guess that Unity has its own terrain material, with more than 4 layers, and you should be able to paint the layers right inside Unity. That would be a smarter way for doing the thing that you want. I'm not a Unity user, but basically I cannot imagine that it doesn't have a pre-made terrain material with option to paint layers.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6

    Obscura said:
    Xnormal is not a modifier, its a standalone application, and it can be use to extract different kind of maps. So all you need to do is to download Xnormal (its free), import your model into Xnormal, and bake down the vertex colors, and then use that as a splat map.
    Oh okay ... got it.
    Obscura said:
    you should be able to paint the layers right inside Unity. That would be a smarter way for doing the thing that you want. I'm not a Unity user, but basically I cannot imagine that it doesn't have a pre-made terrain material with option to paint layers.

    Unity3D does have a terrain shader but I want to paint the vertexes according to a google map image. In 3DS Max, I am able to make the ground object "see-through" mode (with alt+x) and then I can paint it according to a plane which is under the ground mesh and has a texture of google maps on it... .So in this way the results could be more realistic. I hope I said it clearly.

    I am searching to see if it is possible to use a see-through mode in Unity3D or not.

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Just make it transparent? Or you can place an another plane, which would have the google maps image, and it would be transparent. This is definitely possible to do.
  • Eric Chadwick
    I would recommend you convert the google map into a splatmap in Photoshop. Then you can edit the splatmap on the terrain in Unity. That would save you the step of re-painting it in 3ds Max. You need to learn how splatmaps work, so you can convert it properly.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Eric - By a "splatmap" basically you mean some mask textures packed into the channels of a bitmap right?
  • Eric Chadwick
    Yes. It uses all four channels, rgba. Unity does allow more than four layers, which increases the number of splat maps. You can also use custom shaders, which I've been doing lately to get more detailed blends.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Mr.Chadwick, Photoshop only can make RGB (As is shown below) ,... hmmm if I use a transparent supported image format like "PNG", does it make RGBA?
    And I don't know how to import splat map into a terrain in Unity3D... .
    https://www.youtube.com/watch?v=U-c9FnsXT_s
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Obscura said:
    Just make it transparent? Or you can place an another plane, which would have the google maps image, and it would be transparent. This is definitely possible to do.
    Well if the splat map method didn't work, I'm going to go with this way.
  • Eric Chadwick
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Yup the script there is very useful. But it only works if the terrain had a splat map before, apparently if I create a new terrain in Unity3D, there would be no splat map for it. But I've found a better thing to work with stay tuned and I will share the results ASAP...hopefully this should work. Well I guess the only possible way is to make a transparent plane and put the google map image on it and then start painting vertexes of the terrain in Unity3D.
    EDIT The photoshop method that Mr.Chadwick said is not working because I tried to do so but Unity3D seems never let me to import a splat map (not replace the splat map).
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    :| so I made a shader that makes the plane transparent and then put the terrain under the plane and started painting the vertexes... even before I start, a problem occurred the tool said "Please select a mesh" which means it cannot paint terrain.
  • Eric Chadwick
    Terrain in Unity doesn't use vertex colors to blend the terrain textures. Instead you paint into a bitmap called a splatmap. If you are using a Terrain in Unity (GameObject > 3D Object > Terrain) then you can't use a vertex painting tool.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay, I have been searching all of the methods you guys mentioned, recently and still learning new stuffs about it.
    @Obscura I installed XNormal, searched how to extract maps and it is working, but it doesn't extract splat map apparently. I've searched again and I've read some posts about it, it seems XNormal reads the vertex colors but I found no way to export the bit map with it.

  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Okay, I downloaded bunch of assets recently and none of them do what I want.
    ....
    So what I did so far:
    1.  Tried to export splat map from max with XNormal : failed
    2.  Tried to import a splat map from Photoshop to Unity3D with some assets: failed
    3.  Tried to paint the vertexes in Unity3D: failed
    4.  Tried to import the mesh from 3DS Max then convert it to terrain with some assets and then apply custom shaders : it was okay but it seems that the terrains don't have the splat map which the original mesh has. so overall: failed
    So now... lets forget everything, imagine if you were me and wanted to paint those "splat maps" in Unity3D with a help of Google maps, what would you do?
  • Eric Chadwick
    Learn how to overcome your failures. Each of those failures actually has a solution. I've done each of those things successfully, after many failures, which I worked around to figure out my solution. Get better at internet searches, read a lot of links. It looks to me like you haven't read the info in the links I posted.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    @Eric Chadwick Actually I did read some of the links but yeah I should try more and ask less ,okay. I am trying to find a solution,though.
    Also I managed to render the splatmap from 3DS Max with the help of "vertex color material" and I can edit that in Photoshop. which means now I have the "splat map" or "vertex colors map (As far as I learned, if we render vertex colors to a texture 2D, then the texture is called splat map)" and I have the terrain. See a part of it below:

    The one and only important problem is how to import the splat map into the shader I use for terrain. (which is called Relief Terrain Pack) if I import it to the shader, the RTP has a feature to edit the splat images and also has a tool to paint the terrain.


  • Eric Chadwick
    If you are using a Terrain asset, the splatmap is stored inside the Terrain Data asset. 

    ​Select the Terrain. It should have a Terrain component in the Inspector. In the Terrain component click the Terrain Data object. In the Project window, click the triangle next to the Terrain Data object, and click on the Splatmap. This is where it is stored. You need a script to export or import this map.

    Here's one script, which imports a splatmap and adds it to the Terrain Data object.
    https://www.world-machine.com/learn.php?page=workflow&workflow=wfunity
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    If you are using a Terrain asset, the splatmap is stored inside the Terrain Data asset. 

    ​Select the Terrain. It should have a Terrain component in the Inspector. In the Terrain component click the Terrain Data object. In the Project window, click the triangle next to the Terrain Data object, and click on the Splatmap. This is where it is stored. You need a script to export or import this map.
    Okay I definitely will try this. And will share the results in a new post here ASAP.
    Here's one script, which imports a splatmap and adds it to the Terrain Data object.
    https://www.world-machine.com/learn.php?page=workflow&workflow=wfunity
    Yes Mr.Chadwick you have already sent the link to me yesterday. it is useful, but at the time you've first sent it I didn't know the fact that the splat map is available in the Terrain component. But now I know it, so now the script is useful for me. Lets see what I do, hopefully there should really be no problem!!

  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    @Eric Chadwick  I simply LOVE you... after 4 days.... full 48 hours... full 48*60 minutes NOW IT IS WORKING LIKE A CHARM!! I am now in heaven (well for some second then I go to hell :D ... because soon I should create rest of the city in the 3DS Max, but I love it :D )
    BTW, I am now able to make splat maps in Photoshop. Actually I've learned how to Import terrain parts in Unity3D  from 3DS Max and then make new terrains according to them and then I can import splat maps from max to Photoshop to fine tune them then assign them to the new terrains and then there we go... an amazing terrain would be there waiting for me to continue creating the rest of the parts of the game. And without you guys I could never do this... I am really happy now. Yessssss.

    Here are some screenshots of the terrain:








    what do you think guys?
  • Eric Chadwick
  • dpadam450
    Offline / Send Message
    dpadam450 polycounter lvl 12
    I didn't read every single reply here, but you should never use vertex colors. Why? Because every 3D model, including terrain, has LOD. Meaning vertices move and change at certain distances, you should always use a splat map for multi texturing.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Congratulations!
    Thanks.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    dpadam450 said:
    I didn't read every single reply here, but you should never use vertex colors. Why? Because every 3D model, including terrain, has LOD. Meaning vertices move and change at certain distances, you should always use a splat map for multi texturing.
      I didn't use vertex colors , I've used a splat map. Thanks for your useful information,though.
Sign In or Register to comment.