Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Mind sending me your project so I can take a look? Could just be a bug, since it looks like height is going sideways to me, but hard to tell from the screenshots. I'm excited to get some users on the graph though!

    The height value comes from the bounds of your selection, not the bounds of the used terrain. I'm pretty sure this means that if you have a Unity terrain at 0,0,0 and the lowest height of any point in the terrain is 100 (and the highest 200), then a value of 0.5 would be the start of your terrain. I'm open to suggestions of better ways to handle this, but it seemed the logical choice when texturing whole scenes to use the bounding box of the selection of objects.

    Also, keep in mind the MegaSplat format- if you are using a selector to choose between a texture on the bottom layer and not using the top layer/blend, then there is no controllable blending area. The texture will blend, but only between the two control points. If you want to create a controllable blend area, then I would suggest plugging one texture into the top, another into the bottom, and generating the blend factor with a pass filter or curve based on the height, rather than using a selector.

    The MegaSplat format is a little odd this way, since people tend to think about it more like a traditional splat map format where you have N number of weights. But it's really only 2 textures at any given time (when using a two layer shader) and a blend factor between them. Tools like the auto brush, for instance, attempt to make the workflow seem like a traditional workflow, but the texture graph really exposes you to the raw data format. This is why I've built up such a large toolset around MegaSplat, including things like the texture graph- because a simple conversion from traditional splat data will never take advantage of the format the way working in the format natively will.
     
    Last edited: Apr 29, 2017
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Map Magic is about to ship with a built in MegaSplat node (might want to ask the author about it- but it's all done and last time we spoke he was close to shipping the new version). This node works at runtime, or editor time, and lets you access each texture cluster as if it's a regular texture in MapMagic.
     
    Steve-Tack and malkere like this.
  3. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Ah I do see it in the beta repository, I guess I never tried to use it because I don't own MegaSplat.... yet
    I only work in runtime though... I can imagine it works fine once the scene is setup properly, but I wanted to make sure there isn't a "convert" lag that shows up with every new terrain generated. I posted in the MapMagic thread where people have mention MegaSplat before, is what brought me here. Maybe someone there has tried it. /cheers
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, I wrote the original node, and Denis finished it off. I'm not intimately familiar with Map Magic, but from what I can tell it follows the same pattern as his other output nodes but does the equivalent of what my terrain converter does at the end stage, which is a reasonably fast operation.

    If you want a simple blend between two textures with a controllable blend area, I think this is what you want:

     
  5. SyGem

    SyGem

    Joined:
    Apr 8, 2017
    Posts:
    17
    I'll get a minimal project too you as soon as I can - this is the result I am seeing:
    megasplat_3.png
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Your terrain isn't rotated or something, right? Very odd.
     
  7. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    Thanks for the label-fix ... works great.
     
    jbooth likes this.
  8. mwituni

    mwituni

    Joined:
    Jan 15, 2015
    Posts:
    345
    1) I might be missing a trick, but the shader-editor can be difficult to edit ... i tried changing the texture scale and it took a while because it keeps recompiling. It might be an idea to have a toggle to disable the live compiling till all changes are made. But it may be my mediocre PC too.

    2) Are there any utilities that can help swap out a texture on terrain? - like mud for sand. Either across entire terrain, or better ... under brush.

    3) Or maybe that can be done with the graph - if its able to read and edit the current terrain splatmap.
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Right now it recompiles any time a property is changed. I generally do all the wiring, then press compile. I really wish Unity still had a way to internally compile a shader, because that would get rid of the pause. (Well, that and background shader compiling. Silly that it's on the main thread). I can look at the possibility of a toggle for this or something though..

    Hmm, reading the current terrain is a definite possibility. If I were to add an 'if' node, then you could graph out a search replace function using the Texture Graph, which would be pretty useful. Neat idea..
     
    mwituni likes this.
  10. Falagard

    Falagard

    Joined:
    Jan 8, 2014
    Posts:
    43
    That was my original plan, but I'm not just dealing with splines, I'm dealing with shapes that need to be filled in.
     
  11. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    I think I found a bug with the MegaSplatCollisionInfo. It's giving array index out of bounds exceptions. This
    int textureIndex = Mathf.Clamp(d.index0, 0, textureList.textureNames.Length); should be changed to
    int textureIndex = Mathf.Clamp(d.index0, 0, textureList.textureNames.Length - 1);

    I haven't noticed this error previously though, so is this a bug on my end that's causing this error to occur?
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You're likely just the first one to hit it - thanks!
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, I got this reply from my Unity support rep on the 5.6 breaking texture arrays issue:

    "Sorry for the delay in getting back. The issue is due to be patch between the 5.6.2p4 patch release and 5.6.3.

    5.6.2p4 is due 12/07/17
    5.6.3 is due toward the end of July"

    So, 4 months seems like a long time to wait for them to fix a major regression like this. My rep is going to ask to see if it can be moved forward - I suggest that any of you who want Texture Arrays to work in 5.6 to write support about the issue, as more noise usually == faster fixes.
     
    TalkieTalkie, ftejada and dyox like this.
  14. bmaricle

    bmaricle

    Joined:
    Apr 16, 2015
    Posts:
    3
    Hi J, excited about learning this new tool (new for me.) Looks really cool!

    I am looking at your documentation and trying to set up arrays for my scene using the MSEO method. It's not entirely clear but I think it requires 3 texture arrays, one for diffuse, one for normals, and one for MSEO texture, right?

    I looked at your regular normal texture that would be used in this setup and you have a blank alpha channel. Is that necessary, or can I remove that channel from normal maps for my scene?
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, if you're using MSEO, then the normal maps are just regular old Unity normal maps (set to normal on import, as well).
     
    bmaricle likes this.
  16. WileE

    WileE

    Joined:
    Apr 12, 2016
    Posts:
    21
    Thanks Jason. I went back and reconstructed a single packed splat texture from my Quixel source, and regenerated the Macro textures and packed them, all with color management turned off in PhotoShop ("Monitor RGB"). Then everything matches up as expected. So your original suggestion was correct. Thanks again.
     
  17. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    309
    I've submitted a support request. Not that I carry any kind of weight, but maybe if they hear from enough people they'll move the fix up to an earlier patch release.
     
    ftejada, Dwight_Everhart and jbooth like this.
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Got this from Unity this morning on the 5.6 texture array issue:

    "The issue has been bumped forward so it looking to come out in either 5.6.1p3 (31/5/17) or p4 (7/6/17)."
     
  19. inoj

    inoj

    Joined:
    Feb 27, 2014
    Posts:
    21
    Very happy to read this! I don't know much about the situation, but what i've read in forums, you have worked so hard to get that thing bumped, and i understand that it's neccessary for MegaSplat to work in 5.6. Very nice good news :)
     
  20. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Just wondering what would be the best workflow if I want to use spat maps generated with World Machine. Just apply the splatmap on the Unity terrain and then convert it to Megasplat or is there a more elegant way of achieving this?
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That would likely give you the best result, though there is a color to splat tool that can convert them as well.
     
    cygnusprojects likes this.
  22. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    309
    That's great news, I'm glad to hear they're willing to try and push it forward.
     
  23. Rohculus

    Rohculus

    Joined:
    Apr 7, 2015
    Posts:
    9
    Hi Jason,
    I recently purchased mega splat and it's a really great product! I have been painting a mesh with the vertex painter tool and everything works fine in the editor and at run-time, however whenever I build, the mesh loses all the texture data. I have been checking the documentation however I can't seem to locate the issue, I am not sure if I am missing a simple step or if it's just a simple setting or something. Please let me know. Sorry if this has been asked before. If this has been resolved before in the forum please link it as I can't seem to find anything on this.
    Thank you.
     
  24. SyGem

    SyGem

    Joined:
    Apr 8, 2017
    Posts:
    17
    I have managed to create my own texture arrays, but the preview images are all a bit messed up:
    megasplat_texture_arrays.png
    Any ideas what I am doing wrong?

    Also, the tessellation looks amazing, but I have road meshes overlaid on the terrain - and the tessellation is coming up through the roads. Is there any chance of adding a tessellation mask option in the future? This tessellation shader seems to have such an option.
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Strange, I have not seen that before. You might try restarting unity and updating the texture array.

    You can paint the amount of displacement an area gets, so you can dampen those areas.
     
    SyGem likes this.
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'm assuming your using Unity 5.6? Unity decided that they didn't need to write unit tests for Texture Arrays and broke them in 5.6. I submitted a minimal repro when Unity 5.6 shipped. They currently have the fix scheduled for a future patch which is about a month out, but if you want it sooner, please contact support and let them know it's blocking your progress. The more noise we make the faster they will fix it (I managed to get them to move the patch up a few weeks as they were originally scheduling it for the end of July). You're other option is to not stay on the bleeding/breaking edge of Unity and use a pre-5.6 version.
     
  27. SyGem

    SyGem

    Joined:
    Apr 8, 2017
    Posts:
    17
    I had the packing mode for the preview set to standard instead of Normal Smooth AO :oops:.

    Thanks for pointing me in the right direction. I'll try to automate this, otherwise I'll have many km of roads to paint!
     
    jbooth likes this.
  28. gibmation

    gibmation

    Joined:
    Dec 1, 2014
    Posts:
    311
    Hi Jason Im getting the following errors any idea whats causing this?
    Thanks

    Not allowed to access vertices on mesh 'Combined Mesh (root: scene)'
    UnityEngine.Mesh:get_vertices()
    JBooth.VertexPainterPro.VertexInstanceStream:Apply(Boolean) (at Assets/MegaSplat/VertexPaint/VertexInstanceStream.cs:481)
    JBooth.VertexPainterPro.VertexInstanceStream:Start() (at Assets/MegaSplat/VertexPaint/VertexInstanceStream.cs:216)

    Not allowed to access triangles/indices on mesh 'Combined Mesh (root: scene)'
    UnityEngine.Mesh:get_triangles()
    JBooth.VertexPainterPro.VertexInstanceStream:Apply(Boolean) (at Assets/MegaSplat/VertexPaint/VertexInstanceStream.cs:486)
    JBooth.VertexPainterPro.VertexInstanceStream:Start() (at Assets/MegaSplat/VertexPaint/VertexInstanceStream.cs:216)

    Not allowed to access colors on mesh 'Combined Mesh (root: scene)'
    UnityEngine.Mesh:get_colors()
    JBooth.VertexPainterPro.VertexInstanceStream:EnforceOriginalMeshHasColors(Mesh) (at Assets/MegaSplat/VertexPaint/VertexInstanceStream.cs:241)
    JBooth.VertexPainterPro.VertexInstanceStream:Apply(Boolean) (at Assets/MegaSplat/VertexPaint/VertexInstanceStream.cs:500)
    JBooth.VertexPainterPro.VertexInstanceStream:Start() (at Assets/MegaSplat/VertexPaint/VertexInstanceStream.cs:216)
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, you have your mesh set to not be read/write in your import settings, so there's no way to access the mesh data.
     
  30. gibmation

    gibmation

    Joined:
    Dec 1, 2014
    Posts:
    311
    Hi Jason,

    OK what I did was export the _splat prefab to another project.
    The _splat has no properties for read/write.

    I did not include the original mesh, do I need to do this?
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You shouldn't have to include the original - it's just a mesh asset at that point, though I'm not sure how it would have been set to read only in that case. Maybe re-convert it and see if that fixes it?
     
  32. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    755
    I encountered this issue if the object in the scene is set to batching static.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, setting the static flag will cause this as well; to statically batch things, you need to bake out the final paint job..
     
  34. capnbubs

    capnbubs

    Joined:
    Jan 26, 2009
    Posts:
    85
    For some reason Parallax seems to be broken for me when not using Tessellation, instead of distorting the texture outwards from the surface normal it seems to be pushing the texture sideways along the surface.
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Parallax mapping can't push outward- it's just a simple trick to distort the UV lookups based on the camera. You might be thinking of Parallax Occlusion Mapping, which does create a depth effect, but would be unbelievably expensive if used instead of tessellation.

    That said, what combination of shader features are you using?
     
  36. TalkieTalkie

    TalkieTalkie

    Joined:
    Jul 5, 2012
    Posts:
    123
    Is it possible for Megasplat to have a function where if a texture is painted on certain specific texture, a set value (assigned in editor) is automatically set for the displacement for areas intersecting the other? (so we don't have to go around doing this in a large terrain)

    Anyway, waiting for 5.6 Unity update, I haven't bothered updating from 5.5.3p1 so far (more afraid of Unity updates than anything else, they break more things). I really wanna switch to Vulkan.
     
  37. ChinChiaYeh

    ChinChiaYeh

    Joined:
    Sep 14, 2016
    Posts:
    23
    Mesh in Alpha mode doesn't cast shadow in lightmap.
    It cast shadow in realtime light.
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you turn on per texture displacement amount, you can set the amount of displacement each texture gets. So you can just have a texture which has 0 displacement.

    Why Vulcan? Are you cpu bound on batch counts?
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Can you post your shader settings?
     
  40. jim-burn

    jim-burn

    Joined:
    Dec 5, 2015
    Posts:
    4
    I have a problem with Megasplat VERY slow (the editor). I have an I7 6700 HQ and an NVidia 950M, but the editor is almost impossible to use.
    It seems that it is saving something all the time (the cursor is the same as when you are saving). It takes about 20s to click on a checkbox and see it checked.
    The terrain editor suffer of the same problem. If I select the terrain or something else I get back to normal speed.
    There is something that is taking too much time somewhere.
    Why not have a button to generate the shader, so that we can set all the parameters at once and click generate?

    Anyone has the same problem? It is very frustrating?

    I haven't mentioned that the clusters do not refresh (the old one are ok, the one I created all have the same texture).
    And also when I tried to convert my terrain to Megasplat, I got totally random results, with textures I have not selected located at the wrong place.

    Well, I don't know how you can help, or is it just me having these problems?
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Are you talking about the shader generation settings, or the regular shader settings? The shader generator settings should take a second or two to recompile the shader when changed (no where near 20 though), and changing any of the actual shader parameters should be realtime.

    What do you mean by not refreshing? Do you have multiple textures in your cluster? Also, have you tried adjusting the cluster noise scale? Which conversion process did you use?
     
  42. ChinChiaYeh

    ChinChiaYeh

    Joined:
    Sep 14, 2016
    Posts:
    23
     

    Attached Files:

  43. TalkieTalkie

    TalkieTalkie

    Joined:
    Jul 5, 2012
    Posts:
    123
    Isn't 950M a laptop card? I don't think on mobile with these cards something like Megasplat with tessellation would run without massive performance hit (unless it's a laptop with one of the new nVidia cards, like 1080).
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I do dev on a laptop- as long as you keep things reasonable it's fine. I *think* he's talking about the pause when it regenerates the shader..
     
  45. Seoulsfinest

    Seoulsfinest

    Joined:
    May 9, 2017
    Posts:
    7
    Hi Jbooth and readers,

    I have a problem with vertex painting when using my own mesh. I want to state that im in no way a unity expert so it might be easy to miss something here. This is my problem:

    I made a simple road and little mountain in the middle and exported them as a fbx. Once in Unity I use the mesh converter just as in your tutorial video on youtube. All goed well, the new mesh is pink when imported.

    Then I assign my texture maps to the model and try to paint the model. This is where I get stuck. Nothing happens when i try to paint on the mesh. Is there something I don't see?

    I am running unity 5.5 D11, have the meshes on read/write and emulation is off.

    Hope someone can help me to actually do some awesome stuff with Megasplat.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Did you create a MegaSplat shader and material, setup the options and assign the texture arrays to the material's diffuse/normal/etc slots? Do you see an untextured model, or a model with a single texture on it?
     
  47. Seoulsfinest

    Seoulsfinest

    Joined:
    May 9, 2017
    Posts:
    7
    First of all thanks for the fast reply. I havent looked into those because i was hoping i could just paint on converted meshes like you do in your ''MegaSplat, working with meshes and texture array'' video on youtube. I'll have another look into the documentation.

    Another little question, in your ''MegaSplat, working with meshes and texture array'' video you have other shader options then i have. In the video i can see Megasplat_Macrolayer and MegaSplat_MacroDetail. I on the other hand have the options you can see in the picture. unityforum.jpg

    Is this because i run a newer version or is it because i havent set the materials up in the right way.
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    So, MegaSplat is likely a bit different than other packages. Rather than including a bunch of shaders, it generates a new shader to replace the current one whenever you change an option on it. This allows me to have hundreds of options which all compile out when not in use, something not possible with the standard workflow. Once you create a shader and assign it to a material, you can select which shader options you want in the top section of the GUI. This will rewrite your shader code and expose the various options for those features in the sections below.

    You need to assign this material to your mesh and set the texture arrays on it. Think of a texture array just like a texture; if you make a standard material, you need to assign the diffuse texture to it. Same for MegaSplat, but you assign a diffuse texture array instead.

    You can also just assign one of the example materials and start playing with it, since it's all setup. But keep in mind when you change shader options on it you'll be changing the examples as well, and they will get overwritten when you upgrade MegaSplat to a new version.
     
    Seoulsfinest likes this.
  49. feckwagon

    feckwagon

    Joined:
    Apr 8, 2008
    Posts:
    13
    Hi Jason, first off I’m absolutely loving MegaSplat. We use Substance Designer to generate our textures so the cluster approach is a fantastic way to get the most out of them. Thank you for an amazing tool.

    I’m currently trying to get a nice base using the texture graph. I seem to be having the same problem as SyGem with height nodes not giving the expected outcome. I’m wondering if its to do with the size of my terrain? We have a rather large landscape that is split into 5000 unit squares. It does sometimes feel like the shape it creates correlates to a smaller section of the terrain but it could be my imagination. Have you managed to look into the issue or have I made a mistake somewhere?

    Thanks for your time
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, there's a bug with the height calculation on Unity Terrains (works fine on meshes). This is fixed in the latest version, which is waiting for approval. If you email me your invoice I can send you an early version. We also discovered an issue where the values are incorrect if the height map data is not the same size as the control texture- I have not fixed this yet, but will be looking at it next week - for now keep them the same resolution.