Search Unity

[Released] MegaSplat, a 256 texture splat mapping system..

Discussion in 'Assets and Asset Store' started by jbooth, Nov 16, 2016.

  1. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    Jason,
    one quick question:

    In the Batch Importer, what name are you using for "Specular" textures?
    I have a bunch but don't know what to rename them.

    Thanks!
    David
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can name them with whatever extension you want and just change it in the importer..

    That's very unusual and not something I've seen before. A few things worth trying:

    - Select the texture array config and press Update; this will regenerate the texture arrays
    - Make sure the materials have the texture arrays assigned to them, and that UV scale is set to something reasonable
    - Do the previews show in the Terrain or Vertex painters for the brushes?
     
  3. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    Hi Jason,

    Thanks for the quick response!

    I'm renaming everything to your naming convention but you don't list specular, and I'm not sure which one to use in your importer. Sorry for the dumb question, I have only been on Unity for a few months and haven't learned the different names for specular, so I don't know what naming convention you are using for that.

    I want to be sure I put it in the right section. I have a bunch of specular texture files but I don't know where to put them in the importer.

    Would they go in metallic?

    Thanks!
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well, just to be clear, MegaSplat doesn't use 'specular' textures- it uses smoothness textures (or inverted roughness maps), because it's based on the Unity Metallic workflow. In a metallic workflow, you define how rough/smooth the surface is along with the metallic value (usually 0 or 1), and an actual specular color is computed based on those values and the albedo. Metallic values are rarely needed for terrains, so the metallic value gets packed in with the Emissive value, which is also rarely used for terrains. Those arrays are only created if your provide emissive or metallic textures, so unless you explicitly want to use those textures you can just leave them blank.

    If your textures come with a smoothness or roughness texture, then you likely don't need the specular texture. If your textures do not come with a smoothness or roughness, then there is a good chance the values in the specular texture are not correctly PBR smoothness maps (they might be, I've seen people call them _spec textures before, but usually specular textures are not the same as smoothness maps).
     
  5. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    Thanks!
    I understand now. I will just leave them out:)

    I appreciate the explanations.

    Another question

    I see on MicroSplat water/lava module that it does a gravity flow down the terrains. I love the look and simplicity.
    Does MegaSplat also have that option or can we only paint water/lava with a flow but not gravity feed?

    I really like your work, I do enjoy the amount of learning required for MegaSplat and the ability to tweak the settings. Some things are great to "just work" but as an artist, I like to be able to manipulate the settings.

    I am looking forward to learning all of the features of MegaSplat!

    David
     
    mwituni likes this.
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, it's only painting in MegaSplat. Basically, MicroSplat only works on Unity Terrains, so it can make a lot of assumptions about the data it's working on which are not true for MegaSplat, which works on arbitrary meshes. The streams module, for instance, can assume it's working on a height field and stores data about that height field in a texture that the shader can access. It can assume that the entire simulation area maps to a texture over the terrain. On a mesh, which can have arbitrarily complex UVs that overlap, and arbitrarily complex topology, those same assumptions are impossible to make.

    Both products are, in many ways, an extrapolation of the techniques they are based on - both at a deeply technical level in the shader coding (core optimization techniques) and the tools and domains they work on (meshes vs. terrains only).
     
  7. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    Both have great applications for use.

    I thinking on ways to use the stream module so I can get that too!

    Maybe in my next project.

    Keep up the great work, we need people like you! Inventive and available are what makes you and your work in such great demand.

    Once I use MegaSplat more and get a better working knowledge, I will put up a review in the store.
     
  8. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    How does snow work with this? I currently use Enviro and CTS, when it snows in Enviro, CTS paints snow on the terrain dynamically and then it goes away when it stops snowing. Does MegaSplat work similarly?
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I believe Enviro has a MegaSplat integration. I haven't used it myself, but know the author shipped one a while back.
     
  10. Nijiem_Arhi

    Nijiem_Arhi

    Joined:
    Oct 4, 2017
    Posts:
    17
    - Pressed Update in the MegaSplat_Example texture array and there was no change.

    - The previews for the Clusters do not display: they appear as identical grey spheres in the thumbnails (the textures in the "Single" tab appear as normal).
    upload_2017-10-4_10-10-2.png

    - By assigning the texture array to the material do you mean assigning it to the brush here?
    upload_2017-10-4_10-9-36.png
     
  11. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    Thanks for the response!

    I was asking about how Snow works in Megasplat, if it's procedurally painted or not like in CTS with Enviro.

    Or is it static, where you paint it in yourself and it's always like that in the game.
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It’s dynamic..
     
  13. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Hey Jason, I have a little problem where I keep finding VertexInstanceStream.cs on various objects in my scene, although I never intended to paint them. This only seems to occur in scene, I didn't see it on any prefabs yet. Sometimes there is 4+ VertexInstanceStream on the same gameObject, but just 1 mesh renderer/filter

    unity has a tendency to crash occasionally (but it's our internal mandel bug, related to the game project), could this be the cause?

    Hm, maybe it's auto-added to anything that is under a brush of a vertexPainterPro? about 400 objects seem to have it, but I can manually remove it. However, it also swaps the mesh with a mesh Instance, which has issues with Unity's new NavMeshSurface baking (unity complaints that meshes need to be isReadable).

    If we let them be, does this bloat-up the memory requirements?
    Also, perhaps you are already using it, but I found this gem recently :D https://forum.unity.com/threads/edi...or-select-object-using-gui-coordinate.485502/
     
    Last edited: Oct 5, 2017
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    I should likely mark the VertexInstanceStream to only allow one per object, but it shouldn't be adding multiple anyway. The vertex painter works by selection - so when you select a hierarchy of objects, you are saying "Any of these objects are my potential painting target, so if the brush crosses them, add the component". I personally separate out paintable objects from non-paintables to help manage this- but I felt this was better than having to add the component manually to everything which can be painted on.

    For your crash, best look at a call stack in your logs and see what's in it..

    The vertex painter also requires that meshes be isReadable, as it cannot paint on them without access to the vertex data. And yes, I use Matt's raycast trick already in the vertex painter; that's why you don't need collision objects on everything..
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, I meant assigning it in the material itself. But given that your preview spheres are jet black, it looks like your system is not rendering texture arrays correctly at all. Usually this is because the editor is running in DX9, but your clearly in DX11. Unity broke this for a while in builds (from 5.6 to 5.6.1p2), but I know it works in the version of 2017 I've been running (2017.1.p4). I'll download the version of Unity your running on windows when I get back from Unite and see if I can reproduce your issue, but I have quite a few users running various flavors of 2017, so I'm not expecting that's the case either.
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    BTW - can you download MicroSplat core (it's free) and see if it exhibits the same issue for you? It might give me some clues..
     
  17. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    518
    Hi, I'm facing, I guess, some precision issues, do you know how it can be fixed?

    upload_2017-10-5_11-13-34.png
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Are you using latest? It happens when per-texture UV scale is turned on, but I submitted a patch to fix this recently. If you are running latest, please post a screenshot of your material settings so I can see if I missed a case.
     
  19. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    518
    Just saw the 1.3 release, I will have a look thanks
     
  20. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    I saw you made also a Microsplat asset, which works with the Unity workflow. So we use there the unity texture painting tool instead of the TerrainPainer. Microsplat supports 16 textures, that could be enough for my purposes. I still see issues with Megasplat, for that reason I have to update it each time, but now changing the imput textures causes a lot work to update. Do you have a comparison for Megasplat and Microsplat? I don't like the fact that you made another terrain shader asset, because that means there is something wrong with Megasplat.

    My opinion is, that the shader is stable and fast in Megasplat, but the TerrainPainter makes it worse. It's not stable, e.g. Undo/Redo still not works correctly and that artifacts at blending textures together are still there. That what I saw at testing Microsplat is not bad, we can use the Unity terrain painter tool, which is stable. We can mix 4 textures instead of 2 (2 layers in Megasplat) that allow us to mix together different looking textures.

    Microsplat with all its addons, that I would need and everyone would need for desktop quality, costs about 87$. Megasplat costs 50$. Which one is better in your opinion, which one will be better supported?
     
    ZoneOfTanks and mwituni like this.
  21. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    I don't think there's anything wrong with Megasplat. The two products take two different approaches. Megasplat offers 256 textures and can also work on meshes. Microsplat works only on terrain and is limited to 16 textures. Megasplat has a steeper learning curve while Microsplat is very easy to learn since it uses Unity's own terrain workflow.

    I will say for terrain texturing Microsplat if faster and with its simplicity of use that may be the best path.

    I am on the fence about purchasing the add-ons for Microsplat since I own Megasplat. I am going to see how far I can get with Megasplat before I switch over. I think the idea of having 256 textures is awesome but I am jealous of the river and lava addon Microsplat has.
     
    jbooth likes this.
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Pretty much what Steven said. I do need to make some kind of comparison chart though. Each package is basically an exploration of how far you can push each technique, each of which eventually has certain advantages or limitations over the other. I haven't actually had any reports of the Terrain Painter not being stable though, what did you mean by that?
     
  23. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    16 textures, but you can mix 4 textures. If you used RTP, then you know how big the advantage is. You will have a lot of mixed textures between the 16 textures. Because they are mixed textures, they also well blends to each other. Rolled out 16 textures and 4 mixed textures is more then 16 textures in Megasplat.
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well, actually, on any given pixel in a 2 layer MegaSplat shader it's mixing 6 textures together, which is actually more than 4. But there are only 2 textures chosen at each control point, and the blending is based on a barycentric structure instead of a bilinear structure like MicroSplat or the included terrain shader, which gives it a different look. The MegaSplat technique gives you texture clusters for free, while doing something like that in MicroSplat would require 3x the samples. Which one is 'better' really depends on what's important for the look your going for and if you need mesh based workflows or high texture counts. Also, because MicroSplat works only on Unity Terrains instead of arbitrary mesh topologies, it's able to make a lot more assumptions about the data, which allows it to do things like auto-terrain blending and dynamic water/lava flows.
     
  25. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Try to paint a bit around. Start the game. Close the painter. Then try to undo/redo. You don't have to try much, you will see that undo will not work.

    Then simply mix together some textures in a way, that the blending between them is well made. When you have a good result, then you will recognize some pattern like circuit board or grid. I could improve this by higher interpolation contrast.

    Runtime painting on the terrain, on the top layer with brush faloff 0, does not paint as excepted. I was trying to paint under the placed building a texture, but it just partially worked (in 1.4.1). Even in the editor, I cannot paint on the top with minimal Brush Flow.

    However, I know this and still have good results. Because of the last one I have to update and that hurts because of the change to the texture array.
     
  26. gaiastellar

    gaiastellar

    Joined:
    Nov 8, 2013
    Posts:
    57
    hi,
    im new to splat mapping, but this looks very cool. im needing to procedurally texture a spherical planet terrain mesh at runtime. would that be ok with this?
    does it use splat maps, or does it use vertex height, or some other method/ methods to assign textures?

    many thanks

    paul uk
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    For meshes, the texture choices are stored in the vertices. The documentation is all available online, which describes the mesh format.
     
  28. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hi jbooth. I wrote a small extension to the TextureArrayConfigEditor.cs. Adding 166 * 5 textures by hand to the texture array can be done with a bit editor code much more faster. Batch Import is not what I can use, I have to pick my textures by hand (I have over 300 textures). In my case I also have to place them in the same order to have the same result with your new texture array.

    I simply added some code to the TextureArrayConfigEditor.cs which needs only one texture in the TextureEntry, then it loads the textures for the another texture types, but just, if they don't have already a texture. I added a button for this function, which is under the "Batch Import" button. The feature also uses the Batch Importer extensions.

    So I have to add 166 textures, but the other can be assigned automatically.

    I could send you the TextureArrayConfigEditor.cs file, and maybe you could merge (with windiff, meld) the changes to yours. Just 3 methods and the button entry. In this way I wouldn't miss it in the next update.
     
  29. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    After updating the texture array everything looks good, but I have this white line (I guess too strong normal map?), which was not a seen before. Any idea how to fix this? I also saw that the "Macro Strength" has been inverted, maybe somthing else too?

    Edit: In "No Spec Or Normal" it looks good. It is the normal map. I have to lower it to 25% for each texture. Maybe a bug?

    Edit: Solved, all the normal maps were imported as "Default".

    bandicam 2017-10-08 00-57-05-235.jpg
     
    Last edited: Oct 8, 2017
  30. Emile-Swain

    Emile-Swain

    Joined:
    Jun 23, 2015
    Posts:
    35
    Hi, is there any documentation for how batch importer works? Also, i have my images in individual folders, they are also tga file format. Batch importer doesn't seem to want to import anything.

    [Edit]
    Ok, so it was case sensitive and naming, i don't have my glasses yet, everything is blurred.

    Still when i selected the folder i get the following.


    [Edit 2]
    Ok, i fixed the naming errors i had and still get the weird result of undamed textures. Is there still a naming issue with my textures?


    [Edit 3 + FIX]
    So there is a case sensitive issue in your code. TextureArrayConfigEditor.cs Line 216
    Code (CSharp):
    1.  
    2.     name = name.ToLower();
    3.  
    Needs to happen after your conditional to test the filename endings as they might be Upper case..
    Code (CSharp):
    1.  
    2.     if (name.EndsWith(cfg.extDiffuse) || name.EndsWith(cfg.extNorm) .....
    3.  
    Note, i generally stick to all lower case, but textures i downloaded and some created with Substance painter had camel case endings.

    [Edit 4]
    To support the fact i have my images in child folders there is a GetFiles Search options parameter that will search all child folders.

    In TextureArrayConfigEditor.cs
    Code (CSharp):
    1.  
    2.     void BatchImport(TextureArrayConfig cfg, string folder){
    3.     ...
    4.     var paths = System.IO.Directory.GetFiles(folder,"*.*",System.IO.SearchOption.AllDirectories);
    5.     ...
    6.  
    [Edit 4]

    So, it seems Substance Player likes to export various channels (AO,Diff,Rough, etc) as defined by the substance file. Which seems to be different across a lot of the textures i've bought.

    Which means i have a really bad workflow now where i have to manually rename files every time i update. I'm wondering how i might update the Importer to accommodate multiple endings and endings with _ in them, as in Ambient_Occlusion which some of my substance files want to export as.

    [Edit 5]
    Tweaked the batch importer code to check i could cover everything i needed to do.
    Code (CSharp):
    1. /**
    2.          * Get the Texture Name for a TextureEntry object type.
    3.          *
    4.          */
    5.         string GetTextureEntryMaterialName (TextureArrayConfig.TextureEntry te)
    6.         {
    7.             string name = "";
    8.             if (te.diffuse != null) {
    9.                 name = te.diffuse.name;
    10.             } else if (te.height != null) {
    11.                 name = te.height.name;
    12.             } else if (te.normal != null) {
    13.                 name = te.normal.name;
    14.             } else if (te.ao != null) {
    15.                 name = te.ao.name;
    16.             } else if (te.smoothness != null) {
    17.                 name = te.smoothness.name;
    18.             } else if (te.metallic != null) {
    19.                 name = te.metallic.name;
    20.             } else if (te.alpha != null) {
    21.                 name = te.alpha.name;
    22.             }
    23.             return ComputeTextureName (name).ToLower ();
    24.         }
    25.  
    26.         /**
    27.          * Compute the name of the texture assuming the last part of the name defines the type of texture.
    28.          * i.e. diffuse, roughness, ambient, alpha, etc.
    29.          *
    30.          * Adds support for underscored material types, i.e. _Ambient_Occlusion. These will not
    31.          * work with name.LastIndexOf("_")
    32.          *
    33.          */
    34.         string ComputeTextureName (string name)
    35.         {
    36.             var compName = name.Substring (0, name.LastIndexOf ("_")).ToLower ();
    37.             // check exceptions
    38.             if (name.EndsWith ("_Ambient_Occlusion")) {
    39.                 compName = name.Substring (0, name.LastIndexOf ("_Ambient_Occlusion")).ToLower ();
    40.             }
    41.             return compName;
    42.         }
    43.  
    44.         /**
    45.          * Check if the loaded teture is a texture with a valid ending and should be used.
    46.          */
    47.        
    48. bool CheckTextureUsable (TextureArrayConfig cfg, string name)
    49.         {
    50.             return name.EndsWith (cfg.extDiffuse) || name.EndsWith ("_Albedo") || name.EndsWith ("_Diffuse")
    51.             || name.EndsWith (cfg.extNorm) || name.EndsWith ("_normsao")
    52.             || name.EndsWith (cfg.extSmoothness) || name.EndsWith ("Roughness")
    53.             || name.EndsWith (cfg.extAO) || name.EndsWith ("_Ambient_Occlusion")
    54.             || name.EndsWith (cfg.extMetal) || name.EndsWith ("_Metallic")
    55.             || name.EndsWith (cfg.extHeight)
    56.             || name.EndsWith (cfg.extEmiss)
    57.             || name.EndsWith (cfg.extAlpha);
    58.                  
    59.         }
    60.  
    61.         void AssignTexture (TextureArrayConfig cfg, Texture2D tex)
    62.         {
    63.             // Ignore files if they don't match any of the valid file endings. i.e. must match cfg.extMetal or "Ambient_Occulsion"
    64.             if (CheckTextureUsable (cfg, tex.name) == true) {
    65.  
    66.                 // check already exists
    67.                 var textName = ComputeTextureName (tex.name).ToLower ();
    68.                 var te2 = cfg.sourceTextures.FirstOrDefault (i => GetTextureEntryMaterialName (i) == textName);
    69.                 var isNew = false;
    70.                 // Create Texture Entry if we don't already have one in sourceTextures.
    71.                 if (te2 == null) {
    72.                     te2 = new TextureArrayConfig.TextureEntry ();
    73.                     cfg.sourceTextures.Add (te2);
    74.                     isNew = true;
    75.                 }
    76.                 // HEIGHT MAP
    77.                 if (tex.name.EndsWith (cfg.extHeight)) {
    78.                     te2.height = tex;
    79.                 }
    80.                 // Normal
    81.                 if (tex.name.EndsWith (cfg.extNorm)) {
    82.                     te2.normal = tex;
    83.                 }
    84.                 // Ambient Occulusion
    85.                 if (tex.name.EndsWith (cfg.extAO) || tex.name.EndsWith ("_Ambient_Occlusion")) {
    86.                     te2.ao = tex;
    87.                 }
    88.                 // Smoothness
    89.                 if (tex.name.EndsWith (cfg.extSmoothness) || tex.name.EndsWith ("Roughness")) {
    90.                     te2.smoothness = tex;
    91.                 }
    92.                 // Emissive
    93.                 if (tex.name.EndsWith (cfg.extEmiss)) {
    94.                     te2.emissive = tex;
    95.                 }
    96.                 // Alpha
    97.                 if (tex.name.EndsWith (cfg.extAlpha)) {
    98.                     te2.alpha = tex;
    99.                 }
    100.                 // Normal SAO
    101.                 if (tex.name.EndsWith ("_normsao")) {
    102.                     if (isNew) {
    103.                         te2.smoothness = tex;
    104.                         te2.smoothnessChannel = TextureArrayConfig.TextureChannel.B;
    105.                         te2.ao = tex;
    106.                         te2.aoChannel = TextureArrayConfig.TextureChannel.A;
    107.                     } else {
    108.                         te2.smoothness = tex;
    109.                         te2.smoothnessChannel = TextureArrayConfig.TextureChannel.B;
    110.                         te2.ao = tex;
    111.                         te2.aoChannel = TextureArrayConfig.TextureChannel.A;
    112.                         cfg.allTextureChannelSmoothness = TextureArrayConfig.AllTextureChannel.Custom;
    113.                         cfg.allTextureChannelAO = TextureArrayConfig.AllTextureChannel.Custom;
    114.                     }
    115.                 }
    116.             }
    117.         }
     

    Attached Files:

    Last edited: Oct 8, 2017
  31. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592

    _Ambient_Occlusion is a problem, because the code just searches for the first '_' backward. I'm not sure how this fails. To fix this the extension names should be compared .endsWith(".."), then it should be cutted.
    I wouldn't use "name.ToLower();", linux and Mac consider uppercase in file names.

    To 4. A recursion flag for the importer (checkBox) could be useful.
     
  32. Emile-Swain

    Emile-Swain

    Joined:
    Jun 23, 2015
    Posts:
    35
    Yep, i replace the line where it does that with a call to the following method.

    Code (CSharp):
    1. string ComputeTextureName (string name)
    2.         {
    3.             var compName = name.Substring(0, name.LastIndexOf("_")).ToLower();
    4.             // check exceptions
    5.             if (name.EndsWith ("_Ambient_Occlusion")) {
    6.                 compName = name.Substring(0, name.LastIndexOf("_Ambient_Occlusion")).ToLower();
    7.             }
    8.  
    9.             return compName;
    10.         }
    11.  
    12. ...
    13. var compName = ComputeTextureName(tex.name);//tex.name.Substring(0, tex.name.LastIndexOf("_")).ToLower();
    14.  
    15.  
     
  33. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hi jbooth,

    in the RuntimePainter.cs is a bug (at least since 1.41), the center of the brush is offsetted, so it paints ~10 Unity unit away in my case. But now it fully paints (overrides the texture) over the terrain, thats a big imptovement against 1.41!
    Use the terPoint instead of point for the last 3 lines. After, the center is correct, but I do not now where else terPoint should be used after this. I wonder why nobody else used the RuntimePainter.sc...

    Code (CSharp):
    1. Vector3 terPoint = MegaSplatCollisionInfo.LocalPointToTerrain(t, point, tex);
    2.  
    3.       // Vector3.Distance is stupidly slow. It casts things to doubles, calls to c++, etc.
    4.       // If we pre-square the brush size and cache off the pnt vector, then unroll the vector math,
    5.       // we make it roughly 10 times as fast.
    6.       float px = point.x;
    7.       float py = point.y;
    8.       float pz = point.z;
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Yeah, I must have missed this when refactoring the code to use less inline coordinate conversion. Not a lot of people use the Runtime painting stuff- most people just need to paint things statically.
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    In terms of all of this:

    - I'm going to make the batch importer recursive by default.
    - The name comparison will all be lower now. While OSX/Linux support case based naming, if you name files with different casings to get different results, you deserve the pain this will eventually cause you.
    - I am considering allowing multiple name extensions separated by a semicolon- so you could do "_diff; _diffuse", etc..
     
    dsilverthorn likes this.
  36. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    No lies there!

    And I think you broke it ... because ...
    Originally, I don't think you named the files *_nsao, but rather *_normsao. And I think that's what your instructions in the manual told us to name them as well.

    So now each of us needs to go rename them before upgrading, and deal with the bleeting errors.
    It would have been nicer had you set it up to use both *_nsao and *_normsao

    So ... as I'm upgrading only now (to 1.53) from pre 1.5 ... I first renamed all my *_normsao to *_nsao files, then got the old version arrays working with that, then upgraded, and I was expecting the batch importer to read those *_nsao files as you posted when it reads the diff files, and load the additional files.

    But I'm not sure that works - does the pic below look correct? ... I'd have expected to see the HM and AO in the previews. Or is it correct to only show the file preview? ...

    upload_2017-10-9_1-50-23.png


    If I do not assign the extensions as _diff and _nsao, it only imports diff.



    Also, it would have been nice to have the ability to run the batch importer to import files in the same order as they were before the upgrade - perhaps by reading an old texlist file. This is part and parcel of the unelegant sort-by-name and needs to be considered when breaking changes like this are made. Because, believe it or not, we add our own textures, and the sorting by naming is a problem regarding that. So the batch importer messes the order up, and the existing terrains are all indexed wrong!
     
  37. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    That is one big usage problem with Megasplat, it only indexes based on name ... so if you sort your names and have painted previously ... then the previous painting will have wrong textures. I manually had to update my splat maps when i inserted textures ... its not fun. Its obviously something most people will do, as projects grow.

    I recommend you consider renaming files you add so they get added at the end ... X01 - Rock_05, X01 - Rock_06 etc. Then next time you add X02 - Rock_07 etc. It means the auto cluster won't work well, but at least you won't be replacing existing splatmaps.
     
  38. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    +1 ... need that
     
    dsilverthorn likes this.
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's called a backwards compatibility breaking change for a reason- it breaks backwards compatibility with things. Assuming you have your textures sorted by name, then sorting them by name will produce the same arrays. If you didn't have them sorted by name, then there's no easy way for me to know which order you had them in as Unity doesn't support inspecting old serialized data and revisioning it. The texture list could potentially be used, but is not reliable as if doesn't actually have pointers to the actual textures (for good reason), only their names, and there is nothing enforcing that those names be unique across the project. " _normsao" was the extension used in all of the example files- but as you've noticed, you can put whatever extension you want into each slot (even using the same extension for several slots) and it will work just fine (it shows the source file, not the result, since that hasn't been computed yet).
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    This is basically the case for everything that uses texture arrays, as it's the nature of the technology. It is particularly problematic in MegaSplat because you are often dealing with a much large number of textures than you are in something like MicroSplat.
     
  41. draco_nite

    draco_nite

    Joined:
    Jul 17, 2015
    Posts:
    9
    I'm thinking of purchasing and using this for a less-than-usual purpose: 4X strategic map generation.

    I'd like to ask a few basic questions before purchasing this:
    • Does it support custom textures? I've seen some asset store terrain generators that only work with the assets bundled with them. The videos and screenshots seem to indicate that you can just plug your own textures into this, but I'd like it confirmed.
    • Does it have a scripting API? I'm looking to procedurally generated hex grid maps, with hexes having different biomes/terrains/whatever you want to call it. I know I can procedurally generate everything in other ways, but I'd need to write a custom script that "auto-manually" paints each hex the way it's supposed to look.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can use your own textures. The entire source code is included, and the documentation will show you how to change the texturing at runtime. Note the documentation is available online (see first post) so you can read about the mesh format there.
     
  43. Emile-Swain

    Emile-Swain

    Joined:
    Jun 23, 2015
    Posts:
    35
    Consistent lowercase is a good call.
    The ability to support multiple _endings will be a boon, its pretty ridiculous how many different endings my materials have.
    For example, this is what you get from GameTextures.com


    So thats _diffuse, _alb, _albedo and i'm not quite sure how Base_Color from Substance Player is different from Diffuse.

    Because of the above folder structure, (_1k, _2k, _256k) etc, i can't bring all of these textures in as they come. Otherwise the recursive search would pick up multiple resolutions. So i copy them in manually.

    Ultimately, it would be great to be able to configure the texture sets by scanning a folder containing all of the possible textures, and selecting the ones you need. If i get time i'll write something for my purposes and share it with you.

    Oh, i should point out, that in my solution, it does not like it if you have a diffuse and an albedo file. it doesn't know what to do.
     

    Attached Files:

    dsilverthorn likes this.
  44. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hi,

    I guess the main problem is, that we have to pick the textures we want for a certain terrain/mesh. That we have to do! Dropping each texture in a single folder is one way. But dropping all textures in a folder and its sub-folder makes not much sense, if you want to use the same textures in another terrain configuration. You would have to duplicate the common textures (multiple used textures) for each terrain texture configuration. My project is at ~100GB, I dont want to rise the size with duplicated textures.

    I would say, one of the simplest and good solution is to drop the diffuse texture in the texture array for each texture set and using a function to fill the other type of textures like normal, AO and so on. This then based on the filter extension.

    I provide you the code for 1.5.3 to doing this. You just have to add one texture for the texture set and then the button under "Batch Import" will add the other textures to the texture set. The base name must be the same of the textures for the textures. Worked for me, I added 166 diffuse textures and the other 166*4 were added automatically. Substances, nsao (no filtrer for this) are not supported.

    I would be happy, if jbooth could add this feature for the next release. The file just contains the additionally added code. The code is free!
     

    Attached Files:

    Last edited: Oct 9, 2017
    ftejada and dsilverthorn like this.
  45. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Hi,

    I think you missed the point...

    Considering (the majority) of users use most of (if not all) your sample textures, they will have files named *_normsao
    (not *_nsao). If they have added a few of their own, they'd likely had named them *.normsao to match too.

    Your 1.5 release said : "- A batch importer is available allowing you to quickly setup whole directories of textures at once based on naming conventions. If you already have your textures packed into NSAO format with the _nsao extension on them, it will read and convert these into the right formats."

    So that implies everyone needs to rename their *.normsao to *._nsao first.

    I said ... it would have been nice to accept the *.normsao extension in the batch convertor ... so not all customers need to goto the effort of renaming.


    Ok. But how about then trying to reduce the pain of this most customers will face - when they add textures. As a first step a tool to reindex old textures with new changed indexes in splatmaps will help. Perhaps something that reads the splatmap and shows a list of textures and allows one to replace some of those textures.


    Yes and yes.
    This is a very powerful tool, and certainly recommended.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ah, I see- the misprint is in the notes, internally it converts *_normsao files. No rename is necessary, but you can still import all the data regardless of what extension is used (by mapping the same extension to multiple types and selecting the channel)

    There is literally no amount of tooling which will ever solve the problem, as the data can be spread across many different scenes, prefabs, meshes with VertexInstanceStreams on them, meshes which have been baked down and have no VertexInstanceStream on them to identify that they are used by MegaSplat, texture files used by terrains, etc. If I were to go down the route of offering tooling for this, it would be a never ending quagmire of support and feature requests, and likely never work for everyone's use case. The Batch Importer is already turning into this, as you can see from this thread, because people are messy with their texture data and now that I've written an importer expect me to make it work with whatever random assortment of badly organized data they have littering their hard drive.

    You can add texture on the end right now and not invalidate indexes, and when you delete a texture from the array it is a two step process, allowing you to leave a blank one in the array to not change the index order.
     
  47. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    In that case, it may be better to rename all default textures like this "001 : cliff_01" through "060 : xyz", so no matter what alpha customers add, the numeric puts them at the end, eg "065 : My new texture" ... doesn't slot in after "M"

    Then you could modify the auto clustering to ignore the prefix (numeric part), so any matching text will still get clustered.
    (Edit : only if it matches the numeric pattern "999 : " ... so not to be "backwards breaking"!)
     
    Last edited: Oct 9, 2017
    WildStyle69 likes this.
  48. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Ok ... Maybe edit / update the text ... so others don't spend hours renaming all their textures for no reason.
     
    Last edited: Oct 9, 2017
  49. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hi,

    I paint now at runtime, grids are visible. Usually I get rid of them with the macro texture and interpolation contrast, if I paint in editor (not in a running game). Maybe one or both are not applied at runtime painting, or both applied, but the grid is still there?

    Any idea how to fix this? (tested with lot of textures, all have grids)

    RuntimePainting settings: Target Weight 12, Brush Size 20, brush Falloff 4, ClusterNoiseScale 0.01.

    bandicam 2017-10-09 18-13-07-029.jpg
     
  50. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Prefixing is helpful -- I've been doing this locally myself, if this could be built in somehow would be great. :)