Search Unity

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

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

  1. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    77
    Ah okay. Very good to know so at least I won't be hunting for it. :D
    I can probably figure some kind of alternative. Thanks for the quick response!
     
  2. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Hi Jason,
    In doing further research on the Low Poly / Flat Shader look I came across this tutorial which talked about using screen-space derivatives rather than the geometry shaders that Megasplat uses. I know your not a fan of geometry shaders and wondered if there was a technical reason why you hadn't implemented this method. It would seem to make flat shading available on all platforms and looks reasonably straight forward?
    I have to assume your aware of this and didn't implement it for a good reason. :)
    Could this be implemented in the MS Custom code option? Would it be a difficult thing to do and would it be worth it?
    Cheers
    Chris
     
    Last edited: Sep 14, 2018
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That's a cool technique- did not think of that, and it's much nicer on performance. The Low Poly mode was put in when I added the 'process in geometry shader' option, as it was basically changing one line of code to not blend the normals. You might be able to do it in a custom node option, but when MegaSplat is using non-tessellated shaders it uses a surface shader, which doesn't give you write access to the TBN matrix or original normal data.
     
  4. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Is that something you might add to Megasplat? Please ;)

    Unless I misunderstood you and it's not possible.
     
    Last edited: Sep 14, 2018
  5. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    I think I nailed the problem down. It's happening when color space is set to linear. To reproduce:
    1. create clean project
    2. import MS
    3. create simple terrain
    4. set up created terarrain for MS
    5. open texture graph, create a cluster node, connect it to both layers
    6. compile
    (for now it should look ok)
    7. change to linear color space
    8. recompile texture graph
    (it will also look ok)
    9. close unity saving a scene
    10. open project and recompile texture graph once again.
    Now the problem should manifest itself.
     
  6. newfinalflashers

    newfinalflashers

    Joined:
    Mar 1, 2014
    Posts:
    27
    Does converting to the new mesh format preserve blendshapes and if not can I change it.
     
  7. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    In Megasplat am I able to apply a color and normal map across the whole terrain and then add more textures and details as as per the attached image? I did this with CTS but there is no procedural texturing in CTS alone which is what I really need. I saw the Color Map to Splat mapping tool but that's not really what I'm looking for. Is this just a matter of scaling in world space? Is Megasplat limited to one texture array, so then one texture size?

    Do I have to use something like Map Magic for proceduraly texturing tiled terrains or will Megasplat support the tiled terrains of 2018.3? Does Megasplat procedural texturing support masks? If so, will it support masks across multiple terrains? And RGBA per channel masks would be nice.

    Sorry if the questions are many and a bit basic. I know where I want to get to, it's just a matter of finding the tools and the workflow that will get me there. :)

    Geo.png

    Edit: Sorry, further question. If I produce the terrains as meshes and use something like SECTR to stream them, how would Megasplat deal with that?
     
    Last edited: Sep 18, 2018
  8. Emme73

    Emme73

    Joined:
    Jan 24, 2013
    Posts:
    25
    Hi, can someone please xplain me the process of texturing across multiple mesh parts with Megasplat ? I have a mesh terrain consisting of 12 separate parts 8for the culling), and I dont know how to texture them as one basically. Thanks !
     
  9. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    I also would would be interested in the answer to that.
     
  10. Emme73

    Emme73

    Joined:
    Jan 24, 2013
    Posts:
    25
    Also, @jbooth , is there an intuitive way to figure out the index number of a texture, when using per texture scale :D ?
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Select all of them when painting, or parent them under a root object and select that.

    If your looking for the texture name, not without cross referencing the texture array.
     
  12. Emme73

    Emme73

    Joined:
    Jan 24, 2013
    Posts:
    25
    Hi @jbooth, not to hijack this thread, but I wonder if You or someone here knows (workflow wise) a way to make a mesh terrain culling-able AFTER I used Megasplat on it. I dont want to split the terrain before megasplatting, but afterwards, so a workflow (if it exists at all) would be great.
     
  13. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    BUMP
     
  14. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    I am having a strange issue. Megasplat works fine on my scenes, but I created a new one and added Megasplat.

    After adding Megasplat, I can only change the textures with the Terrain Converter.
    When I hit save, then load the demo texture array to the paint config,
    I see the brush, but no textures are painted.
    Same goes for wetness and puddles.
    I've tried it with single layer and 2 layer and the shader type is set to terrain.

    I don't know what I am missing. I have removed and reloaded several times, but I can't get it to work on this one scene.

    Do you have any suggestions as to why this is happening?
     
  15. GambitMonkey

    GambitMonkey

    Joined:
    Apr 5, 2016
    Posts:
    65
    Jason,
    I saw your video on Tessellation, Physics, and Megasplat, but I am having a similar issue with Microsplat and I cant seem to find a fix for it.

    When I turn on Tessellation in Microsplat my character immediately falls under the Tessellation. I am figuring this is because the physics engine is ignoring it, but how do I fix that? I searched the forums and Google and have turned up nada. I am using the latest release of everything

    Thanks,
    Garry
     

    Attached Files:

  16. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Hey. Ive noticed some strange behavior. It seems in the demo scene while in triplanar mode. All of the normals reverse, Making stones look like they are indentations.
    https://i.gyazo.com/84f065279e452c7d3f93e4e47e54379a.mp4

    This only happens while in triplanar mode, otherwise the normals are facing the correct way.
     
  17. anpd03

    anpd03

    Joined:
    Aug 7, 2013
    Posts:
    65
    Hi Jason, had some questions about the runtime procedural texturing, saw the dev video you did in 2017 about it. You mention that it is to slow for using it with Unity terrain at runtime? Is that still the case? Microsplat doesn't have this feature correct? There was support for flat, step and under areas. Any plans to add a height based option, for slopes at sea level and similar? Really looking for a performant terrain shader with this feature as we have terrain deformations at runtime.

    Regards Andreas
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Strange, Unity stopped alerting me about this thread! WTF? Ok, some catching up is in order:

    The runtime version works by computing the texturing in the vertex shader. This works well because there are not a lot of vertices. It could be done in the pixel shader, but it would be expensive and the results would be very different because it would choose the texture per-pixel, so not sure if that would be good or not.

    I'm betting one axis of tangents are off, flipping the normals. This is on a terrain or mesh?

    MicroSplat has an option to center the displacement around the original mesh, which helps, but does not strictly solve the issue completely. MegaSplat has some code to get the local displacement so you can offset things yourself, this works ok, but is basically example code for how you could roll your own use-specific handler.

    No, but it'd be easy to do, just add the copy of the blend shape data to the converter.
     
  19. anpd03

    anpd03

    Joined:
    Aug 7, 2013
    Posts:
    65
    "The runtime version works by computing the texturing in the vertex shader. This works well because there are not a lot of vertices. It could be done in the pixel shader, but it would be expensive and the results would be very different because it would choose the texture per-pixel, so not sure if that would be good or not. "

    OK! So it does work well in runtime?
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    On meshes- terrain's use CLODs for vertices, so as you move around the vertices are added/removed which means you can't really do this kind of stuff with them.
     
  21. anpd03

    anpd03

    Joined:
    Aug 7, 2013
    Posts:
    65
    Got it, thanks.
     
  22. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    This was on mesh. Also i think i found a clue, setting triplanar UV scale to -0.001 instead of 0.001 fixes it.
     
    Last edited: Sep 28, 2018
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That will flip the tangent, but likely means it's flipped somewhere else.
     
  24. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    Sorry if this has been addressed before...I couldnt find it.

    I am having issues with tessellation and I am unsure how to approach it. This isnt just a megasplat issue, I have experienced this in CTS as well. I much prefer megasplat so thats why I am here.

    It appears as though where the geometry meets during tessellation is creating "artifacts". It is more than likely where the polygons do not meet at the edge, creating a "seethrough" gap, revealing the skybox below the terrain. I was wondering if you have any tips on how to minimize this or remove it entirely.

    It is hard to screenshot the issue. The artifacts are constantly jumping around, but it is very noticeable while running playmode.

    The only solution I was able to think of was duplicating and lowering the terrain, setting pixel error very high, and having a completely black shader. That way atleast the artifacts werent white and less noticeable. This "solution" seems expensive just to remove a few artifacts though and makes me consider not using tessellation entirely.

     
    Last edited: Sep 29, 2018
  25. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    Hi Jason,
    I think my question didn't go through when Unity stopped informing you;), so here it is again.

    I am having a strange issue. Megasplat works fine on my scenes, but I created a new one and added Megasplat and I'm not getting a full megasplat system.

    After adding Megasplat, I can only change the textures with the Terrain Converter.
    When I hit save, then load the demo texture array to the paint config,
    I see the brush, but no textures are painted.
    Same goes for wetness and puddles.
    I've tried it with single layer and 2 layer and the shader type is set to terrain.

    I don't know what I am missing. I have removed and reloaded several times, but I can't get it to work on this one scene.

    Do you have any suggestions as to why this is happening?
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Is this between two terrains? Or your saying it's happening on random spots being tessellated in a terrain? Because if it's the latter, it sounds like some kind of graphics card/driver issue..

    Is the same array the one assigned to your material? It sounds like your terrain's material is pointed at a different one, one which doesn't have the same textures or wetness/puddles turned on..
     
  27. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    That's what I thought, so I went through it part by part and made sure, I think.
    I'll try it again and see. I have duplicates of each so I'll create a new one under a different name so I can be sure.

    Thanks for the advice, I'll give it a try.:)
     
  28. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    Its just a single terrain, the double terrain was my "solution" to try to solve it.

    Its not random spots. I can see a grid pattern in the artifacts. The simplest way to describe it is if you were to line up two meshes but not have them be a part of the same mesh, light is able to "leak" through the edges.

    This tessellation issue has persisted through different unity versions. I have a GTX 1070,I will try to reinstall drivers and see if anything changes.


    Edit: It did not solve it.

    After searching online I found this: https://stackoverflow.com/questions/49962073/artifacts-on-edges-from-tesselation-control-points

    The issue he is having is the exact same thing I am experiencing. I also tried a build on a different computer with a different video card and it produced the same results.

    Here is an image in the editor zoomed in with shaded wireframe mode, you can see the seam between the faces.



    It seems to be a common thing even in AAA games


    Kind of a shame...I really like tessellation but I guess I will just avoid it.
     
    Last edited: Sep 30, 2018
  29. OldLadyNevermore

    OldLadyNevermore

    Joined:
    Jul 17, 2013
    Posts:
    5
    I have a simple mesh I created in Blender 3d that does not appear to convert to a _xsplat mesh. When I attempt to do so using the Mesh Converter it pauses for a bit but does not create the *_splat file, at least not in the same directory as the original.

    I know the uvs are set up on the mesh because when I click and drag a texture onto it and the texture works.

    I have verified that the import for the mesh is set to Read/Write.

    Is there something else I need to do to create the _splat?

    EDIT: If it matters the export from Blender was done as an fbx file.
     
    Last edited: Sep 30, 2018
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Do you get any errors in the console log?
     
  31. OldLadyNevermore

    OldLadyNevermore

    Joined:
    Jul 17, 2013
    Posts:
    5
    I get three errors which are related to VR, and are therefore related to the game engine itself and not to Megasplat. I also get this info message, which I doubt is related:

    The editor layout could not be fully loaded, this can happen when the layout contains EditorWindows not available in this project
    UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)

    Other than that, the console layout is clean. The 'spinning' wait icon appears and disappears, and it really appears to process something, but the new _splat does not occur.
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Strange, can you pm me the fbx?
     
  33. OldLadyNevermore

    OldLadyNevermore

    Joined:
    Jul 17, 2013
    Posts:
    5
    jbooth worked with me on this, I believe the issue was caused by my having a dot in my file name, that caused the splat to be created in a parent folder. Thanks for your help!
     
    dsilverthorn likes this.
  34. xsasoftware

    xsasoftware

    Joined:
    Sep 6, 2017
    Posts:
    24
    Hello. I have these problems. I'm missing something?
     

    Attached Files:

  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, is this OneBatch and not MegaSplat? Can you give me some more information about what your doing?
     
  36. xsasoftware

    xsasoftware

    Joined:
    Sep 6, 2017
    Posts:
    24
    Is One Batch. I have a scene with only 1 prefab ( scene ) that contains ~40 textures, I wanted to convert them in 1 or fewer to reduce the calls.
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Can you send me the scene? I'm betting there's some bad data in there, like a material with no shader or something, and it's not handling the edge case well.
     
  38. xsasoftware

    xsasoftware

    Joined:
    Sep 6, 2017
    Posts:
    24
    Sure, can you provide an email?
     
  39. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Jason,

    can I have this already fixed?
    We have reported there is something wrong with texture graph in Unity 2018 in May. I couldn't nail the issue back then, but I sent you a project to reproduce the bug. You assured me that although you don't have time because of personal problem, you "will have a few days at home in early July to catch up on everything". So I have waited. Three months later not only the problem was still there, but you forgot about everything. So this time I took some extra time to nail down the problem and provided you the exact steps to reproduce the issue. Three weeks later there is still the bug, but no respond.

    I have been mostly contend with the support so far, but this whole situation is preposterous.
     
  40. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Hi @jbooth -- I'm having an issue with MegaSplat not working correctly in builds, or rather it's like the MegaSplatTerrainManager is not running on the terrain or something weird.

    My project is loading scenes additively, one of these scenes has the terrain with MegaSplat. I'm using Unity terrain and meshes for terrain, so have two different MegaSplat shaders setup.

    The mesh terrains are just fine, and I can see all the textures so I know the texture array is loaded correctly. However the terrain is not showing the correct paint job, just the base texture at index 0. So it's like the MegaSplatTerrainManager is not working or applied correctly in the build on the terrain.

    Any idea of what could be causing this issue?

    // WildStyle
     
  41. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    So I figured it out -- in the `MegaSplatTerrainManager` class I removed the `#if UNITY_EDITOR` in the `OnEnable` method.

    My project is unloading and disabling objects, so the `OnEnable` event did not correctly Sync the terrain again, next time the object was enabled.

    // WildStyle
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Mainly because I already fixed it, quite a while ago. Here's a video of me using it on 2018.2.4f1

     
  43. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Then I'm afraid we are dealing with magic here. Here's a video of me using it on 2018.2.10f1. Color space conversion ends at ~0:50.
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Found it, uploading a patch now. If you search NodeMegaSplatOutput.cs for buffer = new you'll find four lines where the buffers get initialized. You'll find this twice in the code, and you can replace them with:

    Code (CSharp):
    1. buffer = new RenderTexture(width, height, 0, RenderTextureFormat.ARGB32, PlayerSettings.colorSpace == ColorSpace.Linear ? RenderTextureReadWrite.Linear : RenderTextureReadWrite.sRGB);
    2.             result = new Texture2D(width, height, TextureFormat.RGB24, false, PlayerSettings.colorSpace == ColorSpace.Linear);
    3.             fxBuffer = new RenderTexture(width, height, 0, RenderTextureFormat.ARGB32, PlayerSettings.colorSpace == ColorSpace.Linear ? RenderTextureReadWrite.Linear : RenderTextureReadWrite.sRGB);
    4.             fxResult = new Texture2D(width, height, TextureFormat.RGB24, false, PlayerSettings.colorSpace == ColorSpace.Linear);
    By default it should use the color space of the renderer, but for some reason it's not, so forcing it seems to prevent the issue.
     
  45. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    How many drawcalls does per mesh take? As in passes. Minimum and maximum please.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    1
     
    WildStyle69 and UnityRocksAlt like this.
  47. OldLadyNevermore

    OldLadyNevermore

    Joined:
    Jul 17, 2013
    Posts:
    5
    Okay, so I have been trying figure this out, but I have noticed my MegaSplat Example scenes do not allow me to cluster paint, probably because I broke something. Is there a way to reset everything back to original so I can have a clean copy again?

    Would deleting the Megasplat folder do that? Or are there other settings I would be missing?
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Delete the folder and reinstall it..
     
  49. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Hi @jbooth, I'm using Unity 2018.2.5f1 and just upgraded to MegaSplat 1.73. Multiple recent release notes mention Texture Graph fixes, but it still isn't working for me.

    My texture graph is rendered in a lighter shade that in your quickstart video, and nothing I click responds. A single error is shown in Unity's console: "UnityException: Cache system error: Current Canvas is not saved as the temporary cache!"

    Please see screenshot for an example, and let me know if there is anything else I can provide that might be useful to help you track this down.

    megasplat_frozen.jpg
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Can you try deleting the LastSession.asset file and see if that works? Unity doesn't seem to be able to update this asset through the versions correctly..