Search Unity

[FREE]MicroSplat, a modular terrain shading system for Unity Terrains

Discussion in 'Assets and Asset Store' started by jbooth, Aug 9, 2017.

Thread Status:
Not open for further replies.
  1. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Send me a repro and I’ll take a look. It does a ray cast down to find the terrain, so as long as the center of the object is on a terrain it should find it.
     
  2. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Of course it doesn't happen in that simple project I sent last week. Will try to strip my big project to a small one for you.
     
  3. bigyarus

    bigyarus

    Joined:
    Jul 6, 2018
    Posts:
    3
    Good day everyone, I have a strange problem. I'm not sure that this is the cause of MicroSplat, but when after upgrading to Unity 2018.3, the terrain turns pink. But the thing is that I can’t even choose a terrain to see what is happening, because the unity is immediately crash after that every time. Does anyone get an idea how to fix that? 665.JPG
     
  4. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    Hiya @jbooth

    Working with an integration script that syncs enviro weather & such with Microsplat. In the update loop, after it updates the globals it calls SyncAll(). I seem to remember you mentioning that this was not necessary every frame.

    a) Should I call SyncAll only when I change a value of, say, " _Global_StreamMax"
    b) should I call it every frame?
    c) should I not bother to call it after change?
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you are setting globals, there is no reason to call Sync functions at all. What the sync functions do is propagate material changes from the templateMaterial to the actual instance of that material used on the terrain. So if the property your setting is not global, say the diffuse texture array or something, you'd need to call SyncAll to sync the change.

    When a shader uses a global variable, there is no property on the material for the value- instead it is read from a global table which unity sets before rendering each frame. This means any material in the game will get the change, even non-microsplat ones, without any kind of list of materials to set them on, etc..
     
    mmaclaurin likes this.
  6. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi @jbooth, big fan of Microsplat. You helped me out some time ago regarding the terrain/mesh blend module, and I was wanting to suggest an alternative method.

    I don't know if you've played Zelda: Breath of the Wild, but they had an interesting approach to seemlessly blend terrain and meshes, in fact it's a staple for how they handled cliffs and overhangs. From what I can tell they've basically used something similar to soft particles/water edge blending on the terrain itself, so that it fades up against meshes, which themselves don't seem to have any special shader applied.

    It's subtle and done right looks quite convincing, and you can simulate the effect using something like the built-in water4 shader. Do you think this would be possible via Micro/Megasplat? I've attempted it myself but my shader skills just aren't up to par. Thanks!
     
    protopop likes this.
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    But wouldn't this leave a gap between the object at the terrain such that you could see through the terrain?
     
  8. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    That's what I've always thought but when viewed at that sort of angle it seems the the amount of 'fade' dissipates. I've never seen 'through' the terrain in my experiences, even in cases where there clearly wouldn't be a mesh underneath to mask the effect. I've uploaded a few examples for you to look at, forgive the bad moire off my LCD screen.

    The most effective use is when the terrain and mesh share a similar texture, such as grass, which is how they seamlessly blend from a grassy field to a grassy overhang mesh. However these videos are focusing on harsher transitions for demonstration:

    https://www.dropbox.com/s/fmtqegrbrrbbqmz/z_terrainblend.zip?dl=0
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Interesting- it's very similar to soft particles. However, it requires that:

    - Objects are drawn before the terrain is
    - The depth buffer can be read from while the terrain is rendering (most likely this is cached to a separate buffer after the objects are rendered)
    - The terrain is drawn as alpha (or more likely some form of stippled alpha, so that it's actually clip mapped instead and MSAA makes it look like alpha).

    It's a neat trick, but unfortunately something that requires exact control over the pipeline (like you'd have in an SRP), not something you can just do in the terrain shader..
     
    protopop likes this.
  10. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Ah, got ya. Yeah I was trying to get my head around the draw order here, beyond just a few shader tricks. However I would think most water shaders basically do the same thing? Again, not an expert on shaders.

    Actually, now I'm wondering if applying this soft particle shader on the appropriate meshes might be the way to go.
    I was sort of able to emulate it using Unity's water4 shader as a base (applied to the mesh rather than the terrain), but yeah, not really the same thing. Thanks for looking though.
     
  11. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Willbkool_FPCS likes this.
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, Unity removed native substance support about a year ago, and last I checked the new plugin didn’t have an appropriate API and defines so 3rd parties could use it.
     
  13. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Hey!

    Not sure if this is intentional or just an oversight, but to get MicroSplat to recognise Vegetation Studio Pro I had to manually update the MicroSplatVegetationStudio.cs script to check for VEGETATION_STUDIO_PRO, and not just VEGETATION_STUDIO...
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yep, that'll be added in the next version.
     
    StevanJay likes this.
  15. anpd03

    anpd03

    Joined:
    Aug 7, 2013
    Posts:
    65
    Have a weird issue, recently upgraded to Unity 2018.3 and everything works fine in the editor but in a build the terrain is pink. Any idea what the issue could be?
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Got an errors in the logs?
     
  17. anpd03

    anpd03

    Joined:
    Aug 7, 2013
    Posts:
    65
    Just finished a new build and adding the shaders to always include fixed the problem. Weird, haven't had them included in 2018.2 and didn't experience it in builds.
     
  18. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    25
    upload_2019-1-19_15-45-42.png
    Has been an error....
     

    Attached Files:

  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hard to tell, but did the propdata object get deleted or unassigned? It’s listed under the debug section of the MicroSplatTerrain component.
     
  20. Jeremy-Borton

    Jeremy-Borton

    Joined:
    Oct 21, 2015
    Posts:
    63
    I noticed that with using tessellation my player can walk through tessellated rocks because they're not part of the geometry. Is there a "quick" way to generate colliders for the tessellated terrain?
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, there's not really a great solution for this- if you were to generate colliders for the terrain, it would require an incredibly dense amount of geometry - way too much for physics to handle properly. The alternate is what I shipped in MegaSplat, which is to offset the collisions by calculating the offset point of the current geometry and adjust things accordingly - this works ok if you have few colliders and don't mind custom code on every collision, but I could never get the displacement to precisely match the GPUs. If you enable the per-texture displacement offset property, it has a button to compute the average center point of each displacement map, which can be used to lessen the issue.
     
    Jeremy-Borton likes this.
  22. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    25
    Using unity2018.3.0f2, I created an empty project and imported the latest version of microsplat you released without any Settings.And then there are a lot of mistakes.There are also issues with terrain texture Settings.For example, some options will not work.
     
  23. Revan3192

    Revan3192

    Joined:
    Mar 28, 2018
    Posts:
    8
    Hi everyone!

    I would like to use this new per-pixel normals. I don't know if it's something I can set into microsplat shader or an option from unity terrain component.

    upload_2019-1-22_17-7-21.png
     
  24. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    56
    just enable Draw Instanced in terrain options.
     
  25. Steve2375

    Steve2375

    Joined:
    Mar 28, 2015
    Posts:
    42
    Hey all, I don't know if this was asked before, but maybe you can help me with a problem that I got since I updated from version 1.7 to the newest 2.2. I am using LOD Sampler together with Triplanar but after updating I get these strange areas on my terrain:
    MicrosplatUVProblem.jpg
    Switching either Triplanar off or LOD Sampler to Default fixes it. However it would be very important for me to use the LOD Sampler because of performance and the ability to use per texture UV scale.
    Any help is welcome very much!
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Is this super close or far away? Can you post a comparison?
     
  27. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Hey! So I`ve just upgraded to version 2018.3.3f1, and have an odd problem... I can no longer focus on my terrain with a mouse scrollwheel click. If I remove Microsplat, it works fine, but then adding Microsplat back on again it stops working correctly again. If I create a new terrain, and add Microsplat, it seems okay, it`s just the already existing terrain that doesn`t seem to be working.

    It`s not a huge problem, it`s not so much work for me to redo the terrain if I have to, and it seems like that'll work fine... But if you do have any idea what`s going on, I`d be interested to know! (And also just want to let you know in case you see anyone else with the same problem...).

    Edit: So it`s not just mousewheel click, I can`t select the terrain at all in the scene window (I have to select it in the hierarchy) - it`s like it`s not really present in the scene view at all, but only when I have Microsplat on the terrain... And it's also happening sometimes on new terrain also. Haven`t yet worked out a repro for when it happens, but some scenes it seems fine to create a new terrain, and existing terrains work fine, other scenes the problem happens...
     
    Last edited: Jan 27, 2019
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Doesn’t sound like it’s MicroSplat related; I don’t have any selection of painting code in there.
     
  29. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    So worked out that it appears to be an interaction with Gaia - if the terrain is created in Gaia, and then Microsplat is applied, the terrain breaks... Posting for Adam in the Gaia forum now!
     
  30. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Hmmm, I'm not so sure... I started a brand new project, only Microsplat imported. I create a terrain, and everything is fine. I apply Microsplat, and everything is fine. But if I then delete the terrain, and create a new terrain object, it's no longer possible to create new terrain texture layers. If I try to create a new terrain, after having applied Microsplat to another terrain, I get a "MissingReferenceException: The Object of type 'Material' has been destroyed but you are still trying to access it." Even if I create a whole new scene, after having added Microsplat one time I can longer create a correctly functioning terrain.

    I have a feeling this is linked to the problem before, but even if not, it's still kinda breaking...!
     
  31. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Doing a few tests, I think it's linked to Cleanup() in MicrosplatTerrain.cs. It's a little difficult to follow what's happening in that script, but DestroyImmediate(matInstance) seems to be destroying something that's needed for correctly creating a new terrain object...… At least, when I comment out that line, it appears to fix at least some of the problems I've been seeing!
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Removing that line just means your going to leak a material every time the terrain is destroyed via scene loads, play mode, etc.. none of that has any possible intersection with being able to select objects.
     
  33. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    I’m considering downloading Microsoat and purchasing some modules.

    I know that performance varies based on what’s active...but I’m curious how performance compares to a Normal Unity terrain with the normal shaders.

    Is it better.... the same?
     
  34. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    I dunno, just tellin' it as I see it! It doesn't fix all the selection problems happening through Gaia, but that DestroyImmediate really looks like it's doing something it shouldn't be!

    The repro is super simple... Version 2018.3.3f1 of Unity, MicroSplat 2.21. Create a new project with only MicroSplat imported. Create a terrain object. Add Micro Splat Terrain, and Convert to MicroSplat. Delete the terrain object. Create a new terrain object (without MicroSplat). Now check the terrain painting tab - mine looks like the attached screen, with no brushes or texture layers, and no way to add them... To get the painting back again, I need to re-convert to MicroSplat, or apply another custom shader, I can no longer use a terrain with the default Unity terrain shaders.

    Create a new project, do everything the same again, but with DestoryImmediate commented out, and that issue is no longer there...


    TerrainScreen.png
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's very similar with the same feature set turned on and only 4 textures. As you increase the number of textures in use, MicroSplat begins to out perform the Unity shader due to it's single pass nature.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So this repros, but is some bug in Unity's painting tool code, as no MicroSplat code is in the call stack (or even in use when the error happens). Basically, it looks like they are hanging on to whatever material is on the terrain in their painting code and expecting it to be there after the terrain is deleted. Not cleaning up the material effectively leaks it, which prevents the null exception in their UI code. I'll file a bug with Unity- they clearly need to test the terrain material for null in their code there.


    MissingReferenceException: The object of type 'Material' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Object.get_name () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:198)
    UnityEditor.Experimental.TerrainAPI.PaintTextureTool.DrawFoldoutEditor (UnityEditor.Editor editor, System.Int32 controlId, System.Boolean& visible) (at /Users/builduser/buildslave/unity/build/Modules/TerrainEditor/PaintTools/PaintTextureTool.cs:71)
    UnityEditor.Experimental.TerrainAPI.PaintTextureTool.OnInspectorGUI (UnityEngine.Terrain terrain, UnityEditor.Experimental.TerrainAPI.IOnInspectorGUI editContext) (at /Users/builduser/buildslave/unity/build/Modules/TerrainEditor/PaintTools/PaintTextureTool.cs:115)
    UnityEditor.TerrainInspector.ShowPaint () (at /Users/builduser/buildslave/unity/build/Modules/TerrainEditor/TerrainInspector.cs:1549)
    UnityEditor.TerrainInspector.OnInspectorGUI () (at /Users/builduser/buildslave/unity/build/Modules/TerrainEditor/TerrainInspector.cs:1950)
    UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
    UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So I found a way to work around this- if the terrain gets set back to standard before it's deleted, the painting interface clears out the pointer to the material correctly. Luckily I can do this in the cleanup function by adding:

    terrain.materialType = Terrain.MaterialType.BuiltInStandard;

    after the material is destroyed.
     
    StevanJay likes this.
  38. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Nice, thanks for the follow-up... :)
     
  39. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Hi there, for some reason after I updated to Unity 2018.3 some textures are no longer selectable in the "Paint Texture" tab for all previously existing terrain. The funny thing is for new created terrains it all works fine.
    I tried to update the descriptor, the shader and the textures themselves but nothing works, so I think the existing metadata is corrupt in either Unity editor or Microsplat files.

    It appears this is only happening for textures that already exists in other slots (but have different colors/properties).

    Is there anything I can do that you can think of?
    Thanks for your time
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Could it be related to the above? In the above case Unity’s painter throws a null ref and doesn’t draw the GUI. Is this the same in your case? Also, just to be clear, you edit textures via the texture array config not the Unity UI.
     
  41. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Update, this is what I did to workaround the issue:
    - replaced all affected textures in MicrosplatConfig file
    - clicked "update"
    - restarted Unity
    - clicked "Update terrain descriptor data"
    - clicked "Sync"

    All textures are now selectable but the error below keep showing up regardless:

    MissingReferenceException: The object of type 'TerrainLayer' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Object.get_name () (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:198)
    UnityEditor.Experimental.TerrainAPI.PaintTextureTool.DrawFoldoutEditor (UnityEditor.Editor editor, System.Int32 controlId, System.Boolean& visible) (at C:/buildslave/unity/build/Modules/TerrainEditor/PaintTools/PaintTextureTool.cs:71)
    UnityEditor.Experimental.TerrainAPI.PaintTextureTool.OnInspectorGUI (UnityEngine.Terrain terrain, UnityEditor.Experimental.TerrainAPI.IOnInspectorGUI editContext) (at C:/buildslave/unity/build/Modules/TerrainEditor/PaintTools/PaintTextureTool.cs:147)
    UnityEditor.TerrainInspector.ShowPaint () (at C:/buildslave/unity/build/Modules/TerrainEditor/TerrainInspector.cs:1549)
    UnityEditor.TerrainInspector.OnInspectorGUI () (at C:/buildslave/unity/build/Modules/TerrainEditor/TerrainInspector.cs:1950)
    UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Also, now any values I change in the Microsplat material array, takes 1-2 minutes to update...

    Regards
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Sounds similar to the issue above where the new painting interface is keeping references to deleted objects. Do you have a repro of how you got it into this state, or a project with it in this state that I can look at?
     
  43. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    My project is very big but I will try to assemble something. it might take some time tough...
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    @hippocoder Can you remove this; it has paid modules included in it..
     
    Last edited by a moderator: Jan 28, 2019
    hippocoder likes this.
  45. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Done, sorry about that...
     
    hippocoder likes this.
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ok, I have a fix for this- let me know if it fixes it on your main project as well. In MicroSplatTerrain, replace the RestorePrototypes function with this version:

    Code (CSharp):
    1. void RestorePrototypes()
    2.    {
    3.       if (templateMaterial != null)
    4.       {
    5.          Texture2DArray diffuseArray = templateMaterial.GetTexture("_Diffuse") as Texture2DArray;
    6.          if (diffuseArray != null)
    7.          {
    8.             var cfg = JBooth.MicroSplat.TextureArrayConfig.FindConfig(diffuseArray);
    9.             if (cfg != null)
    10.             {
    11.                int count = cfg.sourceTextures.Count;
    12.                if (count > 32)
    13.                   count = 32;
    14. #if UNITY_2018_3_OR_NEWER
    15.                var protos = terrain.terrainData.terrainLayers;
    16.                bool needsRefresh = false;
    17.                if (protos.Length != count)
    18.                {
    19.                   needsRefresh = true;
    20.                }
    21.                if (!needsRefresh)
    22.                {
    23.                   for (int i = 0; i < protos.Length; ++i)
    24.                   {
    25.                      if (protos[i] == null)
    26.                      {
    27.                         needsRefresh = true;
    28.                         break;
    29.                      }
    30.                      if (protos[i] != null && cfg.sourceTextures[i] != null && protos[i].diffuseTexture != cfg.sourceTextures[i].diffuse)
    31.                      {
    32.                         needsRefresh = true;
    33.                         break;
    34.                      }
    35.                   }
    36.                }
    37.                if (needsRefresh)
    38.                {
    39.                   Vector4 v4 = templateMaterial.GetVector("_UVScale");
    40.  
    41.                   Vector2 uvScales = new Vector2(v4.x, v4.y);
    42.                   uvScales = MicroSplatRuntimeUtil.UVScaleToUnityUVScale(uvScales, terrain);
    43.  
    44.                   protos = new TerrainLayer[count];
    45.                   for (int i = 0; i < count; ++i)
    46.                   {
    47.                      string path = UnityEditor.AssetDatabase.GetAssetPath(cfg);
    48.                      path = path.Replace("\\", "/");
    49.                      path = path.Substring(0, path.LastIndexOf("/"));
    50.                      path += "/microsplat_layer_";
    51.                      TerrainLayer sp = UnityEditor.AssetDatabase.LoadAssetAtPath<TerrainLayer>(path);
    52.                      if (sp != null)
    53.                      {
    54.                         if (sp.diffuseTexture == cfg.sourceTextures[i].diffuse)
    55.                            continue;
    56.                      }
    57.  
    58.                      sp = new TerrainLayer();
    59.  
    60.                      sp.diffuseTexture = cfg.sourceTextures[i].diffuse;
    61.                      sp.tileSize = uvScales;
    62.                      if (cfg.sourceTextures[i].normal != null)
    63.                      {
    64.                         sp.normalMapTexture = cfg.sourceTextures[i].normal;
    65.                      }
    66.                    
    67.                      protos[i] = sp;
    68.  
    69.                      if (sp.diffuseTexture != null)
    70.                      {
    71.                         path += sp.diffuseTexture.name;
    72.                      }
    73.                      path += "_" + i;
    74.                      path += ".terrainlayer";
    75.                      UnityEditor.AssetDatabase.CreateAsset(sp, path);
    76.                   }
    77.  
    78.                   terrain.terrainData.terrainLayers = protos;
    79.                   UnityEditor.EditorUtility.SetDirty(terrain);
    80.                   UnityEditor.EditorUtility.SetDirty(terrain.terrainData);
    81.  
    82.                }
    83. #else
    84.  
    85.  
    86.                var protos = terrain.terrainData.splatPrototypes;
    87.                bool needsRefresh = false;
    88.                if (protos.Length != count)
    89.                {
    90.                   needsRefresh = true;
    91.                }
    92.                if (!needsRefresh)
    93.                {
    94.                   for (int i = 0; i < protos.Length; ++i)
    95.                   {
    96.                      if (protos[i].texture != cfg.sourceTextures[i].diffuse)
    97.                      {
    98.                         needsRefresh = true;
    99.                      }
    100.                   }
    101.                }
    102.                if (needsRefresh)
    103.                {
    104.                   Vector4 v4 = templateMaterial.GetVector("_UVScale");
    105.  
    106.                   Vector2 uvScales = new Vector2(v4.x, v4.y);
    107.                   uvScales = MicroSplatRuntimeUtil.UVScaleToUnityUVScale(uvScales, terrain);
    108.  
    109.                   protos = new SplatPrototype[count];
    110.                   for (int i = 0; i < count; ++i)
    111.                   {
    112.                      SplatPrototype sp = new SplatPrototype();
    113.                      sp.texture = cfg.sourceTextures[i].diffuse;
    114.                      sp.tileSize = uvScales;
    115.                      if (cfg.sourceTextures[i].normal != null)
    116.                      {
    117.                         sp.normalMap = cfg.sourceTextures[i].normal;
    118.                      }
    119.                      protos[i] = sp;
    120.                   }
    121.  
    122.                   terrain.terrainData.splatPrototypes = protos;
    123.                   UnityEditor.EditorUtility.SetDirty(terrain);
    124.                   UnityEditor.EditorUtility.SetDirty(terrain.terrainData);
    125.                }
    126. #endif
    127.  
    128.             }
    129.          }
    130.  
    131.       }
    132.    }
     
  47. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Hey! So another weird interaction with Gaia in version 2018.3.3f1... Terrain created with Gaia will not tesselate, it just vanishes where it should be tesselating - see screen shots below with tessellation on and off. I'm posting to Adam also in case it's a Gaia problem, but maybe you're interested to check it also... To repro, create a new project with only MicroSplat, Microsplat Tesselation, and Gaia. Create a terrain using Gaia. Convert to Microsplat and turn on Tesselation, and you'll see that it doesn't work...

    TesselationOn.png TesselationOff.png
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Is this using the new instancing feature of 2018.3? Does turning that off change the result? Not sure what Gaia would have to do with it..
     
  49. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    Ah, of course, that's it - Gaia is creating terrain with instancing on by default. Turn that off and it fixes both the selection and tessellation issues I was seeing... :)
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So I submitted a repo of a bug with tessellation and instancing not compiling on metal in 2018.3f1, but Unity says that issue is fixed in the latest patches, but I haven't had a moment to test yet.
     
Thread Status:
Not open for further replies.