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
    Can you kill this link- it's effectively allowing people to pirate the terrain blending module- in the future, send this kind of thing in a PM..

    @hippocoder
     
    Last edited: Apr 24, 2018
  2. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Sorry, done.
     
    jbooth likes this.
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ok, fixed and pushing an update to the asset store. Should be up tomorrow or the next day.
     
    Noogy likes this.
  4. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi Jason, I've tried 1.81 this evening and am having the same visual issue. I've tried it on my existing project and a new one from scratch. I'm using both 1.81 of Microsplat and the Terrain Blending, am I missing something? Thanks.
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    This was the triangle pattern issue? The change I made fixed this issue for me and was using your example project as a test..
     
    Noogy likes this.
  6. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi Jason, yep you're right... I could see the package updating but it was probably something with Unity's cache. Everything seems to be working great now, I deeply appreciate you addressing this! It's going to make a huge impact on my workflow for this project.
     
    jbooth likes this.
  7. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hello when I import the MegaSplat asset I get a lot of errors (57 errors)

    errors.PNG
    Can anyone help?
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Try reimporting fresh from the asset store into a new project- it looks like files are missing somehow..
     
  9. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    Hey @jbooth got a question -

    I want to get the wind and glitter pack but I need to make sure that It is compatible with Megasplat. Is the wind and glitter pack compatible with Mega Splat? or is it microsplat compatible only?
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MicroSplat modules are only for MicroSplat..
     
  11. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    Thank you for the reply :)
     
  12. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    Urgent before I decide to buy: Can you convert MegaSplat back to mesh? How is the performance related to just Mesh. I will be happy if this gets converted back to just Mesh.

    Also, is the collider generated like a mesh collider, since I have coded it for that.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Not sure what you mean, MegaSplat works on meshes or terrains. You run the meshes through a converter which adds data to the vertices, but otherwise it's just a mesh..
     
  14. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I am guessing that Polybrush and Vertex Painter are accessing similar channels, and possibly getting in each other's way a bit ... the point being I would really like to use Polybrush to make some small amendments to my landscape (which is all meshes), and MegSplat for the texturing. So I am trying to figure out a workflow which allows this, because I hit a problem. I have my terrain mesh plates all converted to _splat, and I have filled each with a base cluster. Fine. But, if I apply Polybrush to one of the mesh plates, this is what happens:



    It goes all wet! I am assuming that Polybrush is doing something to either the UV1_W or UV3_Y channels, wetness and puddles, and this is the result. The problem remains because when I close the Polybrush window, and flood the mesh plate with 0 for each of those channels, the base rock returns, but within seconds this wet look is back again. I had to replace the _splat mesh, as I couldn't figure what was causing this.

    So, really, I'm wondering what you think about the best approach. I'm wondering if I do Polybrush stuff on the original imported mesh plates, and only then convert to _splat, as Vertex Painter is never used on the original mesh.
     
  15. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I meant to add that I know Vertex Painter has a Deform tab, and I have tried those tools, but they seem quite basic, and the smooth tool actually separates individual polys. These are not the tile open edges either. So not really suitable, to put it mildly.
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I imagine Polybrush is treating UV's as Vector2's (They became Vector4's in Unity 5.4), and thus erasing data that MegaSplat uses. You could work on the original mesh, but then you'd lose the paint job on it, which is not ideal for late stage tweaks.
     
    JBT27 likes this.
  17. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    Thank you. Well, I'll try the mesh editing prior to converting to _splat. The scene is multiple landscape mesh tiles with a lot of industrial buildings sitting on and in the landscape. Some final tweaking is invariably required, but if we do that before the paint job, I guess that could work. At least I now know what not to do!
     
  18. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    Great thanks, I knew everything is a mesh, but when I used to run ray casting on a terrain (terrain collider) it did not use to detect. So this works on Consoles as well, is this correct? If so, i will buy it instantly. I am new to shaders, is this a shader run on a mesh?

    I really hope you understand where I am coming from.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Console support is tricky, because without a console license, I have no way to test. I know that tessellation has issues on the PS4, but I have no idea why because I have no way to debug it - but the non-tessellated pathways use a surface shader, which should work on anything.

    MegaSplat is not a shader- rather it's a shader generation system, and it can create shaders for Unity terrains or Meshes, and comes with a rather extensive toolset for painting or procedurally texturing either.
     
  20. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Hi Jason,

    I have a small problem with a run-time created terrain.
    I create a terrain object in code and apply a MegaSplat material to it. Everything works fine except the tesselation itself looks to be at the wrong resolution. Even after messing with every property on the Terrain and on the MegaSplat material in the editor, the resolution does not correct itself.

    That is until I edit the terrain height with Unity's Raise/Lower Terrain editor tool. The moment I click the mouse button the tesselation resolution corrects itself.

    I tried all kinds of functions on the Terrain and TerrainData including SetHeights, SetHeightsDelayLOD, ApplyDelayedHeightmapModification, Flush, etc.
    I also set the texture scale on the shader using the "_TexScales" property and put everything in a coroutine with a delay between creation and setting the height data with no success.

    The left screenshot is after terrain creation (bad) and the right after clicking the height tool button (correct). I set the displacement to maximum to illustrate the problem.

    What do I need to call to get the shader to use the proper texture resolution?

    Thank you!
     

    Attached Files:

  21. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    In the Texture Graph, applying a cluster to a slope range, seems quite convoluted. I guess the normal angle node is the nearest we have to that, but I have to multiply two together to get something like what I want, and even then it's a bit hit and miss. Say I want to have all slopes that have an angle between 0 and 25 degrees, to have a certain cluster - is it not possible to have such a node, like, for instance World Creator's slope distribution, amongst others?

    In the normal angle node, I have XYZ values. If I change one, the others adjust too. Typing in values is difficult: I entered 0.6 but got 0.3something - entering 1 gave me 0.8something. The drag slider seems to work better, but again, overall this does seem a tad confounding to get a cluster applied to a slope range.

    Seems like complaining, but I'm not - this is one of the most powerful components of MegaSplat, and I can get results far better than anything else I have tried, way better in fact.

    Also, will you be updating MegaSplat to support meshes with greater than the old vertex limit? I have to chop up my mesh terrains at the moment to use MegaSplat, which makes some stuff, like terrain-wide bitmap masks, difficult to deal with.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Can you break out a repro? I can’t imagine what might cause this.
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    What version of Unity are you running? The editor stuff is stock Unity, so the values should enter fine, so I’ll take a look in your version to make sure it’s not some transient Unity bug. Yes, at some point I will look into adding 32bit index support to the converter. Likely not hard to do..
     
  24. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I'm running 2017.3.1f1 - it's quite fiddly, far more than other areas of the editor, so maybe it is some Unity thing. I installed 2018.1.0f2 this afternoon, but I'm not switching to that during a project.

    I rewatched your MegaSplat Dev Log 17, and I get now that a value of 1 on Y with some additional modification, can give some similar effects to what I was saying; just a different way of doing it I guess.

    Yes please on the 32bit index support - I have had to break this mesh into eleven plates so that I can use MegaSplat. It's handling it fine, but a single mesh would be much easier. Thanks.
     
  25. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    I made a sample script and as I was exploring I noticed it may have something to do with changing/setting the terrains height map resolution.

    To repro with the MegaSplat demo scene, load the demo scene UnityTerrainTesselation. Select the terrain and set Height Map Resolution to something different. As expected the terrain flattens out. As you zoom in, notice that it's no longer tesselated properly. Use the Wireframe mode to make it more obvious. Then click on the terrain using the Raise/Lower Terrain tool and the tesselation pops into its proper representation.
    Same thing basically happens when creating a new Terrain in code. I can post my sample code if you prefer that.

    Unity version is 2017.3.1f1
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Most likely Unity is not initializing something correctly- not sure what it could be though, the shader itself really doesn't know anything about the fact it's on a terrain - it just gets fed triangles like anything else.
     
  27. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    I don't know how the tesslation works in the shader, but maybe it somehow gets confused about the actual scale when calculating the to-be-tesselated distance range. Just guessing here.

    I can probably fix this issue now by just creating a plain terrain prefab with the proper height map resolution applied and then just instantiate that and make the splat and height data changes I need on that in code. Will try that after work tonight.

    Btw. the setup with the callbacks and properties in megasplat_custom.cginc are awesome. I was able to remove all my hackery from the shaders and contain them in there. :)
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Glad someone is using that. It’s hard to do everything everyone might want, so having some way to inject a little code is really nice..
     
  29. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    So I solved the issue, but you might want to check into it when you have time.
    The prefab solution didn't work so I experimented more with the terrain height settings.

    On a perfectly flat terrain area where the height values are exactly identical the tesselation freaks out somehow.

    After I created a seemingly completely flat terrain with a random height variation of +/-0.0001f in the height map the tesselation works fine.

    This problem just never appears on a naturally shaped terrain since it's never perfectly flat. This can be reproduced easily, just create a new Terrain object using the Unity GameObject menu and apply a tesselated MegaSplat material and the problem occurs.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I suspect what is happening is that Unity's CLOD system see's the terrain and thinks "Hey, it's all flat, I don't need to subdivide it". Tessellation is limited in how many times it divides a triangle, so therefor with less triangles, less tessellation. Since Unity's terrain system was designed for like PS1 level of graphics, I doubt they ever considered tessellation..
     
  31. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    That’s it, that makes a lot of sense and would explain all the strange behavior when I experimented. I’m glad we got to the bottom of it.
     
  32. S1LV3R

    S1LV3R

    Joined:
    Mar 9, 2014
    Posts:
    2
    Just want to know is there any plan to support the new High Definition Render Pipeline once it is out of "beta"?
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No plans yet- it's not going to be out of beta until 2018.3 at the earliest, and it's hard to say how stable/documented the lighting code will be even after that..
     
  34. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    With tessellation turned on, MegaSplat's ramp lighting doesn't work. Is that a bug?
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes- is this on a mesh or terrain?
     
  36. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    On terrain.
     
  37. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179
    Hi, I am using mega splat with my procedurally generated terrain. I am having a huge issue at the moment

    If i understand how mega splat works it should be like a triplannar shader but with way more maps. Here are my settings..
    upload_2018-5-4_16-27-52.png

    upload_2018-5-4_16-28-17.png
    upload_2018-5-4_16-28-26.png

    also I didnt see a value for cut off like this shader here
    upload_2018-5-4_16-29-11.png

    here is a video of pretty much all of the above
    https://www.dropbox.com/s/hrs7hfqt8jhzkep/Unity 2017.3.1f1 Personal (64bit) - TerrainSurfer.unity - TerrainGen - PC, Mac & Linux Standalone_ _DX11_ 5_4_2018 4_31_49 PM.mp4?dl=0 Mega splat kicks in at 0:32 ish

    I have to admit I really do like this idea and the shader qualities form the tutorials are absolutely brilliant.
     

    Attached Files:

    Last edited: May 5, 2018
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    A few things:

    1. Your mesh has not been preprocessed or generated with the required data on it- see the documentation for information on this if you are generating it at runtime.
    2. Your shader is set to detail mode. Note that when people say triplanar, they often talk about 2 different things- triplanar UVs, and triplanar projection of textures. If you want triplanar projection of textures (which I assume you do from the screen shots) then your layer mode should be set to single or two layer mode with the layers set to Project 3 way instead of painted.
     
  39. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179
    awesome thank you
     
  40. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Ok, ran into a few more issues that we can't seem to resolve/workaround. All while using MegaSplat on terrain.

    1) After painting the terrain with MegaSplat's terrain painter tool, if we close the scene the changes are not saved.
    2) Adding/removing/renaming texture clusters in the texture array config does not update in the terrain painter tool.
    3) Deleting a texture from the project without removing it from a cluster causes the texture array config window to throw an error where the cluster texture used to be, subsequently preventing all UI after that cluster to not be rendered. So can't delete the broken cluster.
     
  41. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179

    Quick question I am generating my mesh at runtime, I assigned 3 vertices colors for each face red blue green I added the Vertex Instance Stream. I also looked at your procedural example.. Here is the problem my mesh algorithm is based off of perlin noise so im generating the mesh completely procedurally not with premade meshes. How can I get mega splat shader to show the texture information. The reason I was using a triplannar shader was it calculated the slope and applied the three textures automatically. I can send you my project so you can see what I mean its pretty much an infinite terrain runner like minecraft. It would be awesome if the textures would blend in based off of normal calculations.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, there are two ways to prep the mesh:

    1. Make sure each face has exactly one red, one green, and one red vertex. You can't have a triangle with two reds and a green, for instance.
    2. There an option to do this as part of the shader (Process Mesh), but it uses a geometry shader to do it, so it's significantly slower than doing it as part of a preprocess or your mesh generation. You can prototype with this, and optimize it by doing the colors in the generation later..

    For texturing it, you don't need to use the vertex instance stream at all- that is just a wrapper for the vertex painter. If you want to control the texturing explicitly, you can write the texture choices into the vertex data directly (see docs for format). But it sounds like you want to use my procedural approach to apply the textures based on slope. To do this:

    1. Change the layer mode of your shader to two layer (you can also use a single layer, but two layer looks nicer)
    2. Set 'Bottom Layer Texturing' and 'Top Layer Texturing' to "Procedural 3 way". This will expose parameters in the material that let you select 3 textures to blend for each projection for each layer, the angle range which defines top/side/front, and a noise function to vary between the two layers. This gives you a 18 texture blend, which is much more variety than a traditional triplanar projection. For instance, you might have grass on the top created by 3 textures- the system will choose which one is where based on a noise function - then using the second layer, you might have dirty which shows up in areas of the grass (again made by combining 3 dirt textures) with which areas are dirt and which are grass decided by another noise function. The whole thing is done in the vertex shader, so it's very fast..

    Note that you can have one layer which is painted and another procedural 3 way, so it's possible to combine approaches, using one layer for procedural texturing, and another layer to paint various details onto the mesh.
     
  43. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179
    upload_2018-5-4_23-6-39.png
    upload_2018-5-4_23-9-36.png

    I also looked at your procedural terrain looks like all of the vertices are painted?

    upload_2018-5-4_23-11-55.png

    Also thank you for your responses truly awesome.
     
  44. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179
    Okay so i think i figured it out.. Here is my terrain now with the vertices completely colored rgb
    upload_2018-5-4_23-24-20.png

    upload_2018-5-4_23-25-10.png

    but im guessing that i have to make the colors flow a curtain way.

    upload_2018-5-4_23-39-1.png

    Like this i believe
     
    Last edited: May 5, 2018
  45. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179
    BAM okay got it
    upload_2018-5-5_0-3-30.png


    So after everything I think I know how this works..
    1 you need to color all of the vertices at the indices r g b
    2 then you have to have a trainer material ( basically you have to generate something that will look like your terrain later so sense my terrain has a very flat floor I would need to create a material for this and then I could apply it completely to my generated mesh
    3 this was very very hard and confusing at time but over all I am so damn glad its done looks really nice

    Awesome package just awesome procedural generating I would suggest who ever takes this route knows exactly how the mesh was processed or your going to hate life haha.

    Also thank you again for the help.
    -Levon
     
  46. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179
    Dang right when I thought that was it

    upload_2018-5-5_1-7-17.png

    Pretty cool effect but I wanted to create my own biomes I know this must be due to something I did but not sure.. Also is there a way to blend that seem together as I will need to do that later. Hopefully this is it at the whole thread with procedural questions.
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    This is the intersection of two meshes, but with different materials? You could use a layer in painted mode to make sure the textures align by making the texture choice along the edge the same..
     
    LevonRavel likes this.
  48. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Let me know if you'd like a video showing these issues.
     
  49. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Hello again,
    two questions:

    1. are you aware of any blending mesh-terrain shaders compatible with native terrain and megasplat? Something like this:
    Unfortunately, I can't use megasplat blending because a) I can't afford triplanar mapping b) I don't think its possible to paint on a mesh and terrain at the same time c) when I try to normal blend using brush, nothing happens aside from tons of errors in console (but maybe I'm using it wrong, the documentation is obsolete; Blend w/ Mesh is left empty, Blend w/ Terrain has the terrain I want to blend with selected)

    2. Please explain to this uneducated pleb how do layers in megasplat work as after over half a year its still magic to me. I expected something like gimp/ps layers: a front one overlaps everything painted on the back one. But here only the most recent painted one is visible, plus bottom layers is creating a seams on multiple terrains (I don't know is it a feature or a bug?),plus if the blend target slider is set to 0 it acts like an eraser in the middle of the brush, but paints on the edge, plus some other mystical behaviors. When should I use bottom and when top layer? Is it any reason to touch bottom layer at all?
     
    Last edited: May 5, 2018
  50. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    179
    Actually it is the same material but I think each region is begin treated individually..
    upload_2018-5-5_11-6-48.png
    upload_2018-5-5_11-11-10.png