Search Unity

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

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

  1. SonGoku10c

    SonGoku10c

    Joined:
    Dec 9, 2017
    Posts:
    75
    thx for the answers.

    When I activate Splat UV Mode --> UV Project Axis --> World and Top I get this: Megasplat3.JPG
    OK. With a higher Control texture resolution the hexagons are smaller (from 16 to 2048), but I still don't know how to set the MultiBands and co to get my nice beach at only 100m and below. I can't get belower then this in the picture. and the problem with the terrainborder is still here. ^^ Megasplat4.JPG
     
    Last edited: Feb 21, 2018
  2. ajz3d

    ajz3d

    Joined:
    Oct 12, 2015
    Posts:
    25
    Hi Jason.
    Would you consider restoring Substance support after 2018.1 and Allegorithmic's external plugin are released?
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    We have no idea what that is going to look like yet..
     
  4. Fairennuff

    Fairennuff

    Joined:
    Aug 19, 2016
    Posts:
    84
    Hello Jason,

    I'm using Megasplat on my terrain and have parallax map enabled. Trying to get my blood decals to not look like they are floating above the terrain. I've tried quads and box projectors but since the collision mesh doesn't line up it's either not visible or appears to float. Any suggestions on how to fix this?

    Thanks!

    Edit also my texture clusters now look like this with 2017.3. Not sure when it happened as I upgraded a while ago.
    Capture.PNG
     
    Last edited: Feb 27, 2018
  5. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    67
    What is the quickest way to update an existing texture array config (and clusters) and having the changes reflect on the terrain?

    Right now I go to TA config -> swap in and out textures, change clustered textures, etc -> 'Update' TA config -> Go to terrain painter -> Utility -> Convert

    I'm sort of surprised that the changes don't get reflected on the terrain immediately after updating the texture array. Going through the converter utility gets a bit cumbersome when experimenting with different clusters/textures.
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    If should update immediately. Perhaps you have a different array assigned than you think?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    A deferred decal solution is likely your best bet. Try regenerating the clusters?
     
  8. briank

    briank

    Joined:
    Mar 25, 2017
    Posts:
    67
    No dice. Texture arrays appear to be referenced correctly. (I currently only have 2diffuse + 2AO/Normals in the entire project, this custom TA and the example TA megasplat imported).

    This is my current repro...
    * Adjust some cluster settings, like changing the texture that is used by a certain cluster
    * Minimize all the cluster tabs (doubt it matters)
    * Hit 'Update'
    * Wait for progress bar to go away.
    * While I'm not sure how to visualize the texture array, it has been modified according to the file explorer

    Expected: Cluster changes reflected in terrain
    Actual: No visual change.
    Workaround: Use terrian converter.

    Let me see if I can repro this in a simpler project but that may take a while.
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726

    Oh, I see - your changing cluster settings, not updating textures. In MegaSplat, clusters are all edit time and therefor have no runtime cost. So you can’t adjust them and expect the terrain to update, because it doesn’t know about clusters at all..
     
  10. tork12

    tork12

    Joined:
    Dec 16, 2017
    Posts:
    37
    Hi Jason, regarding MircroSplat I'm thinking of purchasing the Terrain and Object blending as well as Streams and Lava addons but wanted to confirm something first. If I didn't use MicroSplat (I'm not actually sure what it does) to do anything to the terrain, but used other terrain creation and shading assets, is it enough to just have microsplat installed and I can then blend terrain and objects, or would I have needed to initially used microsplat to setup the terrain, or shade the terrain in order to use the lava addon, and blending addon?
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    All the modules are extensions for MicroSplat's terrain shading system, so if you're not using MicroSplat for your terrain shader, they won't do anything.
     
  12. Ishizuke

    Ishizuke

    Joined:
    Jan 27, 2015
    Posts:
    36
    Seems like MegaSplat material is unaffected by standard Unity fog. At least when I use Unistorm fog all opaque surfaces affected except Megasplat terrain meshes. Is there any solution for that?

    Edit. Even trnasparent surfaces affected, like AQUAS water, but not Megasplat terain.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    There’s fog in most of the example scenes..
     
  14. Ishizuke

    Ishizuke

    Joined:
    Jan 27, 2015
    Posts:
    36
    I found that fog works only if camera use "Forward" mode, but not "Deferred". But other parts of the scene affected by fog in both camera modes.
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    Unity's standard fog doesn't work in deferred ever- that's why they have the fog post processing component instead - the reason the other objects work is because they don't render correctly as deferred objects, but are forcing themselves to render as forward. (For instance, all alpha objects are renderer forward because you can't render alpha in deferred).
     
  16. Grendelbiter

    Grendelbiter

    Joined:
    Oct 14, 2016
    Posts:
    119
    I'm sure I'm missing something really obvious. I can't paint lava with the Terrain Painter. If I hit fill on the Puddles Tab it fills everything as expected with lava. But I can't paint. Turned up the flow to max, brush size to max, made sure the Active checkbox is checked, butr nothing happens when I click and drag on the Terrain. Texture clusters work fine.
     
  17. wkidwell

    wkidwell

    Joined:
    Jan 24, 2018
    Posts:
    11
    Hello,
    I purchased MegaSplat and am trying get started by watching the YouTube video : Quick Tutorial: Setup a Unity Terrain for painting with MegaSplat.
    However when I tell the Terrain Paint tool to set up my terrain for me, then go to change the Texture Packing drop down to Normal SAO it's not there.
    My only options available are:
    Default
    No Spec Tex
    No Spec or Normal.
    I did install MicroSplat before MegaSplat to try it out and even purchased the Texture Clusters. Do I need to delete those assets?
    I'm running Unity 2017.30f3 on a PC.
    Also, would it be possible for you to make an updated tutorial for new users, there are so many videos for the different versions, it's a bit confusing.
    Thanks in advance for any help
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    If you look on my YouTube channel, there’s a video for the new texture packer which was introduced in 1.5 that explains the new packing modes. You can also read the extensive documentation which is always up to date. Reshooting 20+ hours of video tutorials every time an option is changed is just not on the table.
     
  19. wkidwell

    wkidwell

    Joined:
    Jan 24, 2018
    Posts:
    11
    I've watched all the MegaSplat videos and am reading the updated documentation from the link provided in the .pdf within the MegaSplat dir.
    The tool is working but like I mentioned previously, the options under Texture Packing are not the same.
    I understand how to create a texture array config and am aware that the naming convention is key.
    All of that works fine but when I select the material, the Texture Packing options available to me are only:
    Default
    No Spec
    No Spec or Normal
    When I should be seeing Normal Smooth AO
    I've plugged in the Albedo/Height Array and Normal with my Texture Array Config_diff_tarray and Texture Array Config_normSAO_tarray
    I've plugged in the Splat Control and Splat Params
    It seems pretty straight forward, i've done this multiple times already, incorrectly it seems, what am I doing out of order?
    I am working with a default Unity terrain and not a mesh.
     
  20. eastes

    eastes

    Joined:
    Sep 1, 2012
    Posts:
    49
    Member of the MegaSplat fan club here.
    The performance optimisation benefits of MegaSplat is underrated and undersold. I'm talking about using it for all meshes in a game. We're seeing 1000's of objects with 100's of textures in a city 4km x 4km. Millions of polygons. Set pass calls under 100. In VR.

    Just here to spread the love. If the texture packer and asset generation pipeline were polished even more, this could be sold as a separate asset. Just for the performance optimisation alone. It should be used for all Unity projects. It's insane.
     
    Akshara, jbooth and boysenberry like this.
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    Default is the replacement for all PBR packing modes (NormslSAO, MSEO, etc). The texture packing system now handles all the conversion and packing for you.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    Thanks! I haven’t pushed this aspect much because I feel the tools aren’t explicitly designed for that use case, though they certainly work for it and lots of people are using it this way. Note they if you use the disable bottom blend option you can make the shader even faster for meshes which don’t need splat map blending.
     
  23. wkidwell

    wkidwell

    Joined:
    Jan 24, 2018
    Posts:
    11
    Great thanks!
     
  24. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    261
    Hi @jbooth -- hope things are well with you.

    Any ETA on the lighting fix and related?

    Thanks!
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    None yet - I've been extremely busy with a ton of life stuff and haven't been working on my assets much lately. That bug is going to require several days of deep diving through versions of Unity's shader code, so it's not something I can bang out in a spare hour.
     
  26. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    261
    OK man, understand you're busy - thanks for the update.
     
  27. Monsignore_Skruggz

    Monsignore_Skruggz

    Joined:
    Apr 7, 2016
    Posts:
    3
    Hey there.
    I have one ore two questions.

    1. My game is mostly set in a „city“ area, which means, I habe mostly streets and buildings and just a little bit of terrain.
    My streets and buildings are build modular. Most of the buildings and most of the street share the same material / normal map and texture sheet.
    I would like to give them more variation and I’m asking myself if I’m right here with MegaSplat? To add/paint grass on a building and rust and dirt and so on. That would speed up everything, instead of doing more second UV maps and fitting textures for rust and dirt and so on.
    So my question is basically:
    Is it possible to stay modular with wall pieces, which have a UV, normal and texture and paint stuff like grass, mud and so on via MegaSplat without pushing my drawcalls up like mad?

    2. For my game being kinda „stylized-realism“ is it possible to swap out all the MegaSplat textures with my own textures? I did all of my textures in Substance Painter and Photoshop with the metallic rough workflow, if that matters.

    Thanks and have a nice weekend.
     
    Last edited: Mar 11, 2018
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    1. Yes, but the trade off would effectively being having a new mesh to hold each paint job. That might not be worth it, especially if what you are after is small details and you need high density meshes to paint on. Textures compress well, unlike meshes.

    2. Yes, of course. The provided textures are mostly to show off things like texture clusters, etc.
     
  29. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    577
    @jbooth you wouldn't by any chance be able to mod the tessellation shder in terms of disabling tessellation on everything not seen by the camera would you? -a Dynamic Tessellation Occlusion Culling, kind of like normal Occlusion culling. this:
    So basically in your MicroSplat Tessellation and Parallax Module video you have your Tessellation set at around 60 but we might be able to half that and in some cases more if we can disable rendering & tessellation on anything behind us or in front of us close by but maybe hidden by something else which since we can't see it, ideally shouldn't be tessellated.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    Tessellation is already culled off camera. Doing it via some sort of occlusion structure would require having that structure easily parsable on the GPU, which Umbra (Unity's occlusion system) doesn't expose.. There's also the question of if it would actually be a speedup since those triangles will get zculled anyway..
     
  31. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    577
    The Occlusion culling I'm using is 3rd party "instantOC" which uses tags and sends the renderer to a different layer that the camera sees and if it's not detected by the camera or close to its range doesn't render it. It works/processes only in real time unlike Unity's Occlusion baking. It's an interesting concept to try.
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    That isn't something that can be sampled at the GPU level- but rather a CPU based technique. Your best bet if you want to take advantage of something like that would be to break your level into more objects so more of them can be culled. But I suspect in some cases it would be a net loss to do that.
     
  33. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    533
    Hi @jbooth

    A silly question, since you have much more experience:

    I have 4096x4096 textures but I package them with MegaSplat at 1024x1024.

    When the game runs, does the loading of the textures in the vram correspond to 1024x1024 or 4096x4096?

    I think it will be at 1024x1024, but the question has arisen and I wanted to confirm it.

    I await your response, greetings.
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    1024, as they are resized as they are packed into the array..
     
    ftejada likes this.
  35. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I have created an empty game object as the root of a set of terrain meshes. The root is rotated on Y to correctly orient the meshes to be the same as the modelling app. I convert the meshes using the MegaSplat Mesh Converter, then drag the converted mesh from the Project view directly onto the empty game object named 'root'. I see the mesh in the editor view and game view, but it doesn't appear under the root in the Hierarchy. Instead, the root becomes the mesh, so it seems. If I drag across a second converted mesh, it replaces the first one but still doesn't show in the Hierarchy

    If I drag the converted meshes over to the Hierarchy, and then parent them to the root, it works fine. It's an extra step to type a zero in the Y rotation field, but no big deal. Seems like a bug though. I should say that this is not a problem with meshes that are not converted.

    Using Unity 2017.3.0f3 and MegaSplat 1.62, on Windows 10 64bit.
     
    Last edited: Mar 14, 2018
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    Sounds like some ancient Unity convenience feature to me, like draging materials onto meshes in the game view. I don’t have any drag and drop code in MegaSplat, and I don’t think Unity even exposes the hooks to change these behaviors.
     
  37. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    Thanks. Oh well. If it works fine with a regular mesh, but not a MegaSplat converted mesh, clearly whatever the conversion does is upsetting that drag and drop feature, but only when parenting. At least another way works.
     
  38. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    Is the MegaSplat Mesh Converter wanting meshes with less than 65534 vertices? I just imported a quarter of a million poly mesh into Unity 2017.3.f3, and it didn't split it, as expected in the 2017.3 versions. But the mesh converter is throwing an error:

    Resulting Mesh Empty_Mesh is over vertex limit, please use a mesh with less vertices
    129600->311377
    UnityEngine.Debug:LogError(Object)
    JBooth.MegaSplat.MeshProcessorWindow:process(Mesh) (at Assets/MegaSplat/Scripts/Editor/MegaSplatMeshProcessor.cs:223)
    JBooth.MegaSplat.MeshProcessorWindow:OnGUI() (at Assets/MegaSplat/Scripts/Editor/MegaSplatMeshProcessor.cs:39)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    The imported mesh does contain 129,600 vertices; I don't know what the 311,377 is referring to.
     
  39. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    Those emojis appeared after I posted, by the way :D
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726

    Yeah, it’s haven’t added support for 32bit indices yet since that’s a relatively new change to Unity.
     
    boysenberry and JBT27 like this.
  41. Alexandre-Vinet

    Alexandre-Vinet

    Joined:
    May 23, 2013
    Posts:
    6
    Hi,

    I made a fresh project with only Megasplat-2018-01-10.unitypackage
    I built only the Mesh Tesselation scene on iOS iPhone 7+ and the terrain is all black.

    Is there any setting I am missing?
    Is the Example Mesh Tesselation working on iOS?
    MeshTesselation.jpg
    Thank you.
    Alexandre Vinet.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    No idea- iOS is going to default to Metal, which Unity just added tessellation support for, but I don't know if iOS actually supports tessellation or not, because as a mobile developer, I'd never use that on a mobile device..
     
  43. Alexandre-Vinet

    Alexandre-Vinet

    Joined:
    May 23, 2013
    Posts:
    6
    boysenberry likes this.
  44. lucidcoder

    lucidcoder

    Joined:
    Mar 23, 2010
    Posts:
    138
    Hi, question for you Jason.

    I have a terrain exported from World Machine. With the standard shader, it looks like this:



    As you can see, it has a normal map applied to it to provide detail over distance. The terrain itself is a bit large, at 2km on one side (2km x 2km).

    I'd like to use MegaSplat, which I purchased a few nights ago, but I don't know how to apply this normal map to the terrain with a MegaSplat material assigned to it. I assumed it might be the "macro" texture but it seems that if I don't assign a Diffuse texture to the Macro texture field, the terrain simply fades to white in the distance, as shown.



    Is there any way to mitigate this?

    If it involves the Custom User Function, I know very little of writing Unity's dialect of Cg, so I'm not sure how much help that will be.
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    I don't believe there's an option for just having a macro normal right now, but what you can do is change the macro mode to blend with Multiply2x instead of using Fade to Macro - this will cause it to always blend the macro texture in. You can then give it a tiny linear, grey texture for the diffuse map with the value set to 0.5, this will have no effect on the color, but blend the normal in. Because the albedo texture is tiny and fits in the cache, it will have practically no effect on performance.
     
  46. lucidcoder

    lucidcoder

    Joined:
    Mar 23, 2010
    Posts:
    138
    Okay, I'll try that. Would that be as simple as editing the outputted shader? I'm assuming so because I am not seeing the blend mode elsewhere in the shader (maybe I'm missing it). And if so, will I have to make that change every time I recompile the shader?
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    Change your macro preset from Fade to Macro and you can customize the blend mode and behavior..
     
  48. wkidwell

    wkidwell

    Joined:
    Jan 24, 2018
    Posts:
    11
    Hey Jason,
    When I try to create a texture array config file I get this exception now:
    UnityException: Failed to create 2D array texture because of invalid parameters.
    UnityEngine.Texture2DArray..ctor (Int32 width, Int32 height, Int32 depth, TextureFormat format, Boolean mipmap, Boolean linear) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cs:719)
    JBooth.MegaSplat.TextureArrayConfigEditor.CompileConfig (JBooth.MegaSplat.TextureArrayConfig cfg) (at Assets/MegaSplat/Scripts/Editor/TextureArrayConfigEditor.cs:820)
    JBooth.MegaSplat.TextureArrayPostProcessor.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at Assets/MegaSplat/Scripts/Editor/TextureArrayPostProcessor.cs:25)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:27)
    UnityEditor.DockArea:OnGUI()

    Now when I reopen my scene megasplat does not remember my blends
     
  49. wkidwell

    wkidwell

    Joined:
    Jan 24, 2018
    Posts:
    11
    I didn't post the exceptions in the correct order, so for clarity there are two errors that Unity is throwing:

    First one:

    Texture2DArray has out of range depth (got 0 max supported 2048)
    UnityEngine.Texture2DArray:.ctor(Int32, Int32, Int32, TextureFormat, Boolean, Boolean)
    JBooth.MegaSplat.TextureArrayConfigEditor:CompileConfig(TextureArrayConfig) (at Assets/MegaSplat/Scripts/Editor/TextureArrayConfigEditor.cs:820)
    JBooth.MegaSplat.TextureArrayPostProcessor:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/MegaSplat/Scripts/Editor/TextureArrayPostProcessor.cs:25)
    UnityEditor.DockArea:OnGUI()

    and here is the second error (exception):

    UnityException: Failed to create 2D array texture because of invalid parameters.
    UnityEngine.Texture2DArray..ctor (Int32 width, Int32 height, Int32 depth, TextureFormat format, Boolean mipmap, Boolean linear) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cs:719)
    JBooth.MegaSplat.TextureArrayConfigEditor.CompileConfig (JBooth.MegaSplat.TextureArrayConfig cfg) (at Assets/MegaSplat/Scripts/Editor/TextureArrayConfigEditor.cs:820)
    JBooth.MegaSplat.TextureArrayPostProcessor.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at Assets/MegaSplat/Scripts/Editor/TextureArrayPostProcessor.cs:25)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:27)
    UnityEditor.DockArea:OnGUI()
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,726
    Looks like you have no textures in the config? Is this on creation of a new array and then everything works fine, or every time you press update?