Search Unity

[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
    MegaSplat is a splat mapping system - what it does is allow you to paint texture choices and a weight on each vertex. Between those areas, it blends the textures via a height map based resolve, such that sand will appear in the cracks of the stones before covering it. You could preprocess your tile into MegaSplat format, then adjust the vertex data at runtime to control the paint job. The format is described in the documentation, which is available online (see asset store description or the first post in this thread for the link).
     
  2. JellyfishUmbrella

    JellyfishUmbrella

    Joined:
    May 6, 2015
    Posts:
    5
    OK, thanks for the reply. That's basically what I thought, but there's a LOT in Megasplat so I wasn't sure if I was missing something. I should be able to rejigger my process to use vertex weights instead of alpha channels
     
    punk likes this.
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you only need a few textures, then you might consider just using the included shaders in my vertex painter (which is free and linked in my signature). It'll blend up to 5 textures..
     
    one_one likes this.
  4. ArkadiuszR

    ArkadiuszR

    Joined:
    Jan 21, 2016
    Posts:
    22
    I don't know why but after click "batch import" it not get all textures frorm folder what is on left.

    + now something happen and when i open project unity crashes after 5s... great <3
     

    Attached Files:

    Last edited: Jan 14, 2018
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Are you textures post-fixed with those naming conventions? I've noticed you've cleared out some of the filter names as well, which is basically telling the system to take any texture for those, which is certainly incorrect\.
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, I'm off for the next week traveling out of the country. I will have very limited internet on most days, if at all, but will try to check in when I can..
     
  7. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    Thanks for letting us know.

    Have a safe trip!!
     
  8. Alexandre-Vinet

    Alexandre-Vinet

    Joined:
    May 23, 2013
    Posts:
    6
    Hi, I'm trying to run tessellation on Android 3.1 AEP. As soon as I turn tessellation ON, the terrain turns black both in the editor and in the build. My editor is launched in OpenGL ES 3.1 AEP on Windows ( but the Emulation only lists 3.0) My build settings are Android 7.0 with Player Settings Forced API at OpenGL ES 3.0 + 3.1 + 3.+AEP options checked. ( Running the January 10 2018 build of MegaSplat) Thanks!
     
    Last edited: Jan 16, 2018
  9. Exsavio

    Exsavio

    Joined:
    Jul 30, 2013
    Posts:
    4
    Hi all, I am trying to figure out if this asset will be able to apply textures based on sampling an input texture provided at runtime. For example, if given a texture that is a heightmap of temperatures; would it be possible to sample the heightmap relative to the worldspace of the vertex and determine at that point whether to apply snow, grass or sand texturing (or a blend).

    Failing that - would there be any other way for to apply 'layout' information at runtime?

    Cheers! :)
     
  10. Ken-Cummings

    Ken-Cummings

    Joined:
    Dec 6, 2015
    Posts:
    5
    Awesome, will give that a try, thanks!
     
  11. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Have you tried running Unity's tessellation example shader to see if it works on this device? Sounds like the device/API it's using doesn't support tessellation, but would be useful to test verses a surface shader example as that should work on any device which Unity supports tessellation on..
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's some edit-time procedural techniques in the texture graph which can do things like this, though there's nothing exactly like what your asking for. When you create a texture graph, it generates a shader from your graph to texture everything with, which could be saved and applied at runtime the same way the graph does. It would require extensive modification of the code though (porting it to runtime, knowing how to run the shader and map the results back to the mesh/terrain, etc).

    On meshes (not on Unity Terrains), there's also a runtime procedural technique which uses normal angle to apply textures at runtime; it's a riff off the old "Top/Side/Front" style of triplanar texturing, but this technique applies using texture clusters and noise, giving you far more textures than the traditional technique.
     
  13. Alexandre-Vinet

    Alexandre-Vinet

    Joined:
    May 23, 2013
    Posts:
    6
    I tested the "Phong Tesselation example" surface shader, it does not show up in Unity Editor Win64 <OpenGLES 3.1 AEP> ( Emulation 3.0) But in the build, on Android Samsung S6 Edge with Nougat 7.0, I see the tesselation.

    Is the black color significant? I read in your documentation it was a flag about texture array support. I am surprised that I don't get the "No shader variant for the current device" error and the purple color.

    Thank you for the support!
     
    Last edited: Jan 19, 2018
  14. Cgflux

    Cgflux

    Joined:
    Jan 28, 2016
    Posts:
    7
    Hi. I have a problem. When i enable Tesselation i have this strange dark circle on my terrain
    upload_2018-1-19_23-3-13.png
    But when i disable everything is ok.
    upload_2018-1-19_23-3-49.png

    This dark circle show when i enable Tessellate shadow pass
     

    Attached Files:

    Last edited: Jan 19, 2018
  15. Cgflux

    Cgflux

    Joined:
    Jan 28, 2016
    Posts:
    7
    This is console info when i enable tesselate shadow pass
    upload_2018-1-19_23-11-15.png
     
    Last edited: Jan 19, 2018
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The bottom 2 errors are from some other asset in your project; the line ending one should have no effect. I suspect the darkening is related to the shadowing bug which was being discussed recently; I’ve been out of the country, so haven’t had the time to look into it yet.
     
  17. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Welcome back man :) - just to remind on the issues I'm facing for my project and that are blocking the MegaSplat upgrade.

    1) The shadow issue.

    2) The vertex lines issues, where there are lines visible on the terrain vertex. You replied to another user reporting this, that turning off the per texture scale should fix this, however in my project it does not fix it, it's still visible... but not as much it would seem.
    https://forum.unity.com/threads/rel...at-mapping-system.441329/page-72#post-3338864

    3) Relating to the per texture scale issue, you mentioned before that you might add back the option to use per texture scale with a higher quality setting (without blurriness, which the new method introduces), similar to the earlier releases of MegaSplat, do you think that will happen?
     
  18. SeanPalmer

    SeanPalmer

    Joined:
    May 30, 2015
    Posts:
    5
    Hello.
    What would be the best way to deal with jagged borders between two different clusters?
    ------------------------------- JaggedEdges.PNG
    -------------------------------
    Sorry this is an obvious/beginner question.

    P.S. I am also having the shadow/lines issues with tessellation that several other posters have reported.
     
  19. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    I just bought this and the only problem I've run into so far is that it doesn't seem to be saving my textures painted on terrains. When I load another scene and go back the texture is gone. I am saving the scene and the project before loading another scene, but when I go back the texture has reverted to a single texture (I think it's one of the snow textures).
     
  20. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    Also, there's no Vertex Paint brush called "megasplat_diffuse"...the only one I get is "MegaSplat_example" but when I select that it doesn't even paint. I have to use the terrain painter to get it to actually paint anything
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Interpolation Contrast or painting in separate layers on a two layer shader will change this blending.


    Press SAVE in the terrain painter to save the paint job..

    Use the vertex painter for mesh based workflows, and the Terrain Painter for Unity Terrain based workflows.

    MegaSplat_example is the correct brush to use my example textures. An older version had a megasplat_diffuse brush..
     
  22. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    Thanks for the quick answers. I have a couple more:

    When I'm using Terrain Paint on a Unity terrain It won't let me paint on layer 1

    Also, under "texture packing" the options are different from your tutorial videos. What should I set it to?

    Lastly, I don't have a "Splat Control" texture assigned when creating a new terrain/splat texture. How do I fix this? It didn't automatically assign one
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There are only top/bottom layers in MegaSplat- and the top layer is only active in a two layer shader. I suspect you are using the default (single layer) shader.

    If you watch the video on the new texture packer, it will cover the texture packing options. Unless you are doing a non-PBR option (no normal maps, etc), then the default option is all that is needed.

    The splat control texture should be created and assigned when conversion happens in the terrain painter, if it was not assigned, you could not paint. This is all handled my the MegaSplatTerrainComponent, which might be newer than whatever tutorial you are watching (there are 25 or so dev logs for MegaSplat, in chronological order as the program evolved, so many are somewhat out of date but reshooting them all would be too time consuming).
     
  24. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    Is there a video on how to set up a terrain with a two layer shader? I searched the documentation and didn't find anything. I don't even see where you'd get the two layer shader from.
     
    Last edited: Jan 24, 2018
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    See "Layer Mode" in the docs or rollover help.
     
  26. SeanPalmer

    SeanPalmer

    Joined:
    May 30, 2015
    Posts:
    5
    Thanks for the quick reply! Painting on a seperate layer works great, but I'm trying to work inside of the texture graph. I've messed around with the two layers and the blend input for a while and am struggling to achieve the effect I want. I had everything looking good on one layer previously and I just want to smooth the transition between clusters. Is there a good way to do that in the texture graph or do I need to paint over the borders manually?
     
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can work in two layers in the graph and choose which texture goes to which layer. I suggest looking at how some of the examples are setup, as they do this.
     
  28. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    Thanks for the help...I'm starting to get the hang of it. I do have a question about tessellation, though. When I paint on the bottom layer it works great. The tessellation is amazing, but when I paint on the top layer it goes nuts. It makes a bunch of really narrow wavy spikes. It seems like the tessellation of the bottom layer is really messing with it.

    Also, is there a way to paint without tessellation on a shader that has tessellation enabled?
     
  29. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    OK one more question....any tips for optimization? I only have 1 terrain and I get around 82 fps - but if I disable it I get 900 fps so a single terrain is really eating me up. I'm using default terrain settings. I'm on an 17-7700/GTX 1060 GPU so I feel like I should be getting quite a bit better performance than I currently am.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can paint displacement dampening into the areas you don't want it to be displaced. I have never seen any issues with tessellation being any different on the top or bottom layers- the data is actually resolved to a single height value and then displaced based on that, are you sure the issue isn't just with the texture your using on that layer?

    Things like triplanar or distance resampling can be very expensive as they act as multipliers on the number of samples needed. There's a sample count in the debug window that can help you see the costs as you turn features on and off. Since your using tessellation, it's likely your biggest performance factor. When triangles get smaller than about 10 screen pixels in size, things start to get very expensive. And just turning tessellation on has a high cost, even if you don't add triangles. So keep the tessellation factor reasonable, and the distances reasonable. This is also one reason why I recommend MicroSplat for Unity Terrain work and MegaSplat for mesh work- MicroSplat is optimized for terrains in some ways I just cannot do with the MegaSplat technique, and is significantly faster because of it. For instance, when the tessellation distance is reached, it automatically swaps to an untessellated version of the shader, which is a pretty massive speedup. That said, those numbers seem low for that card, so I'm betting some settings tweaks will make a big difference.
     
    Tethys and kerrmedia like this.
  31. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    193
    Is there a way to get something like Microsplat Mesh Terrain blending with megasplat ? Or emulate it with a little work with the current features ? Haven't found an easy way for this, maybe I'm missing something obvious.
    Would also be mega useful if something similar could be done with 2 meshes as I have lots of overhangs in my terrain I have to use meshes. If there were some mesh on top of huge terrain mesh texture blender I'd buy it in an instant.
     
  32. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    193
    Ok need a bit of help here, am on 2017.03. Is it possible that the normsao array generation is broken ?
    Even when using any of the example normSAO arrays shading looks totally flat.
    Only when using the megasplat_normal_tarray does it look normal mapped.

    Interestingly the free MicroSplatConfig_normSAO_tarray also looks great. Perhaps even better than the megasplat one.

    Is there an easy way to create the normal_tarray manually until this is fixed ?
     
    Last edited: Jan 30, 2018
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The code for generating these is the same between MicroSplat and MegaSplat, so the data should look the same. I shipped a texture array preview system in MicroSplat, so you should be able to inspect the texture arrays with it and see if the data looks like it's there. Make sure you haven't set the MegaSplat shader to one of the non-normal mapped modes as well. I have also heard of cases where when installing both Mega/Micro into a project, the asset store gets messed up and installs one of the script files from one into the others package - I thought I had all of these fixed (conflict of Meta-IDs) but still a possibility.
     
  34. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    193
    Ok I deleted both Microsplat and Megasplat and just reimported megasplat and it seems to generate them correctly now.
    When I imported Microsplat afterwards it wanted to update all the normal shaders in MegaSplat/Scripts/Editor/InternalShaders.
    So I guess it's not supposed to do that ?
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, sounds like the meta id's of those shaders are the same. I will tweak them in the next patch to make sure they don't conflict.
     
    ibbybn likes this.
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The previous versions of MegaSplat had a bunch of choices in terms of texture packing, in which users had to pack their own textures into the right format. This lead to lots of user error and support requests, and people didn't understand the tradeoff's they were making. So I came up with a unified format that handles all the old cases, packs everything for the user from whatever files they had, and makes the tradeoff's for them. The only remaining packing choices in the shader were ones which basically say "Don't bother with normal maps" or "Don't bother with normals or specular maps". For most people, default packing is all that's needed.

    When you convert a terrain it's based on the terrain settings. If you wish to make it larger, you can change the files in photoshop and use nearest neightbor to prevent having interpolated indexes, which would create artifacts.

    The files have to be stored on disk and cannot be stored in the scene- Unity prototyped a feature that would make this possible, but has not released that feature yet. You cannot replace the original mesh, because Unity supports a ton of different mesh formats, such as FBX, and doesn't have exporters for them.

    Yes, as many times as you like. All it does is write data into the mesh colors and UV channels.

    Why use the color to splat stuff at all? if your coming from TC2, why not use the terrain converter to read the splats directly from TC2 and apply clusters? That would allow you to work in TC2 using actual textures instead of all these little color values, then you could convert each of those original textures to a texture cluster to add variety.
     
    Flurgle likes this.
  37. TrustBird

    TrustBird

    Joined:
    Apr 22, 2017
    Posts:
    2
    hello, thanks for the megasplat, I know it's a noob question but could anyone make a video or write a guide on how to get the most out of megaplat in MapMagic, a few days already try to embrace it and I can not get into it, the most important problem that I have textures look worse than standard, I used the custom shader in MapMagic I do not know how to accurately achieve nice looking textures in MapMagic I used megasplat
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    I’m not clear exactly what your trying to achieve.

    Mesh workflows use vertices to store the information about texturing, not a control texture. So if you want 2k by 2k control points, you would need 2k by 2k vertices. This is all well documented in the publicly available docs, and you can see examples of mesh terrains in the examples folder. Why are you even trying to do this with vertices if what you want is essentially a Unity Terrain anyway?

    Finally, you could use the terrain shader on a mesh- but there isn't tooling workflow for painting texture data onto meshes with a control texture, because that's actually a hard problem to solve for completely arbitrary meshes with arbitrary and discontinuous UVs, etc. In most use cases when working with meshes, painting on vertices makes a lot more sense.
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    For the equivalent of a 2k by 2k texture, you would need 4 million vertices. A 10k mesh, for instance, would only represent a 100x100 texture.
     
  40. Deleted User

    Deleted User

    Guest

    CAN NOT BE USED FOR FOR MESH TERRAINS...its that simple
    "For the equivalent of a 2k by 2k texture, you would need 4 million vertices." - developer

    unity single object vertex limit is 64K.

    which means you can NEVER get a splat map resolution above 128 on a single mesh.

    I think you carefully avoided mention of this FACT..

    were done,
     
    Last edited by a moderator: Feb 5, 2018
  41. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    You don't want a very big mesh anyway, - splitting terrain mesh into chunks means they can be culled by occlusion.

    It would also mean you can't set different lightmap-resolution for portions of your large mesh (maybe they are planned to always be far away from the player) - however, for chunks it's possible.

    And 128 splat for a 20x20m terrain chunk is more than enough.

    Now for the benefits - you don't need to store any of the splat maps, your terrain-mesh can have any concave shape you want, you get enormous number of textures, their quantity doesn't have to be divisible by 4.


    that was just rude and somewhat inexperienced

    What do you have to reply to this? :)
     
    Last edited: Feb 5, 2018
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Your being ridiculous - if you plan to build you entire level as several million polygon mesh then you won't ever get anything to run at framerate, because you are preventing occlusion and culling from working, etc. MegaSplat works fine over hundreds of objects at once sharing the same material and shader, and you can see large mesh terrains in the example folder (which is split into 4 meshes). Plus Unity raised the vertex limit to 16 million vertices recently anyway, but I honestly think you'd be pretty stupid to try to build a level that way. I'm sorry if the realities of game development are too hard for you to understand, but it is not my issue to educate you on the practical tradeoff's that those of us who have actually shipped products into the market actually deal with each day. Nor is it my job to take S*** from users who don't know what they are doing.
     
    Tethys likes this.
  43. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Well said. I think you just said what a lot of developers and asset makers who give support here tend to think lol.
     
    jbooth likes this.
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'm just not afraid to say it.
     
  45. coverpage

    coverpage

    Joined:
    Mar 3, 2016
    Posts:
    385
    You don't need such high splat resolution. Your textures can be of high resolution but your don't need to paint them such that they can be placed and controlled for every pixel of the texture resolution. Use blending of layers and clusters to get the complexity that you need.
     
    Tethys likes this.
  46. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth does Megasplat automatically generate the missing textures from a texture's Green channel or would I have to specify which channel to get the height, smoothness, AO and metal from. By default it's set up as G, G, G, G, A -might be good to say in the doc that it will extract what's missing from the default GGGGA setting -if correct. MS is now compatible with Voxeland so I'm diving back into MS.. it has evolved big time! thank you for all your hard work!
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It doesn't use the green channel, it uses the best available data it has. So if you give it a normal map but not a height map, it will reconstruct a height map from the normal map. If you give it a height map, it will generate a normal map from it if one isn't provided. If you only give it a diffuse map, it will use the luminosity of the diffuse map to generate a height map and then generate the normal from that. Smoothness and AO are derived from the supplied or resulting normal map if not present. If map's are supplied, it will use whatever channel you tell it to use for the information.
     
    Ascensi likes this.
  48. daniel_toastvr

    daniel_toastvr

    Joined:
    Nov 13, 2017
    Posts:
    4
    @jbooth , just wondering if there is an opition to tint the textures with the RGB vertex information?

    Cheers

    Daniel
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, the color channels are already used for filtering information..
     
  50. daniel_toastvr

    daniel_toastvr

    Joined:
    Nov 13, 2017
    Posts:
    4
    Oh is it? I thought it used only the alpha and UV3, this explains a lot :D thanks a lot