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
    Sounds like you have a mesh in the scene with the VertexInstanceStream component on it that's set to be static or not read-write. You can search for VertexInstanceStream in the hierarchy and either remove those components or fix the mesh settings..
     
  2. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    377
    Hi @jbooth ,

    Does MicroSplat support mesh? I know MicroSplat save the blending data in vertex colors. But how to use MicroSplat shaders on an existing mesh?

    It seems that the vertex colors and other data needed by MicroSplat shaders is saved in those files. micro_files.jpg But when I added a MicroSplatTerrain component to my mesh object, a terrain was forcedly added to the mesh. That's unexpected.
     
    Last edited: Nov 18, 2017
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MicroSplat doesn't currently have mesh based workflows and is only for Unity Terrains. The blending technique it uses would not work with data on vertices, and requires textures for the control data. The shader itself can render on a mesh, but there is no tooling for this kind of workflow right now. The data for the 'paint job' is actually stored in the standard Unity TerrainData object, which generates textures from this data for the shader to use.

    MegaSplat supports mesh based workflows and stores the data in the vertices.
     
    zwcloud likes this.
  4. Freshmeat911

    Freshmeat911

    Joined:
    Nov 3, 2016
    Posts:
    79
    Any chance megasplat is on the sale? I can't decide on the modules for micro or just mega
     
    Rowlan likes this.
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No one knows who will be in the sales yet except Unity. That said, if you are working primarily on Unity Terrains and don't need hundreds of texture, I would recommend MicroSplat.
     
    Rowlan likes this.
  6. OJDee

    OJDee

    Joined:
    Feb 11, 2014
    Posts:
    64
    Thanks for the asset, it has made a real difference to moving my game forward.

    I have a query about the height mode for clusters.

    This i my predominant way of applying texture to my lowpoly mesh terrain, using a fairly large array of almost solid colours. Since the mesh converter (and unity) have a limit to the vertex count of individual meshes, I have had to split terrain into multiple chunks before filling with the height cluster.

    The issue is that at the joints of the chunks, the textures do not align. Is this because the height calculation is done on a per mesh basis across each mesh's total height? Is there a way to use a more global height range so that all the meshes get the same texture application?

    Thanks

    megasplat-alignment.png
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hmm, I believe if you apply them based on heights in the texture graph instead of using clusters to filter the height it would work better. I haven't looked at the cluster height code in ages, but I suspect it's using the local terrain because it doesn't have access to all terrains at that point. I'll take a look over the weekend and see if that is true and if anything could be done about that. As far as I know, your the only person who's used cluster height based filtering (almost everyone uses noise).
     
  8. OJDee

    OJDee

    Joined:
    Feb 11, 2014
    Posts:
    64
    Trust me to be different!

    If by applying based on height in texture graph, you mean using a specific heightmap per texture in the array, that seems quite a lot of work and brittle. Is this the technique you mean?

    Even if you are not able to work this into a future build (per mesh vs across all meshes) would you be able to point me in the direction of where this logic lies so I could try hard coding a range instead of it being taken from mesh?

    As a last resort I can manually paint along the boundaries but would be nice to have a one button solution!

    Thanks
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, I mean applying the texturing to the whole terrain based on height in the texture graph. Like "place this cluster from 0-10, this one from 5 - 20 with some noise, this one from 18-30", etc. Maybe I have your case wrong, but are you making a single cluster with all your textures setup to apply to different heights and pressing fill on the terrain?

    All of the data for applying clusters is in the TextureCluster.cs file. Various tools call functions in there passing in a noise value, height, and angle value and getting a texture index in the array back. So what you'd have to do is verify that any tools you use are passing in that height value in world space, not local space. This might be pretty easy to do- I bet right now it's just passing in vertex.position.y or something, when it could convert that to world space before passing it in. I'll look at it this weekend and see if it's something I can do- I think specifying heights as absolute values likely makes more sense for most use cases than local, certainly on terrains it would..
     
  10. OJDee

    OJDee

    Joined:
    Feb 11, 2014
    Posts:
    64
    Yes this is what I am doing.

    To be honest I hadn't looked into texture graph feature but will do that now. Appreciate the responses and any other updates you might make for this use case.

    Thanks
     
  11. tomraegan

    tomraegan

    Joined:
    Mar 28, 2016
    Posts:
    137
    Hi Jason.

    I'm just trying to work out if a texture array will always be DXT5 (this is how it is listed in Resource Manager, for example). I'm trying to coerce my array into a DXT1 to make it smaller, but nothing I do seems to work. The asset itself is working beautifully, but I'd just like to know if it's possible.

    Thanks.
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Both arrays use the alpha channel, and DXT1 is only RGB
     
  13. tomraegan

    tomraegan

    Joined:
    Mar 28, 2016
    Posts:
    137
  14. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    hey Jason,

    I am wondering if I could use MegaSplat for a non usual, texture blending problem.

    I have a hexagonal grid made of individual hexagon/mesh that represent a terrain (plains, hills, desert..) like that:


    I would like to blend between texture of adjacent cells at run time during the creation of the map. In a nutshell, I want to paint a different texture for each 6 inner sides of each hex/mesh (arrows of the diagram are inverted). Also FYI, I combine all those meshes into chunk after that.

    So I am wondering if I can achieve that with megasplat procedural texturing or the ASE node or the paint at runtime feature.

    thanks in advance.
     
    Last edited: Nov 20, 2017
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, you can edit the vertices of the mesh at runtime to change the splat weights. You can find info on the format in the forums (which you can browse before buying to make sure it fits your needs), though my Vertex Painting package, which is available for free on my github, includes shaders which might be enough for your needs (2-5 textures max per mesh).
     
    blitzvb likes this.
  16. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    28
    I just purchased your terrain holes extension and am really excited about the tessellation and global texturing extensions. It's an amazing terrain enhancement, thank you so much Jason for setting this all up and making it so easy to use and modify!

    I'm having a small problem with shadows from transparent textures. I don't know if there's anything you can do about it, but it would be amazing if the transparent textures didn't cast or receive shadows. I do have a mockup test, if that would help--basically i have a terrain plane with a large portion of transparency and that transparent terrain is causing shadows on terrain below it. Also, when my models stand in front of the cave entrance, they cast a shadow on the cave entrance terrain which is transparent, not on the floor of the cave. That, in itself is not a huge problem, but it's that kind of behavior that is causing issues elsewhere in the game.

    Another problem I'm experiencing related to shadows and transparency is that, when the camera moves below that transparent terrain, shadows from the transparent terrain I just passed through pop and change drastically. Again, I'm not sure if there's anything you can do to help, but I'd really appreciate any help you can provide.

    One small final issue I'm also trying to resolve involves changing terrain alphamaps (i.e. changing grass to dirt as characters dig/walk over it) at runtime using Unity's set-alphamaps call. It works great for smaller areas, say 100x100, but I'm getting a major slowdown when doing large areas (like 200x200). It's basically instantaneous at 100x100 so not sure why it drops to like 1 fps when doing 200x200. I know this is not your specialty, but was hoping you might have some insights! :)
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you have a repro scene I can take a look and see if I can get it to clip in the shadow pass, which would hopefully solve any shadow casting issues. When dealing with Unity's lighting system, repro scenes make things a lot easier because there's a ton of different lighting pathways, all of which have slightly different behaviors.

    You might try bliting directly to the texture instead of going through Unity's interface. You can grab the maps from the terrains material with GetTexture("_Control0") and operate on them directly. When you go through Unity's interface, it takes the values you provide, converts them into textures, uploads them to the GPU, and then renders a base map for use in the distance (which MicroSplat doesn't even use).

    Likely the fastest way is to grab the control maps for your terrain (1 for every 4 textures), Blit them into a RenderTexture, then set that render texture on the terrain materials. Then you can just render changes directly into the map on the GPU and skip all of the stuff above.
     
  18. tomraegan

    tomraegan

    Joined:
    Mar 28, 2016
    Posts:
    137
    Hi Jason.

    Regarding the Diffuse Texture Size field in the texture array settings:

    Is it possible to have sizes smaller than K256? I'd like to create an array of flat colours for low poly models and keep the array size as small as possible. At K256, this translates (using a single 256x256 flat texture), to an array size of ~85Kb. Each additional texture adds another 85. Reducing the original textures to 32x32 (occupying 0.7Kbs) does not affect the array size.

    Can the list of sizes include the standard Unity texture increments below 256, down to 32?

    Thanks.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    sure, you can add that option to the enum in TextureArrayConfig.cs. I can do the same for the next patch..
     
  20. OJDee

    OJDee

    Joined:
    Feb 11, 2014
    Posts:
    64
    This was from a year ago so maybe not valid anymore? Have accessed the vertices in question using raycast, triangleIndex etc.. but the colors accessed via mesh.colors are always solid red, green or blue. Alpha always 1. I am using a single layer shader which is correctly displaying textures from my array. Using a cluster fill.

    Is there a better way to access the vertex color now or should I be seeing varying color alphas via this method?

    UPDATE: Seems I need to access the colors from the VertexInstanceStream, didn't realise they were held there vs in the mesh itself.

    Thanks
     

    Attached Files:

    Last edited: Nov 22, 2017
  21. acaton

    acaton

    Joined:
    May 27, 2013
    Posts:
    28
    Thank you so much Jason for getting back to me so quickly. I'll get you my test app soon, but it'll probably be a couple of days as things are getting busy around my house for Thanksgiving.
    I'll try your alphamap solution--sounds like a win to me!
    Out of curiosity, do you know if there's something similar that can be done with heightmaps to avoid going through Unity's interface? I also modify them a lot and they're even slower than alphamaps.
    Thanks again for all your help, and happy Thanksgiving!!! - tony
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, they are held in the instance stream and applied to the mesh via the mesh.additionalVertexStream property. To be robust, what you should likely do instead is query the mesh.additionalVertexStream property and get them from there if they exist and the array is there/correct length. If not, read them from the mesh. This will allow you to still bake down a mesh (baking the vertex instance stream into a new asset file) and still have everything work.

    Though note there is now a component you can add to objects to get this data out of the streams for you, so I'm not sure writing this yourself is necessary anymore, but maybe your doing something else?
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, the height map is not sampled from a texture, so you can't shortcut it like that.. Let me know if it works- I'd be curious to know..
     
  24. tomraegan

    tomraegan

    Joined:
    Mar 28, 2016
    Posts:
    137
    Yep. This was as easy as pie. Thanks kindly.
     
  25. ftejada

    ftejada

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

    Is shadows feature of Vegetation Studio, also added to MegaSplat ???

    I have also seen the last video of


    This "Wind" feature will be included in MegaSplat or is it already included in the last update?

    regards
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Neither is currently planned, though the vegetation studio work is a possibility.
     
    kfinla likes this.
  27. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth Megasplat doesn't currently allow us to create virtual textures for variants does it? For example, I have a solid green moss texture but I'd like to use a yellow and red version as well. I know I could just open it in photoshop, change the hue etc but if we could save on file space and use Virtual textures that just tells the original texture to change the hue over a painted or procedural area I think may in theory further increase how many textures could be used but also save more space especially for mobile.
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No. While tinting is pretty easy, using the same texture twice with different tints would require additional data to be stored in the control texture/vertices, or some kind of giant indirection table, which could slow down performance.
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So,
    This week I spent about 10 hours getting some of the other baked lighting modes working again in 2017. I attempted to backport this to 5.4, but Unity has built in assumptions around variable names in their macros that's making it difficult. (It could be done with a god awful collection of Macros to counter act these, but it would make everything even harder to reason about).
    Instead of doing that, I'm dropping support for Unity 5.4 and 5.5. I believe there's a way to offer multiple packages in the asset store for this, so I'll look into that in case anyone still needs 5.4/5.5 versions. I will not be maintaining those older versions though.

    If this is an issue for anyone, let me know as I'd like to make this switch soon..
     
    ChinChiaYeh likes this.
  30. jdraper3

    jdraper3

    Joined:
    May 28, 2015
    Posts:
    117
    That's disappointing :( I own megasplat but it seems like microsplat is the way to go for the bleeding edge features.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The problem is that MegaSplat is such a larger package it takes several times longer to add features and requires more testing, and on top of that it takes a lot more support because it has it's own lighting pipeline vs. working within a surface shader. There are essentially 4 different pathways in MegaSplat (Mesh vs. Terrain, Tessellated vs. Non-Tessellated), along with all the extra tooling. So it's much, much easier for me to launch new ideas in MicroSplat, creating new modules, etc, and I can take advantage of the limited domain of only working on Unity Terrains (known topology and UV layout). which actually opens up a lot of tricks that aren't as simple on meshes.

    I designed MicroSplat around increasing modularity and reducing the amount of time I need to spend on supporting the project through Unity changes, complexity, etc. This was in reaction to working on MegaSplat for almost a year and getting a better understanding of what I think the average Unity user needs. And it worked, it's incredibly easy to support and extend, has very little support overhead and user issues; so I get to spend that time coding new modules, which is what I much prefer to do anyway. Meanwhile, MegaSplat, which I worked on the same amount of time over the last week, gets an upgrade to 5.6+ and fixes to the lighting pipeline. Not nearly as exciting, but had to be done..
     
    jdraper3 likes this.
  32. jdraper3

    jdraper3

    Joined:
    May 28, 2015
    Posts:
    117
    Thanks for the insight - I hadn't really considered that, and it definitely makes sense. I've been wanting to try MicroSplat anyway, so based on your response I should probably look at going that route.
     
  33. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    hey @jbooth

    I am using the AseSingleLayer, I added the two texture arrays in the ASE graph slots but I am still not getting any textures.

    Find attached how it looks.
     

    Attached Files:

  34. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    Hello! I'm using MegaSplat but since I don't use meshes, I'm thinking about switching to MicroSplat.
    Does MicroSplat also outperform Unity's default Terrain by 300%? :p
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, Unity's Terrain shader is about as bare bones as you get; no height blending, no special features, not really full pbr, etc. MicroSplat can out perform it in cases with high texture counts, since Unity will draw the terrain once for every 4 textures on it, but in lower texture count cases Unity's shader is hard to beat because it doesn't really do much. You can see some comparisons verses Unity's terrain in the performance comparison video on YouTube, which was done on a 7 texture terrain (so 2 passes for Unity terrain, 1 for MicroSplat).
     
    Last edited: Nov 28, 2017
  36. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    186
    I just realized you may not check your Twitter account as obsessively as I do :), so I'll repost my question here:

    I'm using GAIA to create the terrain (stamping, not procedural). Is there a way with Megasplat to find the height, flow, steepness, etc. data to create the initial splat map? If not, is there any problem with using Relief Terrain Pack on a terrain in conjunction with Megasplat to create the initial splatmaps?
     
  37. OJDee

    OJDee

    Joined:
    Feb 11, 2014
    Posts:
    64
    @jbooth a minor UI consideration for you.

    I have begun working through the texture graph as an alternative to height based cluster. My mesh terrain is output in 64 square chunks from Blender, which when brought into texture graph via prepare selection, pushes the compile button way off the bottom of the screen.

    I have moved it above the list in the appropriate .cs file so I can access regardless of number of meshes in list, but thought I would feedback anyway.

    Cheers
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can use the texture graph for this- there's a few presets you can look at for examples.
     
  39. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    Do you have any video example of megasplat used for non-terrain application. Like walls etc
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, but a lot of users in this thread have been doing that. Maybe they can post some shots? Basically they just fill meshes with single textures, then combine all the meshes and they can draw the entire scene in one draw call.
     
  41. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    In heightblending can we adjust base height of layer as in this tool


    I'm quite interested to megasplat for general vertex painting.
     
  42. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    hey, you may have missed my question.

    thanks in advance.
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I might have that in my vertex painter shaders, which are free on GitHub but limited to 5 textures at once. MegaSplat derives the height entirely from the paint job, there's no a global height offset per texture or anything, but you can just "fill" at the value you want and get the same result, or paint directly into the blend data if you only want to effect the blend and not the texture choices..
     
    Last edited: Nov 28, 2017
  44. GodJammit

    GodJammit

    Joined:
    Feb 10, 2014
    Posts:
    32
    I'm curious if there has been any specific testing regarding Nintendo Switch platform support? I see that console support is broadly provided, but haven't found anything specifically mentioning the Switch.
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I don't have a way to test, as Unity doesn't provide the platform SDK's to developers unless they are officially signed up with Nintendo as a developer, and Nintendo doesn't give out SDK's if you don't have a game you are making for their platform and buy a developer kit.
     
  46. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    Saw your vertex painter on github looks like what I need.

    But I've just purchased megasplat, wanting to try 256 texture for the longest time. I should be able to easily adjust heightmap by adding an offset value to the heightmap manually. There should really be an editor tool to do these simple image proc operations non-destructively on textures.
     
  47. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    That makes sense and thanks for the video. By the way, I've switched to MicroSplat and it's working great but Wind and glitter seem to be unstable on my setup. Glitter keeps appearing and disappearing when...
    * your main camera uses deferred rendering path
    * and there's a renderer within the camera range whose shader has z-write on and has transparent render queue.(in my case mobile/diffuse + RenderQueue set to transparent)
    * and when the main light is culling the gameobject's layer

    It might be my setup but can it be fixed?
     
    Last edited: Nov 28, 2017
  48. GodJammit

    GodJammit

    Joined:
    Feb 10, 2014
    Posts:
    32
    Ah, I see. Thanks for the quick reply!

    I'm interested in picking up a license to do some quick tests with it. Should there be a compatibility issue, while I can't provide console logs for debug (NDA), I can maybe communicate with Unity to help pinpoint any shader configuration issues. Should the scope of whatever compatibility issues we might run into be too large, however, would you be willing to offer a refund?
     
  49. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Hi, was directed to your asset from a thread I created about texture atlasing. So im interested in the texture array capabilities of this asset. For normal Rendermehses not terrain. (Well terrain too but mainly meshes).

    I have a environment asset that exists of about 100 materials, its very unoptimized when it comes to set pass calls. For some meshes there are as much as 9 materials. Like here

    upload_2017-11-28_19-4-47.png

    Here we have only Standard shader, but with different tint options. And the glass material is transparent instead of Opaque.

    Other meshes bombine Specular and standard shader like here
    upload_2017-11-28_19-12-22.png

    Would megasplat help us here in reducing draw calls?

    Thanks
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Can you send me a repro scene so I can check it out? Large chance that if I just follow these directions it will be fine, and that it's some other interaction that's less than obvious. The sand and glitter are drawn as part of the terrain shader itself, so in deferred it's simply writing values into the zbuffer as normal (just different values).