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
    Got a repro? If you it activating and click by mistake it would add one to objects near the brush, but shouldn't just add them willy nilly.
     
  2. aflatau

    aflatau

    Joined:
    Oct 7, 2015
    Posts:
    29
    Is there a way to disable it adding objects near the brush? I am painting ground terrain under objects I do not want the script on..
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Don't select those objects (or parents of those objects). I usually create a root object for everything I want paintable, select it, and paint away..
     
  4. aflatau

    aflatau

    Joined:
    Oct 7, 2015
    Posts:
    29
    So as long as the Vertex Painter is 'Active' any object I might accidentally select it will auto add the script?
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Any object which is selected and painted on with a brush will have the script added. But simply selecting it shouldn't add it. (And obviously has a mesh, etc)
     
  6. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Hi @jbooth, just bought the asset yesterday. Kind of an impulse buy after watching a couple of your videos. Looks like a great way to get rid of that tiled look on terrains. The tessellation examples really puts it over the top. :)

    I'm having what seems like three different issues, so here's the deal:

    Issue 1: Importing MegaSplat into a new project results in Unity crashing. I get the "Unity Bug Reporter", then Unity goes away. I'm on Unity 5.4.2f1 and Windows 10. I'm not sure the crashing is a big deal or not. I tried deleting the whole project, rebooting, and re-downloading the asset, but it does it every time.

    Issue 2: I can open the scenes Mesh and UnityTerrainExample and I can see the mesh and terrain rendering fine. If I open UnityTerrainTesselation, Unity goes into a weird state where it's not repainting anything in client area of the entire Unity window. I can still see the top menu, but it won't respond at that point. If I resize something, the entire client area goes black. Unfortunately on restart of Unity, Unity opens the last scene you had open, so it'd go back into that state immediately. Deleted the project and tried another, being careful not to open that scene again. Ever heard of that?

    Issue 3: I followed the PDF documentation on selecting a brush to paint on the example terrain, but as soon as I click on one of the brushes, I get this red error:

    MissingReferenceException: The object of type 'Material' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Material.SetFloat (System.String propertyName, Single value) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:364)
    JBooth.MegaSplat.MegaSplatUtilities.RenderBrushSpherePreview (JBooth.MegaSplat.TextureArrayConfig config, JBooth.MegaSplat.BrushData brushData, Int32 size) (at Assets/MegaSplat/Scripts/Editor/MegaSplatUtilities.cs:210)
    JBooth.MegaSplat.TextureArrayConfig+BrushData.UpdateMultiLayerPreview (JBooth.MegaSplat.TextureArrayConfig config, JBooth.MegaSplat.BrushData bd) (at Assets/MegaSplat/Scripts/Editor/TextureArrayConfig_Brush.cs:66)
    JBooth.MegaSplat.TextureArrayConfig+BrushData.DrawGUI (JBooth.MegaSplat.TextureArrayConfig config) (at Assets/MegaSplat/Scripts/Editor/TextureArrayConfig_Brush.cs:165)
    JBooth.MegaSplat.TextureArrayConfig.DrawGUI () (at Assets/MegaSplat/Scripts/Editor/TextureArrayConfig_Brush.cs:214)
    JBooth.VertexPainterPro.VertexPainterWindow.DrawCustomGUI () (at Assets/MegaSplat/VertexPaint/Editor/VertexPainterWindow_GUI.cs:405)
    JBooth.VertexPainterPro.VertexPainterWindow.OnGUI () (at Assets/MegaSplat/VertexPaint/Editor/VertexPainterWindow_GUI.cs:167)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I've never seen or heard of any of this happening, but there's always a first time.

    The error is from rendering the preview spheres used in the brushing interface, do you see them in the interface or are they untextured?

    The other two errors are more of a mystery. Had this been on an older version of the asset, I might have thought it was Unity's shader compiler giving up- but since I've switched to my own shader generator the shaders are very light and don't stress the compiler anymore. If the terrain is rendering fine, then the assets have at least imported correctly.

    The second issue could possibly be a GPU issue, as tessellation is very taxing, and tessellation on a Unity terrain is more taxing than it is on a mesh. That said, it's odd that it doesn't blow up on the mesh version, or take down your whole system, which is usually what happens when a GPU has an issue.

    Can you do a fresh install of a new version of Unity (not over the current one) and see if it still happens? Maybe something has happened in the install of Unity?
     
  8. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I don't see the preview spheres. With a brush highlighted, in the Scene view it just goes to the normal cursor. If I try to drag while left-clicking, it goes into normal drag selection box and the Vertex Paint window loses its object.


    I was able to open the "Mesh" scene, but I haven't even attempted "MeshTessellation" in case that wasn't clear. The GPU is a GeForce 770M if that makes any difference.


    I pulled down Unity 5.5.0f3 and installed that. When MegaSplat imported, it didn't crash Unity, but it did go to an unresponsive state. I could minimize and restore, but it took several seconds. Most of the time the window client was black, but after quite a while, the asset store window painted (the rest of the screen was still black).

    Got the exact same error when clicking on a brush. Just for grins, I tried opening the tessellated terrain scene, and it went into unresponsive mode. Interestingly, 5.5 seems to be smart enough not to try and open the scene that caused it to crash.

    I don't actually get the error when pulling up UnityTerrainExample and selecting the terrain, at least at first. The brush just doesn't seem to do anything. After I pulled up the "Mesh" scene, I started getting the error just clicking a texture cluster. Then if I go back to the terrain one, I get the error every time.

    On a side note, the PDF doc says to open the scene "Example", which doesn't seem to exist. :)

    EDIT: Oh, and on another side note, I got the dialog about obsolete API calls in 5.5.0; I clicked to let it convert those.
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That should be fine. I've tested in 5.5 on windows and OSX with each release, and the conversion to 5.5 has always just worked (used to spit some warnings, but I wrapped all those into conditional compiles in 0.93). My windows box runs a 980ti..

    I see, I had thought the Mesh tessellation worked, but the terrain one didn't. Tessellation just not working sounds more like a general GPU issue, though a 770M should be perfectly fine unless the GPU has something wrong with it. Have you tried running tessellation on it before? In Unity or otherwise? There are some free tessellation shaders on the asset store you could try. Meanwhile, I'll look though my code and see if I can find any potential divide by 0 cases in the tessellation- some GPUs are just fine with them, while others will blue screen of death (though I've never seen one just not render in this case).

    Edit: Nope, nothing like that found (only a few divides, and all properly clamped)

    The only other thing I can think to check is if you are running the editor in OpenGL in windows, or some non-standard configuration like that - it should say what API it's using at the top of the editor. Beyond that, maybe try on another machine if you have one and see if it's specific to your machine?

    Really odd..
     
    Last edited: Jan 6, 2017
  10. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    My gaming rig has a 980 Ti as well. I could try putting Unity on there at some point and try it, though it's not where I would do my game dev stuff.

    I don't recall trying it before, but I remembered that Alloy has tessellated variants of all their shaders you can optionally import. I pulled Alloy into a 5.5 project and put one on a default sphere. In wireframe mode I see it add a bunch of polys as it gets closer to the camera, so I'm gonna say it works. :)
    https://dl.dropboxusercontent.com/u/28342849/Unity_misc/MegaSplat/AlloyTesselationSphere.PNG


    Looks normal to me:
    https://dl.dropboxusercontent.com/u/28342849/Unity_misc/MegaSplat/DX11.PNG


    I may do that just to play around with the asset. Is it possible that's it's a bug in the video driver? I guess I can try updating it.
     
  11. ytrewq

    ytrewq

    Joined:
    Aug 5, 2012
    Posts:
    42
    Hello. We currently studying MegaSplat for possible usage in our project. This a huge world with multiple adjucent terrains, generated by Terrain Composer 2. Currently we use Relief Terrain Pack for terrain, but it limited to 8 textures, applyed globally to all terrains which is obviously not enough.

    There are some questions.

    1. Looks like it's possible to convert all terrains to MegaSplat terrain individually. But in case of multiple terrains, created by Terrain Compser, it will be rather time consuming to do the same actions for all terrains (curently we have 16x16 terrain grid, 256 adjucent terrains total). Is it possible to apply changes to all terrains at once?

    2. There is a tool for multiple terrian edition, which works with standard splatmaps and heightmaps seamlessly.

    Multiple Terrain Brush
    https://www.assetstore.unity3d.com/en/#!/content/44037

    Can MegaSplat work seamlessly with multyple terrains?

    3. In Relief Terrain Pack tesselation means splitting terrain by adiitional faces to make it more curvy, like on this video (from 2:15)



    The tesselation has two subdivision levels - for close and for far distance. As MegaSplat, this feature requires DX11, and allows to add more beauty to even not very high resolution terrain. Is similar feature allowed in MegaSplat? If not for now, is it planned to be added? (What is called "tesselation" in MegaSplat in Relief Terrain Pack called "parallax").

    Honestly, I would prefere to have more subdivision levels, like 3 for example, because in RTP "far" subdivision applied to the far end of the terrain, which is not nesessery and make polycount too big.
     
    Last edited: Jan 6, 2017
  12. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    Hi we decided to try MegaSplat out, any idea why when zooming out the terrain turns black?

    upload_2017-1-6_13-46-3.png
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Running it on another machine would be a great test, as would updating the driver.

    It would be good to know if this is a particular issue with a driver or GPU. However, since we have seen tessellation work on your GPU and MegaSplat work on your GPU, I'm inclined to suspect that there's some combination of those techniques in conjunction with that GPU or driver that's causing the issue.

    Also, the errors your getting about materials are very suspect - do those continue to happen? If possible, I'd love to use Team Viewer to debug on your machine, or Skype to at least see what is happening. It might provide some clue as to what's going on with the other issue.
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MegaSplat's vertex and texture painters all work with multiple meshes/terrains by default. You simply have them all in your selection (or select a root object which contains them) and it will work across everything at once. The converter should do this as well, however, the UI will pull the textures used to map to MegaSplat Texture Clusters from the first terrain it finds. (ie: if you have 10 terrains, each with it's own set of 8 textures, it's not going to give you 10 copies of the UI to map them).

    Tessellation is not actually DX11 specific, it also runs on any device which supports shader model 4.6 or higher (such as modern OSX machines, etc).

    Tessellation in MegaSplat is, well, tessellation, not parallax occlusion mapping. (A simple parallax is available, but a full POM shader would be too expensive to be useful) There are many options for tessellation:

    1. Tessellation amount is chosen based on distance from the camera OR screen space edge length
    2. The surface can be phong smoothed before it is displaced by the height maps
    3. Near and far distances are used to control the amount of tessellation in distance mode; at the far distance, no tessellation is provided, and anywhere closer than the near distance the maximum specified amount of tessellation is used.
    4. In edge mode, the size of an edge in screen space is used to determine how much to subdivide each triangle. This keeps more consistent triangle sizes.
    5. Displacement is non-linearly faded over the near/far distances in both modes to prevent an edge artifact where tessellation ends.
    6. Phong smoothing is available, which can smooth the surface before it is displaced.
    7. There are numerous options for smoothing and shaping the displacement as well.
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, it's not falling back to the distance shader correctly. I've been meaning to fix this for a while- I'll take a look tonight. You can set the distance for this switch in the terrain settings, but it maxes out at some point..
     
  16. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    Should the default textures have proper names or is supposed to be hashes?

    upload_2017-1-6_16-42-42.png
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, they should definitely have proper names. Try selecting the texture array config and hitting update?
     
  18. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    Yep that worked thanks (Auto generate Clusters, then Update). I was getting a unity crash when importing MegaSplat (happens always even if I reimport) so that could be related. MegaSplat seems to work even after the import crashes though.
     
    Last edited: Jan 6, 2017
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That seems to be happening to Steve-Tack as well. What unity/os are you using?
     
  20. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    Windows 7 x64 Unity 5.4.1f1, during the import I'm getting a "Display driver stopped responding and has recovered" error. (My graphics card is a GTX 680 and works fine in demanding games.). This is right before it says "Importing small assets".Then it crashes. MegaSplat is imported though.

    Editor.log:

    Code (csharp):
    1.  
    2. D3D shader create error for vertex shader [0x887a0005]
    3. D3D shader create error for pixel shader [0x887a0005]
    4. D3D shader create error for vertex shader [0x887a0005]
    5. D3D shader create error for vertex shader [0x887a0005]
    6. D3D shader create error for vertex shader [0x887a0005]
    7. D3D shader create error for vertex shader [0x887a0005]
    8. D3D shader create error for vertex shader [0x887a0005]
    9. D3D shader create error for vertex shader [0x887a0005]
    10. D3D shader create error for vertex shader [0x887a0005]
    11. D3D shader create error for vertex shader [0x887a0005]
    12. D3D shader create error for vertex shader [0x887a0005]
    13. D3D shader create error for vertex shader [0x887a0005]
    14. D3D shader create error for pixel shader [0x887a0005]
    15. Crash!!!
    16.  
    17.  
    18. ========== OUTPUTING STACK TRACE ==================
    19.  
    20. 0x00000001402B1C32 (Unity) DrawUtil::DrawMeshRaw
    21. 0x00000001414408B2 (Unity) PostprocessAlbedo
    22. 0x0000000141440C8E (Unity) PostprocessAlbedo
    23. 0x0000000141440EBC (Unity) RenderAlbedo
    24. 0x0000000141441EBF (Unity) UpdateAlbedo
    25. 0x000000014144C9F6 (Unity) EnlightenRuntimeManager::UpdateMaterialsForSystem
    26. 0x00000001408C8297 (Unity) EnlightenRuntimeSceneManager::UpdateMaterials
    27. 0x0000000140899321 (Unity) gi::UpdateMaterials
    28. 0x0000000140892998 (Unity) GISceneManager::Update
    29. 0x0000000140892F87 (Unity) std::_Sort<std::pair<int,Hash128> * __ptr64,__int64,vector_map<int,Hash128,std::less<int>,stl_allocator<std::pair<int,Hash128>,79,16> >::value_compare>
    30. 0x00000001400B3888 (Unity) CallbackArray::Invoke
    31. 0x0000000140BE06C3 (Unity) Application::TickTimer
    32. 0x0000000140E4179E (Unity) FindMonoBinaryToUse
    33. 0x0000000140E42DD1 (Unity) WinMain
    34. 0x00000001415C3540 (Unity) strnlen
    35. 0x00000000770959CD (kernel32) BaseThreadInitThunk
    36.  
    37. ========== END OF STACKTRACE ===========
    38.  
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The stack trace looks like it's enlighten. Maybe I need to turn off the baked GI in that scene- it doesn't add much anyway, I was just using it to test that the enlighten pathway was actually working.

    Also, while we're at it, do the tessellation examples work fine for you?
     
  22. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    Just tried opening UnityTerrainTessellation gave me a "Display driver stopped responding and has recovered". Yep happened again on second try. Can't open it. The other scenes work fine. I was able to open MeshTesselation scene after the driver error and restarting Unity. However UnityTerrainTessellation I cant open even after restarting Unity.
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Sounds like a similar issue to what Steve is having. Interesting..
     
  24. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    Just added more info to prev post.
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Ok, if one or both of you can try something like this it might give me some insight:

    Create a new Unity Terrain, Material and MegaSplat shader. Assign the shader to the material and change it's mode to Terrain. Set it up with texture arrays and assign it to the terrain, etc.

    Then slowly turn on more options in the shader compiler setting - Add tessellation, change it to be a two layer shader, turn up the tessellation parameters, turn on phong smoothing, triplanar mapping, Zoom the camera in so terrain fills the whole screen, etc. Basically, as you increase complexity, does the GPU just give up at some point? Does turning on one specific feature cause it to suddenly fail in a repeatable way (that would at least tell me where to look in my code if my code is triggering this issue). The tessellation example scenes tend to have everything dialed way up.

    Also, driver updates if your drivers aren't recent would be worth trying, but it's not like tessellation or Texture Arrays are that new of a feature (however, both aren't super commonly used). Another thing would be watching the GPU temp as it runs to see if it's overheating.

    I dev everything on a 2 year old MBP, so my GPU is likely worse or similar to the ones with this issue, but maybe it's just being pushed too hard when everything is turned to 11. Apple does tend to produced really balanced hardware, where as PC manufacturers who slap GPUs on chips and sell them often overclock them and do other things which are more questionable.
     
  26. ikefrc

    ikefrc

    Joined:
    Jul 3, 2012
    Posts:
    81
    I followed your steps, turning tessellation on (Distance) worked fine, switching to Edge makes the driver crash.
    Ok I went back to Distance and it also crashed when moving around the scene (not while turning it on though).
    Let me know if I can test more specific things for you.

    My graphics drivers are up to date and have no issues in demanding DX11 games. Hope this helps.
     
  27. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    OK, spent some time on this.

    First, I did try it on my gaming rig with a 980Ti:
    * Was able to import with no crashing and no errors.
    * Was able to open the tessellation scenes no problem.
    * Was able to paint on both meshes and terrain. This one isn't actually a problem from before, I was just being a noob. The PDF says to open the "Example" scene, so I had just been opening one of the terrain ones. The instructions say to use the vertex paint tool. So I had been trying to use that on terrain. Hadn't even noticed there was a separate terrain painter. That works... better. :p
    * It wasn't 100%, since after the first time painting a *mesh* and the first time switching to a different texture group for painting, I'd get that same red error every time I switched to a new texture group. It didn't seem to actually cause any issues though.

    Second, I went back to my laptop with the 770M:
    * Now that I know how to use the paint tool :rolleyes:, I found that I could indeed paint on terrain just fine.
    * I went ahead and updated to the latest video driver, and I did get slightly different behavior. Importing MegaSplat in a fresh project no longer crashes Unity, but it goes into that unresponsive state. Restarting Unity, it seems like everything did import.
    * Still could not open the tessellation example scenes. Unresponsive state again.
    * I created a new terrain/material/shader and was able to set tessellation to Distance. I was also able to set it to 2-layer.
    * However, even touching the Tessellation amount, BOOM. Unresponsive state.
    * I did monitor GPU temps, but it didn't look too bad. At idle it seems to be around 38C, and it didn't get much higher than that. I think 44C max.
    * The other thing that's weird is that any time I create a folder or file or do just about anything, there's a 30 second wait cursor, then "Importing small assets", then another wait before Unity comes back.

    So you may be onto something with some GPU's able to handle basic tessellation, but not dialed up settings.
     
  28. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Just noticed a possible documentation error that could be VERY confusing. On page 6 of the PDF:

    The normal is packed into the red and green
    channels (The traditional blue channel is
    removed as it can be reconstructed from the
    first two channels with a bit of math).

    The green channel is the smoothness value


    It seems clear from the screenshot that it's the BLUE channel that gets the smoothness map.
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    So I fixed both documentation errors to be more clear; thanks for pointing those out.

    What I'm going to have to do is get onto a machine with a problematic GPU and a/b out sections of the shader until I can isolate what's causing the issue. Tessellation is a moderately used feature in most games, and Texture Arrays are used pretty rarely until now, so it's quite possible that there's some issue with sampling from texture arrays in a tessellation stage or something horrid like that. But until I can really go "Oh, this line is the one that does it", it's hard to say what the workaround or fix might be.

    On the "Importing Small Assets"; MegaSplat uses an AssetPostProcessor to keep the texture arrays in the correct format when switching platforms, etc. It keeps a hash of all the texture properties, etc, so that if any of them change it updates the array. It's possible that the issues on your machine are causing these checks to fail, or if another asset importer in your project changes those texture settings, then it's rebuilding the texture arrays every time AssetDatabase.Refresh gets called (when anything changes on disk, for instance). To test this, put a breakpoint in TextureArrayPostProcessor and see if it calls TextureArrayConfig.CompileConfig.
     
  30. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I had already deleted that 5.5 project, since it got in a bad state. I had a 5.4 one with MegaSplat that doesn't have that issue, so who knows.

    Had a question about getting the rendering to look like the previews in a Quixel Megascans pack I bought. (everything's gotta be "mega" it would seem...)

    The preview for one of the clay textures looks like this:
    https://dl.dropboxusercontent.com/u...gaSplat/Soil_Clay_pkbdj20_surface_Preview.png

    I went through the texture packing all that for two of the textures and played around with mesh painting a sphere and a plane. It's the darker one in this screenshot from Unity with a MegaSplat shader:
    https://dl.dropboxusercontent.com/u/28342849/Unity_misc/MegaSplat/TwoQuixelTextures.PNG

    For all I know, they're using a fancy offline renderer for those fantastic previews; I'm not expecting realtime stuff to match that in terms of the fine details or anything. I've turned on parallax, but not tessellation, so I'm not expecting anything like the displacement in the preview. The parallax looks really good actually. I'm more just wondering if I can match the color and the subtle specularity from that preview image.

    I temporarily switched the project to linear color space and tried a bunch of stuff with the textures, but I'm not entirely sure what I'm doing. :)

    Do you think there's a way to get the clay textures looking more like that preview?
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    They likely have a multi light setup in that preview scene with a red-ish backlight.

    MegaSplat, when not running in tessellation mode, uses the standard shader lighting model (it does all the same math in tessellation mode, but in non-tessellation it literally runs the same code). I believe Unity matched a lot of that up with Substance recently (switching to GGX, using the same normal/tangent space, etc). You might want to consult a thread where people are doing that comparison for tips, as whatever works for the standard shader will be the same for MegaSplat..
     
  32. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Ah, I didn't realize that. I guess I assumed the MegaSplat shaders were totally different. I created a standard shader material for a side-by-side comparison, and yeah, and they are almost identical. Had to adjust the X offset a small amount, and the default parallax is a tiny bit higher on the standard shader. Interesting.

    OK, I'll follow up elsewhere as more of a general Unity question.

    Thanks!
     
  33. ytrewq

    ytrewq

    Joined:
    Aug 5, 2012
    Posts:
    42
    There is a feature in RTP which seams not present in Megasplat - the terrain hole system with ability to add caves. Usually such features are implemented by transparent shader for some part of the map. Do you plan to add similar feature to Megasplat?
     
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, I'm aware people want this; but I'm not particularly inclined to add it, because it's not really a good solution, and it'll just end up generating as many complaints and issues as the requests I get for it. There are two techniques people use to accomplish this:

    1. Make the whole terrain draw as Alpha or AlphaTest and clip areas you don't want to appear. The main issue here is that you've now made your entire terrain draw much slower, and having it be alpha can cause other issues with sorting and shadows. Additionally, it now draws significantly slower.

    2. Use stencil/draw order tricks to mask out areas. There are packages on the store just for this, and you could likely download one and use it with MegaSplat just fine. The downside is that objects do not shadow correctly in these areas.

    So both techniques are fundamentally flawed. Now lets consider my preferred implementation:

    Use a Mesh instead of a Unity terrain.

    The main advantages here are that you have no geometry restrictions, and that meshes are significantly faster to render than Terrains are. The thing you lose from this approach is the LOD Unity Terrains do for you, but honestly the performance increase you get from using meshes over terrains will likely make up for that, and you can easily do mesh LOD as well. You also lose the convenience of the toolset for modifying the terrain in the editor, which is a big win for some.

    At some point, I may add generic alpha support to MegaSplat (mainly for AlphaLayer), at which point people will be able to do whatever they want.
     
  35. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157
    Okay, so hopefully this asset can accomplish what I want to do, as I don't want to code this all myself if I can pay somebody else for their time :v

    I've been looking at the features and videos for Megasplat and I think it'll do what I want it to do, but I just want to be sure before I buy because the Canadian exchange rate is a little rough right now. I have a game where enemies spew a lot of blood and it looks like Megasplat will allow me to paint where the blood lands (easy enough for me to implement on my own) with a custom brush at runtime. I assume this is possible if I just use a custom brush, figure out where the particle impacts, and paint the brush there?

    Second, with another custom brush, I assume I can subtract from the mess of blood? Something along the lines of how Viscera Cleanup Detail works.

    Finally, if I splat on to a mesh and then deform that mesh, will the splat deform with it? This is sort of an edge case in the game but, again, if I don't have to code it all myself, that'd be great.
     
  36. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    So POM Feature for Terrains is not planned to be added? I am also using RTP for Terrains so some features of it are really important for our terrains.We used POM for Displacement Maps of Terrain Textures and well Tesselation was used for the whole terrain being able to increase Pixel Error values.
    With Megasplat Tesselation would be the altenative for POM I see?

    What about weather effects like Snow / Rain on terrain? Also pretty important shader feature if you ask me. Is this planned to be added to give the terrains a more dynamic weather feeling? Since you only can use one Terrain Shader for a Terrain this feature needs to come from Megasplat if someone wants weather effects on terrain. (Not only Camera Effects).

    Anyway your asset really looks amazing. Specially the 8+ textures feature makes it special and unique. Keep up the good work!

    Cheers
    Ronny
     
    Last edited: Jan 8, 2017
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You could do all of this with MegaSplat, but I think a decal system is more suited to this task. (Unless your goals is more of a Splatoon kind of thing)

    RTP's tessellation is used as more of a smoothing/LOD system. MegaSplat uses it more as a system for sub-triangle detail. POM doesn't make a lot of sense for MegaSplat, as the performance would be absolutely terrible on the 2 layer mode, and edge on artifacting with POM is an issue. I have some ideas around using something like Quadratic Occlusion Maps, but given my experiments tessellation is a much faster method with better visual quality, so I don't see a ton of reason to continue those experiments. Tessellation in MegaSplat also works on OSX, high end android, and should just work when Unity ships tessellation for Metal and Vulkan, so it's not a DX11 thing as it is for many tessellation shaders.

    Funny, I see this in demo's all the time, but rarely see it in actual shipping products. That said, I'll likely add the traditional up-normal snow, wetness, vertical color texture projection, etc at some point. The main thing I want to figure out is how to integrate this with texture cluster type texturing, because not having textures tile looks so damn awesome. I still think these are kind of gimmicky features, but whatever, they're easy to add and kind of fun..
     
    RonnyDance and pixelsteam like this.
  38. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,157
    Splatoon is a great example and one I probably should have used, but I suppose that's one of the unfortunate side-effects of posting at 4:30 in the morning. I'll be purchasing this right away then!
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well, in that case, it's all pretty easy. You can just modify the vertex or splat texture (if using a Unity terrain) directly, in the same manner as the painting toolset does. The docs detail the formats for both.
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So, I've mostly been dealing with physics and optimizations for the next patch, along with a boatload of little fixes and improvements. That said, I just added a new option to the shader for "Detail Noise". This is basically a very cheap form of detail texturing. The current detail texture mode basically chews up one of your splat map layers, and expects an array with detail textures for each of the main textures. In most cases, this is total overkill, and using up a whole layer for that is not really worth it.

    So what the new option does is give you a single detail texture (luminance/normal, packed into one texture) to use over all splat map materials. This makes it super cheap, because it's only 1 extra standard texture sample (or 3 if in triplanar), and only the memory of a single texture. It also only happens when you're within a fade distance, so only areas extremely close to the camera need it.

    Before, oh blurry pixels:


    after:
     
    Last edited: Jan 8, 2017
    Frednaar, ChinChiaYeh and Steve-Tack like this.
  41. zephyr7

    zephyr7

    Joined:
    Oct 12, 2013
    Posts:
    16
    Hey, great work, the asset looks amazing!

    Is there any chance of support for toon / cel shaded styles coming - something similar to borderlands, or even just something closer to legacy diffuse than to pbr?
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hadn't considered it. But adding support for a legacy style diffuse lighting would be pretty easy to do.
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Just submitted 0.96 to the asset store:
    • Physics integration for Tessellated/Displaced surfaces. CPU side physics representations can be constructed by selecting a physics resolution on your diffuse texture array. Once generated, you can add a MegaSplatCollisionInfo component to any MegaSplat mesh or terrain. A function is available to get a physics offset from a RaycastHit. An example component is available a demo'd in the tessellation example scenes which shows how simple collision interactions can be handled.
    • You can now paint displacement dampening into UV3.z. 0 is full displacement, 1 is no displacement. This can be used to prevent seem cracking between meshes with discontinuous UVs or Normals, or as a way to control displacement amount per vertex, which can be useful for making worn/smooth pathways, for instance.
    • New DetailNoise option, which allows you to have a single detail texture used across the entire material. This is much cheaper than DetailTexture mode, saves lots of memory, and still looks great.
    • Fixed issues with normals being discontinuous on discontinuous UVs.
    • In AlphaLayer mode, you can now use a second UV set for splat mapping or triplanar texturing. The first UV set will still be used for the macro texture. This is useful if the main UV set is not suitable for splat mapping. This will raise the minimum shader model to 4.0. You can switch the UV mode to triplanar in this mode, and the macro texture will use the first set of UVs, with triplanar texturing for the splat maps.
    • Optimizations to usage of texture interpolators; this should make certain shader combinations slightly faster.
    • Properties not used by the current shader settings are no longer written out by the shader compiler; this should decrease the cost of draw calls for MegaSplat materials as Unity won’t have to upload quite as much data when submitting a draw call.
    • Brush settings no longer scroll with the texture selection window in the Vertex and Terrain painters
    Should be out sometime this week if things are running as usual over there..
     
    StevenP94 likes this.
  44. negativecap

    negativecap

    Joined:
    Jan 27, 2013
    Posts:
    99
    Any way to use my externally generated splatmaps? If so, I'm in.
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, you can actually convert directly from a Unity terrain (mapping the original textures to texture clusters), but there's also a tool to convert texture data directly to MegaSplat texture or texture cluster choices.

    Here's an example of converting from Map Magic to MegaSplat.

     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    @zephyr7
    Added support for a ramp based lighting mode today, as well as running without normal maps, which cuts the number of needed samples in half. For ramp based lighting, you use a small texture to define the diffuse lighting response rather than computing a full PBR diffuse/specular lighting. Because you can customize the texture, you can get different NPR lighting models, backlight, wrap light, etc. Both of these options speed up the shader by a significant amount, so if they suit the look your going for, or the platforms your targeting (VR/Mobile) it can be a big win.

    Here's some comparison shots:

    Full PBR without tessellation

    Ramp based lighting with NormalSAO (Smoothness currently ignored, but I may add a rough spec term)

    Ramp based lighting, no normal map


    For fun, with funky colorized BDRF:
     
    mbbmbbmm, ChinChiaYeh and StevenP94 like this.
  47. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    Waiting for latest version to be out on the assetstore, some thinking about the asset.
    I noted that MegaSplat is into "Editor Extensions/Terrain" folder and maybe should be in the "Editor Extensions/Painting" like other vertex painter.
    I noted a typo in the image about other terrain system conversion, it says "Easy Convesion".
    Apart this, this asset is amazing and I'm really satisfied of it.
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I put it in Terrain because that's where the tools it works with and competes with are. It could just as easily be in Painting, or Shaders, or Textures since it includes a massive texture pack.

    Thanks for catching the typo - Next time I'm able to update the images I'll upload the fixed one. (You can only update the images with the package, and doing so now resets you position in the line, so I don't want to delay the next patch for that - ugh..)
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    And for anyone who feels this way, please review the asset. I currently have 11 reviews, and having more would not only help the asset sell and possibly help Unity notice and feature it, but those potential sales would allow me to justify spending more time on the asset. This really goes for any asset you own and love, not just MegaSplat.
     
  50. zephyr7

    zephyr7

    Joined:
    Oct 12, 2013
    Posts:
    16
    Awesome, that was lightning fast :D Just picked it up at the store together with Terrain Composer, can't wait to try it out. Thanks!