Search Unity

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

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

  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'll probably just not use tessellation then. Thanks for the info.
     
  2. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Can't you use a moderate amount of tesselation, so the mismatch between physics and graphics will be too small for the player to notice, yet will produce a visual benefit? The tesselation I'm seeing in my game is too small to have any noticeable effect on physics, yet it makes the terrain look much better.
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'll have to experiment and see. The amount I had set in my demo scene was definitely too much and the feet going through the ground was obvious.
     
    Dwight_Everhart likes this.
  4. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Interesting. Sucks that Unity's shader system lacks documentation. I'm amazed you're able to do what you've done without it. The darkened textures aren't a huge deal. I think I can compensate for them in lighting or post processing.

    Thanks for the tip about adjusting the shadow bias. I changed it from 0.05 to 0.2, and the shadow artifacts went away completely. To be safe, I'm now setting it to 0.4, to match my normal bias. I don't know much about lighting, though. Does that sound reasonable?

    Is distance-based tesselation better to use than edge-based tesselation? Or does each have its own tradeoffs?

    I made a video of the shadow artifacts, in case you want to look into them:



    Thanks again for your amazing support, Jason! You rock.
     
    Last edited: Jun 27, 2017
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Sure, all depends on the scale in your game.

    Tradeoff's. Edge based gives a more consistent performance, but you can see the edges sliding around a bit more. Distance looks more stable, but you may get worse performance because of microtriangle issues.

    Looking at your video, it seems as if the control point resolution on your terrain is very high (splat map resolution). Unless you need that level of control, lowering it will save memory and make the blending between textures on the same layer look better. Something to play with..


    -----

    On another note, I did a big speed comparison verses a new terrain shader yesterday (megasplat was much, much faster), but in that process learned that working with many terrains at once is a major pain (the scene had 20 large terrains in it). So next release my plan is to have a system that makes it much easier to sync/manage shader settings across many terrains, etc, which can all be automatically setup when you do the "set it up for me" button in the terrain painter.
     
    wwg, ftejada, jimmikaelkael and 3 others like this.
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    :)
     
    WildStyle69 likes this.
  7. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    MegaSplat is so fast, it's insane... I'm running in VR with stuff turned on / up and still getting a great frame-rate. My previous terrain solutions were giving serious performance issues in hindsight.

    Also started blending terrain and meshes yesterday.. and with MegaSplat it's just so easy.

    // WildStyle
     
    jbooth and Dwight_Everhart like this.
  8. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Any tutorials for blending terrain and meshes?
    Also, one thing i really liked with RTP was the tools for making holes/caves, any plans on including similar tools for that? I guess i can just take the RTP scripts though and mod them a bit.
     
    Dwight_Everhart likes this.
  9. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    My game is a large, open-world game with multiple terrains generated at runtime by MapMagic, each with a size of 2000, although I may change that to 512, since Denis recently said that size is optimal.

    Ok. I'll try edge, and, if I see any significant artifacts, I'll switch to distance.

    Thanks. MapMagic is setting the control texture resolution to 16. Is that high?

    upload_2017-6-27_10-48-11.png
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, megasplat doesn't use that one. The best way to know for sure is to look at the textures it generates (these are in the splat control section of the shader).

    You can do all of these things with MegaSplat, but the toolset is not as mature in this area as it is in RTP. There's a custom brush that allows you to blend normals with another mesh or Unity terrain (use in the custom tab of the vertex painter). You then paint the textures the same, and use a UV mapping that allows them to line up (projected, or triplanar). If I ever emerge from the mountain of stuff I have to do more urgently this is an area I'd like to spend more time on (about to ship a game at work, plus it's summer, so less time in general). The only thing missing for holes, really, is a trigger script to turn off physics, which is pretty trivial to write.
     
    Dwight_Everhart likes this.
  11. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Good to hear that's my biggest issue now with MegaSplat. It's relative crazy to set same parameter on 16 terrain materials ;) Thumbs up!
     
  12. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Ok i will look into the painter stuff and see if i can figure it out, no video out that shows how it works?
    Regarding the holes, i was mostly thinking about the tool in RTP that takes a quad and fits it to the terrain, but im sure i can just get that ported over.
     
  13. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I am also in the dark about this feature. Jason said the only help right now is the example project and what it says in the docs. The only video right now is out of date and will get you nowhere. He has said he will probably make a new video at some point and also improve that feature.
     
  14. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Ok, im not really in a hurry with it atm : )
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, and since MegaSplat stores the shader information for the compiler in the material, you can end up screwing things up pretty easily and having to do it again. So, what my current prototype does is stamp a component on each terrain which references a template material and the two textures the terrain needs which are unique (splat control and parameters). When it starts up, it makes a copy of this material for each terrain and sets the unique data on it. You only edit the original material, as the ones on the terrain are just temporaries. If you select 50 terrains when you do the "set them up for me", it will create one material and shader for all of them, and set this all up as well.

    So the two issues I'm thinking about are how to best update this data, and how to avoid confusion when working directly with materials on a terrain. Ideally you'd always edit your template and it would know how to replicate that to anything in the scene. But I don't think there's a decent way to prevent you from accidentally editing one of the instanced materials. And I would like to avoid large slowdowns when you drag a slider on a material, and it suddenly updates 50 terrain materials.
     
    Ascensi likes this.
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So if you go to the custom tab in the vertex painter there's a "Normal Blend Brush", right where you would select the texture array. That brush lets you select a target terrain or mesh - when you paint on another mesh, it tried to copy the normals/tangents from the source mesh to the mesh you are painting. The other thing you need to do is line up the UVs on the texturing and paint the texturing the same, which usually means using some form of projected UVs (World Space projection, or triplanar). Once that's done, you can paint the textures the same and they will line up, and the lighting seem will be smoothed by the normal blend brush.

    If you need to do this with regularly textured objects, you can make a new MegaSplat material and set it to Alpha Layer. When set to alpha layer, painting on the top layer adds splats to the object, and painting on the bottom layer erases then. You use the macro texture slots to texture your object with regular textures.
     
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I have a question about the MegaSplat converter that is somewhat related. One thing I don't like right now is that if I go back into the converter utility, it doesn't remember the setup that I previously used. So, if I'm experimenting with different texture cluster setups and just want to switch one cluster I can't do it. I have to re-select every single one. Can that be changed so it remembers the current setup?
     
  18. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I have to admit I have no idea how to do such a thing.

    Yes, I only need to do this with regular objects. So, I want to plop in an already textured rock and just blend it with the terrain. Is this what you would use this technique on?
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can save and load configurations.. That was added, oh, a patch or two ago.. But it might be good to store off the path of the last one loaded and load it if it still exists..
     
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I didn't know that. Thanks. I'll definitely be saving my configurations.
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Change SplatUVMode to Project on the terrain. Set it to world/top. This will texture your terrain based on a top down projection in world space.

    The create another shader for your rock and set it's layer mode to AlphaLayer. You can find an example in the documentation where I'm painting grass onto a house with this mode. You will need to turn on the second UV option in this case, because we want the UV's for the regular texturing to be provided by the object UVs instead of the projected UVs. Then add your diffuse map, normal map, etc for the rock to the macro texture slots. Now you can paint splats onto your rock. The splat's UVs will be based on the topdown projection, but the regular textures will be based on the UVs of the main model.

    To blend this with you terrain you can paint the same texture onto both of them. However, there will still be a lighting seam between them. For that, you can use the custom "NormalBlendBrush" to blend the normals of your rock towards the same direction as the terrain normals.

    Note - you might have a tangent space issue with the normal mapping on the main object. Recently I was asked to allow the tangents to come from the projection, but in this case that's likely not what we want, so I'll look into making that optional.
     
    Dwight_Everhart and WildStyle69 like this.
  22. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Wow, quite a bit of stuff to get it working. I'll hold off on attempting that for now. Mostly a beautify thing that can come much later anyway.
     
  23. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Another possible tweak to discuss -- when using alpha mode it works great, I'm using it to cut holes. Problem I have is that I've already painted my whole terrain and it's looking pretty OK. If I now enable Cutout mode and add the extra texture array to hold the alpha value it gets put in at index 0. This then shuffles all cluster indexes.. so any painting I've already done on the terrain is no longer valid, as all the indexes have now shifted.

    Rather than having to repaint the whole terrain again, is there a way around this, am I missing something obvious here? It might be better to have the alpha texture as the last one in the array somehow, or have another way to deal with this use-case?
     
  24. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It would be possible to do array index 255 = alpha 0 as a shader option. I'd have to add support to the terrain painter for it as well though, but totally doable.
     
  25. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Is this what you're talking about?

    upload_2017-6-27_17-33-11.png

    I've never changed anything in this section.
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, you're not really meant to, for the most part - that's why it's folded away by default. Basically, those are the textures MegaSplat uses to drive the splat data instead of the ones Unity creates.
     
  27. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Ok. You said, "it seems as if the control point resolution on your terrain is very high". What should I adjust? I can't edit the Control Size field.
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, 512 seems fine. In the screenshot it looked like your texture clusters were transitioning a lot (ie: a new texture every foot) - you might want to play with the cluster scale a bit when you paint, as it looks best when you get to see a tile or two of a texture before transitioning to the next one. A lot of people start out making 2k terrains with 2k control maps, which is wasteful in MegaSplat, since it tends to look best with lower res control maps (how often does that happen in graphics!?).
     
    Dwight_Everhart likes this.
  29. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    This sounds awesome, thanks man -- do you think this update will come in the next few weeks? I'm just considering if I should switch tasks and come back to the hole making, or repaint the terrain again.

    Also -- the 'Transfering Paint Jobs' cannot be used in this instance.. or not helpful?
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Not sure, I have a lot of small things on the list and a few potential issues I need to look into for people. There's currently not an easy way to say "+1" to every texture index, which is basically what you want to do, but it's honestly nearly trivial to write a script to do that if you really want to preserve your existing data.
     
    WildStyle69 likes this.
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you'd like to beta this new workflow, feel free to send me an invoice. It could use some additional testing, but overall I'm pretty happy with how it works and how easy it is to setup dozens of terrains and manage them now.
     
  32. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Makes sense, I'll look into that. Thanks

    Edit: where would I change that data, what file / parameter should I be looking at updating?
     
    Last edited: Jun 28, 2017
  33. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Had a quick look into this, and don't see how it's possible right now. For example If my indexes at 0 and 1 were both road before, they are now alpha and road. So if I now add a new dummy texture in at index 0 (to be alpha) that then shifts everything else back 1 index place (expected). Now however the wrong textures are mapped to the terrain paint job of course, so how / where is the file I need to edit manually to shift everything?
     
  34. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    I didn't know there was another Megasplat forum :(.

    I painted a mesh using the vertex painter. It looks fine in the Editor, but isn't there in my build. Is there something I need to do to make that happen?
     
  35. chiefarchon

    chiefarchon

    Joined:
    Jun 22, 2009
    Posts:
    80
    Hi there

    Unity 2017 is due out in July, but betas have been available for testing.

    • Have you had a chance to test Megasplat on the Beta?
    • Will MegaSplat be ready for this release (Unity 2017)?
    I would like to use your product in my new project but I will hold off from starting my project till Unity 2017 is released as I have heard that upgrading a project can be difficult at times and I want to avoid this for as long as possible.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Unity broke texture arrays in Unity5.6 and didn't fix them until 5.6.1p2, so any system which uses texture arrays won't work in those versions.

    What other MegaSplat forum were you looking at?
     
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I generally don't spend time in Beta's, it already takes enough time to test and deal with Unity issues across the released versions of Unity, so delving into ones which are unstable is not a great use of time. That said, I have a few users who have been using it on 2017 - but I personally don't trust Unity releases until the 8th patch or so out from the initial release.
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's not a place to edit the lookups - I'm saying you could write a script that goes through the data and moves all the indexes. In fact, for a Unity Terrains, you could load the splat textures into photoshop, create a layer and fill it with a value of 1,1,1 (almost black), set it to additive and mask it so it only affects the red and green channels (this is where the texture index is stored). Done.
     
    WildStyle69 likes this.
  39. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Thanks man -- apologies, I don't get how that's going to help in my situation. I'm not familiar with how the splat data is stored and don't really understand how to go about correcting things so that a) my existing textures are still mapped to the correct paint locations and b) I can paint alpha for holes.

    Not to be a pain -- so guess I'll have to go back to the drawing board and repaint the terrain again, although that's going to cost me a few days work, hence my reluctance to do that. Appreciate the good support, as ever.
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    If you want send me your textures and I can add one to them. No reason to waste several days..
     
    WildStyle69 likes this.
  41. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Thanks man, I just sent you a message. Hopefully sent you the right thing!
     
  42. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    246
    Hi.

    I have been looking around for a replacement shader for my terrains.
    I just wonder whether your (very cool) product, is something for me.

    I am making a 3d game for somewhat higher end mobile, so i am trying to squeeze every bit of performance out of unity.
    Right now i have resorted to the legacy diffuse terrain shader, but i would really like to use just a bit more textures, without the heavy impact it has now.
    I am not planning to use normal maps or anything fancy. I am going for a bit of a stylized/cartoony look, so
    just plain low-res textures.
    For most of my shaders i am using the fastest possible vertex lit shaders.

    I know i can "create" custom shaders with your tools, depending on what i am using, but do you think your product is overkill for me?
    And do you think that if i only use the bare minimum settings, with say 8 textures, i could equal or even outperform the legacy shader with 4 textures?

    Grtz
     
  43. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    I'm not using the terrain painter. I'm using MapMagic to generate the terrains at runtime. This area of the game is a mixture of biomes, which may be producing some odd cluster choices in places, where one cluster is taken from one biome and another cluster next to it is taken from another biome. We spoke about this issue briefly — the squiggly lines of textures. I haven't been able to create a small project that reproduces it, but I changed my cluster distribution in MapMagic, and the resulting terrains look much better now. The squiggles aren't as obvious. They're a minor issue now.
     
  44. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    130
    I'd love to see more examples from MegaSplat users. I've watched most of the videos and they look great, but it's hard to know which feature are enabled and how it would perform in a real game. Will someone please share some pictures of terrain? Tell us what features you are using and the performance you are seeing?

    Also, are there any know issues (performance or otherwise) when viewing the terrain from the air, like in a flight sim scenario?

    Thanks!
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I haven't done any timings of the legacy shader, but I would expect that it will outperform MegaSplat as long as you stay at 4 or less textures. If you go over that with the legacy shader, it will have to draw the terrain a second time, which may be slower than a very low end MegaSplat terrain, but it's hard to know without timing it.

    With no normal maps and lambert lighting, that shader just doesn't have to do much work, and there's a certain amount of overhead required for MegaSplat's technique that really becomes a major advantage as you add more textures, but is additional cost if you only have a few.

    So if your doing 4 textures on a Unity terrain using the legacy diffuse shader, I suspect that's about the fastest thing you'll find.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes please! I love seeing this stuff too! I should get around to doing some kind of contest to draw you all out of the woodwork.
     
    Dwight_Everhart likes this.
  47. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I can't really share any game screenshots just yet, but I can speak about general performance. MegaSplat is fantastic. It was pretty easy to set up and performance never affected my game at all. I would say it's better performing than any other terrain shader available that I've used. I have tried RTP, Distingo, Unty, Tom's, and Terrain Shader Ultra. It not only looks better than all of those, it has performed better for me as well. But I don't have specific numbers or anything.
     
    Dwight_Everhart likes this.
  48. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'm sure this is a noob question but I can't figure something out: The documentation says "Regardless of packing mode, all albedo textures should have a height map packed into the alpha channel. The height map is used to resolve the blending between multiple textures, allowing sand to creep into the cracks before it covers the stones. "

    But looking at your Terrain demo scenes, the textures don't have alpha channels -- at least I don't see any when I open them in photoshop....so what am I misunderstanding?

    thanks
    Dave
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    All the diffuse textures have alpha channels with height information in them..
     
  50. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    130
    @jbooth - any issues when viewing terrain from the air or flying over?

    @magique - I currently use RTP with 4 textures and the performance is fine, the PM is OK, but it's not very interesting looking (specifically, the blending).

    My game is a mix of FPS and flight sim with a lot of ground interaction. I want interesting and detailed terrain with some parallax/relief when the player is running around, and have it still look good from afar, when flying over. Do you think that can be achieved with decent performance?

    Thanks!