Search Unity

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

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

  1. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I've saw many terrain systems on the market but this is the first one that convinced me a little :). The others were either limited to 8-12 textures or had other bad problems, but this seems to be quite serious.

    Question: How does this play with tile-able terrains? Since one thing I really don't like at the unity terrains is the fact that you only have a big stupid terrain with one splatmap/detail/height texture without any support for any internal 'chunkification' (unlike Unreal or other games terrain systems) so I'm forced to have many terrain tiles, which, trust me, is bad since they don't play well together.

    So my question was, how does this play with tile-able terrains? Or do you have something internal to handle this or merge terrains?
     
    JazZRocK likes this.
  2. PiAnkh

    PiAnkh

    Joined:
    Apr 20, 2013
    Posts:
    126
    Is there some way to do geometry blending with MegaSplats and a unity terrain?
    If, for example, you wanted to blend in a road surface mesh or geometry on the side of a road?

    Or alternatively could you implement this in Amplify Shader by adding in the world position?
     
  3. WickedRabbitGames

    WickedRabbitGames

    Joined:
    Oct 11, 2015
    Posts:
    79
    Hello.... Thanks for this amazing code. I have one problem... the labels in the editor for somethings (like the names of the colors!) is in white on a light grey background.... not enough contrast for me to even notice them at first. Is there a way or a line of code I can change to make the labels more readable? An example of what I'm seeing is attached.
     

    Attached Files:

    Teila and Goodgulf like this.
  4. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth is it possible to add a filter option for each texture to prevent the Detail Noise Texture from appearing over those specific textures? Some textures like rocks or snow become very dirty looking and don't look realistic any more but those textures like moss and rock greatly benefit.
     
  5. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    Same here for Oculus Rift. Seems to work pretty well without taking a performance hit. I did a a test with the profiler on and no noticeable spikes due to megasplat on the examples. I'm now trying a setup with a Gaia terrain (conversion using utilities) and will report my findings soon.
     
  6. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    Hi Jason, did you already include turning off normal maps in a released package? I cleared the asset store cache and downloaded the package again but the documentation version code still says 0.95. I can't find the option shown in the latest dev video. Although I don't need to switch it off for VR performance reasons I want to check its effect since the VR guide states normal maps should be switched off.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    POM would be way too slow to be useable. Tessellation is much cheaper as the shader gets more complex..

    Note that the blend between macro and splats has a ton of options - but for the usual case, there's a bool you can set to hide all of those options and make it do what you want (splats fade to macro). Maybe that got flicked by mistake?
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, it's in the next release, which I'll submit next weekend (I'm currently in the middle of the ocean paying like $2 a min for internet - ha)
     
    Goodgulf likes this.
  9. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    Purchasing now, you have to share how you did that, it looks great.
     
  10. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    Hi,
    Bought your Asset, looks great, but getting error when I try to import:
    Failed to import package with error: Couldn't decompress package UnityEditor.WeJSProxyMgr:DoTasks()
     
  11. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    What unity version are you using? I had an error importing into an existing project so I tested importing into a fresh one and didn't have any problem. I still don't know if it was an asset or setting in Unity caused the problem in the previous project. I'm using Unity pro 5.5.0of3
     
  12. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
  13. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    Tried again, same error:
    Failed to import package with error: Couldn't decompress package UnityEditor.WebJSProxyMge:DoTasks()
     
  14. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    dont' know why that green smiley face is being put in my post?
     
  15. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    If you're using a new project to import into but it still isn't working.. maybe the download got corrupted.. you might have to delete the file from your Hare drive download location and re-download.
     
  16. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    @jbooth Mostly everything works but my single textures in the pane look faded although they do paint normal on the terrain. Am I missing something? I have been following the document and Videos you've shown.

    Also i guess Flow mode is only available for Mesh?

    upload_2017-1-21_20-37-25.png

    Update: so far I managed to get one texture to show up clear.. I had to override the texture settings for it.
    Also it seems I accidentally added the Diffuse_Depth texture to the Normal_Smooth_AO array and it created the correct picture for the texture and when I added the correct SNO texture to the array the picture that was generated from the previous diffuse texture stayed. Still not sure what I did if anything that cause the textures not to show correctly.

    It isn't a big glaring Red compile error but unity is telling me this:
    There are inconsistent line endings in the 'Assets/MegaSplat/Examples/Materials/MegaSplat_TessTerrain.shader' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
    UnityEditor.AssetDatabase:Refresh()
    SplatArrayShaderGUI:Compile(Material, String) (at Assets/MegaSplat/Scripts/Editor/SplatArrayShaderGUI_Compiler.cs:545)
    SplatArrayShaderGUI:OnGUI(MaterialEditor, MaterialProperty[]) (at Assets/MegaSplat/Scripts/Editor/SplatArrayShaderGUI.cs:736)
    UnityEditor.DockArea:OnGUI()


    I'm not sure how I'm going to be able to do it yet but I would love to use the procedural texturing with World Creator to cover the whole landscape but I don't think it's 100% compatible to do that. If anyone is interested here is a sample of hand painting in progress but it isn't exactly a tutorial.
     
    Last edited: Jan 22, 2017
    antoripa likes this.
  17. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    Hi Jason

    I've been busy setting up a terrain in @AdamGoodrich 's Gaia with 8 textures and converting it to MegaSplat (on Windows 10, Unity 5.5.0f3). Once I familiarized me with the megasplat examples and read through the documentation I got going. I see two strange things:

    When I run the terrain to megasplat converter in the terrain paint utility section I do get some splats which I didn't select in the terrain splat to cluster conversion list. For example I get some ice and some lava which I definitely didn't pick:
    upload_2017-1-22_13-42-14.png

    I can paint them away however sometimes I get new lava in the process:
    upload_2017-1-22_13-40-38.png

    Next I tried the Render Baking to prep for the Macro Texture. However whatever I select I always get textures which don't contain anything useful (=usually black). When I looked at the RenderBaker code I remove the line where the camera gets destroyed at the end of the Bake job. When inspecting the camera left in the scene I got the impression it hasn't been setup properly. It doesn't point down and the ortho parameters are too small. I've added the following code:
    Code (CSharp):
    1.       Camera SetupCameraForTerrain()                                        // Added Method DKE
    2.       {
    3.          Camera cam = new GameObject("cam").AddComponent<Camera>();
    4.          cam.orthographic = true;
    5.          cam.orthographicSize = Terrain.activeTerrain.terrainData.size.x/2; // terrain width/2 (assuming square terrain)
    6.          cam.transform.position = new Vector3(0, 10000.5f, 0);              // position 10000 up from middle of terrain (should probably use terrain coords and find middle)
    7.          cam.transform.rotation = Quaternion.Euler(90,0,0);                 // point camera down
    8.          cam.nearClipPlane = 0.1f;
    9.          cam.farClipPlane = 10010f;                                         // far clipping plane needs to be larger than camera y position
    10.          cam.enabled = false;
    11.          cam.depthTextureMode = DepthTextureMode.None;
    12.          cam.clearFlags = CameraClearFlags.Color;
    13.          cam.backgroundColor = Color.grey;
    14.          return cam;
    15.       }
    This code does make the RenderBaker generate textures however: a) always the same contents (= albedo) whatever I select and b) when I select a single "Features" I will consistently get the previous in the list. So selecting Normal will generate Height (although the contents is always albedo).

    I hope you can look into this when you're back on land.
     
  18. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Megasplat looks like an amazing product :)

    You can add as many texture rules as you like with Gaia right now - so barring bugs in megasplat (or Gaia), then you should be able to take advantage of the power of megasplat.

    I am also working on the next version of Gaia right now, and am adding GPU compute support, and some more interesting approaches to texturing - which I think I will need in order to be able to compute the huge numbers of textures that megasplat supports quickly.

    To get a sense of the performance differences, stamping took up to 5 seconds, and now takes just 12 milliseconds.
     
    recon0303 and Steve-Tack like this.
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Most likely this is because the splat map resolution in the shader doesn't match the resolution of the texture. This is enforced in the next version, but you can fix it by opening up the terrain data rollout and setting the texture resolution to match the backing texture.

    Flow is coming to Terrains in the next patch. I'll soon have the shaders fully unified, so that all features are available on meshes or terrains.

    The render baker issue is likely an API/Platform difference I need to look into. I've run into enough of these before.[/QUOTE]
     
    recon0303, Goodgulf and Ascensi like this.
  20. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    It's super encouraging to see you post in this thread. I didn't realize that Gaia could already take advantage of MegaSplat.

    :)
     
    AdamGoodrich likes this.
  21. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    MegaSplat has the ability to ingest standard terrain splatmaps, and because of this Gaia is inherently supported. However, as mentioned I am also doing some work which will better suit the new capabilities that MegaSplat brings to the table :)
     
  22. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    That worked, thank you.
     
  23. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is amazing. Looking forward to your next release.
     
  24. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Hey sorry if it's been asked, but does the shader allow for transparency on the terrain like RTP does to be able to make holes or hide some area ?
     
  25. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Why it does not support Unity 5.3 ?
    What are advantages over RTP (Relief Terrain Pack) asset?
    Thanks!
     
  26. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Try as it might, RTP does not really get rid of the tiling issues. And you are still limited to two passes, which means 8 textures.
     
  27. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    This is really a great asset, I just hope jbooth will add a second layer for 'Alpha Layer' mode (I really need it).
    Just a question for everybody:
    I'm wondering about the threshold between 'add vertices to have a better painting' and ' decrease the vertex number to have better performance'. Any hints?
     
    Teila likes this.
  28. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    I second this. Is it really possible to get nice pbr textures on a terrain without alpha channels? Curious.
     
  29. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Ah, I see, 256 textures supported, WOW, this is really cool! :)
    Any chance of Unity 5.3 support?
    When it can be ready for production? I mean v1.0 out.
     
  30. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    Thanks, works like a charm!
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    5.3 does not support Texture Arrays, so no. 1.0 is likely a few weeks out, though that's most just numbering..
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    I will at some point- but I personally think making your entire mesh draw as alpha so you can make holes in a terrain is a pretty bad way to do it.

    On vertex count; assuming your using a mesh this is an interesting set of tradeoffs. For instance, if you're using a 1 layer shader, then having less control points for painting can actually look better than having more (wider transitions). So any answer is really going to depend on your use case and what you're going for.
     
  33. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    The tiling is the main reason I'm using it. I've switched to a RTS style game and in any higher camera position the tiling on standard terrain (terrain-as-mesh too I guess) will become very visible. No amount of fog can hide that. So far Megasplat really delivers.
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Adam actually contacted me when I first started working on MegaSplat. At some point, I'd really like to get a deeper integration, essentially just selecting texture clusters in Gaia and doing the conversion step at the end of the generation step. Then everything would be seemless for the user with no conversion step necessary..
     
  35. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    Hi Adam, indeed the standard converter which is included in MegaSplat works pretty easy. Looking forward to whatever you're hinting at in your post. I see great potential in the combination.:cool:
     
    Teila likes this.
  36. Vostreys

    Vostreys

    Joined:
    Jan 21, 2017
    Posts:
    1
    Jbooth has constantly stated that putting holes in unity terrain via alpha is a hack and performance hit. Instead he has recommended converting the terrain into a mash (or using a voxel terrain) so he can maintain a single pass rendering for 256 textures which is faster than stock rendering of 4/8 textures.

    Is the added effort of converting a terrain to a mesh worth gaining both performance and 256 textures? That's a no-brainer to me, but I cannot answer to your needs. And with Gaia adding direct support for MegaSplat 256, new fun opens up.

    Aside (not really), be aware that the texturing /blending aligns to vector points instead of UV mapping across the whole terrain, so some adjustments may be necessary depending on how close you want to match existing terrain texturing when converting to mesh with MegaSplat 256.
     
  37. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    I don't need holes, I just have UV mapped objects and want to paint texture variations on them (I'm talking about roads, made of tilable pieces, and buildings). With Alpha Layer I can put the UV mapped texture as macro texture and paint details on that. Having a second layer to blend will be amazing, because actually I can use 1 texture only for each control point (vertex). This is the reason for me to revise all my meshes adding control points... and this is the reason of my question about finding balance between number of control points and performances.
    Any suggestion is welcome.
     
  38. WickedRabbitGames

    WickedRabbitGames

    Joined:
    Oct 11, 2015
    Posts:
    79
    So I answered my own question... line 372 in MegaSplatUtilities.cs

    I changed 'GUI.contentColor = Color.white' to 'Color.black'. Now, I can clearly read the labels.
    There does not seem to be a test to determine if I'm using Unity Pro or not.
     
  39. Kiwi-Hawk

    Kiwi-Hawk

    Joined:
    Jul 17, 2015
    Posts:
    288
    Last edited: Jan 24, 2017
  40. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Stupid question - I plan to make 4x4 driving game. So this tool is exactly what I need, but is it ready for interaction with wheels? What about some wheel marks on terrain or terrain real time deformation? ;) It shall be nice to have some real time terrain interactivity! Is it planned?
     
  41. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    764
    Hi,
    This tool looks amazing!!
    Maybe i have a stupid question but thanks to this tool it should be easy to implement footseps sounds based on texture raycast...? right?
    thanks in advance
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'll put this on the backlog- shouldn't be too hard, but will require PerTexProperties to be enabled.

    You can get terrain information and modify the terrain based on raycasts, but I think footsteps would be better done via decals because of the size of the details.

    I have a runtime modification sample coming in the next release which should show you how to do stuff like this; that said, the same issue as above applies; small details are better done with decals, as terrain modifications are limited to the terrain points (vertex or pixel in the splat map)
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Thanks, I'll put that in on the next release; let me know if there are other areas you find that need the pro/free color switch..
     
  44. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    I'm, your fan man! Can't wait! :)
    Something like this should be really mega cool - https://www.assetstore.unity3d.com/en/#!/content/76468
    Some terrain deformation plus maybe a decal over it ;)
    Your terrain stuff is what we really need in Unity, please keep going!
    +1 customer, and I'll tell to my friends about this mega cool terrain system.
     
    Ascensi likes this.
  45. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    In reading through the forum, I now conclude that the "j" in @jbooth stands for "Jedi Master Programmer" Booth. ;)
     
    Akshara likes this.
  46. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I think @eaque was asking about ways to detect the surface type for the purpose of triggering footstep sounds (or other things like particle effects, vehicle stuff, etc). Like is there a way to do a raycast and determine which texture cluster you're hitting? I was wondering about that myself.
     
    wood333 likes this.
  47. Kiwi-Hawk

    Kiwi-Hawk

    Joined:
    Jul 17, 2015
    Posts:
    288
    Kia ora

    This is a tad hard to read friend, not all of us are paying into this monetized dark shader for the UI



    Nor do I have any sliders to work with



    I'm trying to use this with World Creator, is there anything I should know with reguard to this usage? I read the post up above mine talking about the blotchy texture but I did not understand your fix about the mismatch texture size or what ever it was or where to go to make what ever change's I needed to make
     
    Last edited: Jan 24, 2017
  48. gn0ll

    gn0ll

    Joined:
    Sep 29, 2016
    Posts:
    16
    Just bought and was trying to follow the tutorial on converting my terrain and noticed that I don't have the option to create a MegaSplat Terrain Shader. Is this portion still in development?
     
  49. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    You should be able to right click in a folder Create/MegaSplat/MegaSplat Shader
     
  50. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, there's a component that takes a raycast hit and returns the dominant texture name.
    .
     
    eaque likes this.