Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. feckwagon

    feckwagon

    Joined:
    Apr 8, 2008
    Posts:
    13
    Thats great thank you! I'll send an email
     
  2. Seoulsfinest

    Seoulsfinest

    Joined:
    May 9, 2017
    Posts:
    7
    Jason,

    I got the painting to work but still have a quick question.

    The mesh i got it working on is properly unwrapped in 3ds max.
    But for most meshes we use uvw mapping with tilable textures. It seems that i can't get it to work with these meshes. Is there something im not doing right or is it not possible to do this with meshes that are mapped like this?

    In my test i used the same material for both meshes. But on the mesh with the uvw map it seems as if the material is smudged or something.

    vraagunity.png
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    By default it uses the UVs on the model- by the time it hits Unity, the model has no idea how the UVs were generated in Max, they are just numbers.

    MegaSplat allows you to select which UV set to use (UV0, UV1), or generate UVs via a projection, or do triplanar texturing if you cannot provide UVs at all.
     
  4. madmaxim

    madmaxim

    Joined:
    Feb 11, 2013
    Posts:
    6
    For some reason I can't get the Terrain Painter "Blended" brush to work, Single and Cluster work fine, but Blended when selected just does whatever Cluster is set to...is this a known issue at all? I'm in Unity 5.5.3f1 OS X
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, but I can take a look tonight. I don't think that mode gets used a ton, so I suspect it may have been broken in a refactor some where along the way.

    [Edit] Yup, I see the issue. If you send me an email with invoice I'll send you a patch tonight.
     
    Last edited: May 10, 2017
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Flying to North Carolina tomorrow and there's a reasonably high chance I won't have internet until Monday or Tuesday of next week. Meanwhile, I submitted the 1.07 patch last night:

    Features:
    • Distance Noise. Works like detail noise, but used to add normal/luminosity modification to distant terrain.
    Fixes:
    • Texture Graph: Render bounds from terrain lies. Now it’s computed during processing step.
    • Texture Graph: Cavity was being calculated even when unused, which is very slow, fixed.
    • Runtime Painting example now uses texture cluster noise correctly
    • Fixed a bug with puddles which caused the shader to be continuously recompiled, making the editor slow.
    • Terrain Painter could bog down a system when you have scenes with thousands of objects selected, fixed.
     
    Dwight_Everhart likes this.
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Oh, also, forgot to upload this quickstart video I did a week ago for the Texture Graph:

     
  8. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    So jealous. I love North Carolina! Have a great time. :)
     
  9. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Haven't been there in years, but some friends are doing a music festival down there and pulled us down. Should be a blast..
     
    inoj and Teila like this.
  10. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    I have RTP but megasplat looks so damn nice i consider getting it too
    anybody have a small overview
    of megasplat vs rtp?
    especially in terms of ease of use :)

    over time i aquired so many terrain textures rtps limit
    kinda annoys me now
     
  11. Seoulsfinest

    Seoulsfinest

    Joined:
    May 9, 2017
    Posts:
    7
    Can someone explain to me how to get rid of the shine on my mesh? Is there some kind of smoothness slider, like with standard materials in Unity?
    unityshine.png
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There is, but it depends on your packing mode in your textures. If you are packed into NormalSAO, for instance, then smoothness is in the blue channel of the normal map and no slider is shown.
     
  13. Seoulsfinest

    Seoulsfinest

    Joined:
    May 9, 2017
    Posts:
    7
    Ah alright, now i get it and it actually worked. One point i want to adresse is that when using the standard packing mode, i could find a slider for smoothness, but it did not seem to do anything to the splat. Any suggestion what i miss?

    Anyway thanks again for the fast reply and enjoy your trip to North Carolina.
     
  14. Seoulsfinest

    Seoulsfinest

    Joined:
    May 9, 2017
    Posts:
    7
    One last question. Here we use material id's to specify the materials on the fbx. Is there any way to bring these id's into megasplat so we can paint on the initial textures?

    And the main reason we bought megasplat is that we thought it would be a great solution for hard transitions in textures(see example). Asphalt= material id 1 and grass = material id 2. is there any way to automaticly blend the edge into eachother?
     

    Attached Files:

  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461

    Unity turns each material id into its own material; this means more draw calls, so you ideally don't want to do it that way. What you really want to do is have one material and mark the verts with the texture choice; perhaps a max script to convert material id to vertex color?

    There's a 'no spec texture' packing mode if you want to use the smoothness slider. It shouldn't be shown in standard packing mode, so that's a bug.
     
  16. WileE

    WileE

    Joined:
    Apr 12, 2016
    Posts:
    21
    Even after a complete rebuild of my source textures to not have any color management, my normal map for the Macro texture is coming out very "pale" or low contrast, which then leads to the rendering being too dark. The albedo texture looks fine in terms of contrast, and has a fair bit of detail (I rendered it at 8K). I'm wondering if the way the macro normals are extracted from the terrain is sensitive either to the overall terrain size and/or to the scale of the textures on the ground. We have a single very large terrain that is 7000 world units on a side. Because the textures we're working with are 1m / tile of real world size, I set the texture scaling to 1000 in the MegaSplat material, and many of the splat patches in the control map are small -- also about 1m. (We are generating the terrain and splat maps with World Creator and then applying the MegaSplat material to it).

    Would any of this be known to make a difference?
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Is this macro texture rendered from the render baking functions in MegaSplat? If so, the problem is that even with a large texture size, the number of pixels you have to represent the surface is small. Additionally, you'll mostly be using the normals lower mips, which unity produces by averaging, which flattens the normal.

    What I would suggest is to render cast a normal map for the macro texture which is the difference between your high and low res geometry, and blend the render baker output with that. Basically, the normals produced by the splat textures have little effect at a distance, and the difference between high and low res topology is what you want.
     
  18. WileE

    WileE

    Joined:
    Apr 12, 2016
    Posts:
    21
    OK, I was suspicious it was something like that, so thank you. Yes, I used MegaSplat to bake the macro texture. I'm afraid I'm not following your suggestion, though. When you say "render cast a normal" you mean write a script to create a normal of the terrain surface itself? Or use another tool to generate a normal from the generated terrain heightmap? (I've been unclear as to whether the MegaSplat macro normal was the terrain normal or normals of the normals of the splat textures themselves or a composite of both). I get that at a distance and this scale, the splat normals will be insignificant.
     
  19. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It's just the splat map normals. There's really not a generic way for me to generate a terrain normal without both topologies (high res and low res). With a mesh workflow you could cast this using any 3D app that does that; but since Unity Terrains are CLOD based there is no single topology to cast against.
     
    Last edited: May 11, 2017
  20. BoyNoodle

    BoyNoodle

    Joined:
    May 11, 2017
    Posts:
    3
    Hi Jason

    Just downloaded version 1.7 & using Unity 5.6.0f3. I've got the following errors in the console. I definitely ran the API updater on installation. I can't run it again as the API updater option is now greyed-out.

    Assets/MegaSplat/Scripts/Editor/TextureArrayConfigEditor.cs(168,29): warning CS0618: `UnityEditor.TextureImporter.textureFormat' is obsolete: `textureFormat is not longer accessible at the TextureImporter level. For old 'simple' formats use the textureCompression property for the equivalent automatic choice (Uncompressed for TrueColor, Compressed and HQCommpressed for 16 bits). For platform specific formats use the [[PlatformTextureSettings]] API. Using this setter will setup various parameters to match the new automatic system as well possible. Getter will return the last value set.'

    Assets/MegaSplat/Scripts/Editor/TextureArrayConfigEditor.cs(173,28): warning CS0618: `UnityEditor.TextureImporter.textureFormat' is obsolete: `textureFormat is not longer accessible at the TextureImporter level. For old 'simple' formats use the textureCompression property for the equivalent automatic choice (Uncompressed for TrueColor, Compressed and HQCommpressed for 16 bits). For platform specific formats use the [[PlatformTextureSettings]] API. Using this setter will setup various parameters to match the new automatic system as well possible. Getter will return the last value set.'

    Assets/MegaSplat/TerrainPainter/Editor/TerrainPainter_Painting.cs(149,21): warning CS0618: `UnityEditor.Handles.SphereCap(int, UnityEngine.Vector3, UnityEngine.Quaternion, float)' is obsolete: `Use SphereHandleCap instead'

    Assets/MegaSplat/VertexPaint/Editor/VertexPainterWindow_Painting.cs(1771,24): warning CS0618: `UnityEditor.Handles.SphereCap(int, UnityEngine.Vector3, UnityEngine.Quaternion, float)' is obsolete: `Use SphereHandleCap instead'

    Assets/MegaSplat/VertexPaint/Editor/VertexPainterWindow_Painting.cs(2408,21): warning CS0618: `UnityEditor.Handles.SphereCap(int, UnityEngine.Vector3, UnityEngine.Quaternion, float)' is obsolete: `Use SphereHandleCap instead'

    I'm a Unity noob so could be doing something stupid. Any ideas?
     
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Seems like the API updated didn't work; maybe restart unity? Note that MegaSplat will not work in builds in 5.6 until Unity fixes the bug they introduced (texture arrays are broken). A patch is scheduled to be released soon, but I'd recommend 5.5 until then.

    EDIT: these are warnings and can be safely ignored.
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Note that these are all warnings. Now that 5.6 is out I should likely fix these; they don't cause any harm, but are annoying.
     
  23. BoyNoodle

    BoyNoodle

    Joined:
    May 11, 2017
    Posts:
    3
    Restart didn't help I'm afraid but I will have a go with version 5.5. Have a good trip!

    EDIT - ok, shall ignore if they are just warnings. Thanks.
     
    Last edited: May 11, 2017
  24. ajz3d

    ajz3d

    Joined:
    Oct 12, 2015
    Posts:
    31
    Jason, how can I make rain drop ripples square on a non-square mesh? Maybe I screwed something up, but they show up as ellipses instead of circles. I'm 99% sure that my texture scale and second texture scale parameters of the shader are set up correctly.
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hmm, I'll have to look at the code to be sure, but I would have expected to root scale to be based off the macro UVs.
     
  26. magic9cube

    magic9cube

    Joined:
    Jan 30, 2014
    Posts:
    58
    Hello, I'm currently trying to get this system integrated with a marching cubes procedural engine I'm working on. Usually I'd have a tri-planar material for each element type; rock, dirt, grass etc. and assign via sub-triangle collections. I can't quite figure out how to translate that method to this system. Should i still be using separate materials for these elements or just the one? Ive tried as per my understanding of the manual to use 1 material and the color alpha 1/255 index setting but no luck so far. Any thoughts, tips, links appreciated especially relating to procedural terrain.

    [Edit] Ok, i got the different textures working by using "Painted" Bottom Layered Texturing. But not blending across the different textures. Also seeing some weird glitches with the texture graph editor.
     

    Attached Files:

    Last edited: May 15, 2017
  27. Seoulsfinest

    Seoulsfinest

    Joined:
    May 9, 2017
    Posts:
    7
    Every time I drag a converted mesh into my scene its 90 degrees rotated. Is there a fix for this?

    And for us its not really clear how the map packaging works. How can we use displacements maps? What channel do we use for that on the normal packaging mode?
     
    Last edited: May 15, 2017
  28. MetalBear

    MetalBear

    Joined:
    Sep 17, 2013
    Posts:
    4
    Hi Jason,

    First off; great product. It is quite incredible.
    Using the texture array for storing alot more texture variation is really what I was looking for.

    However, I specifically bought MegaSplat for the feature that allowed objects to be blended with the terrain.
    Your documentation mentions a normal blending brush, which comes with Vertex Paint Pro. I looked it up through the added documentation of vertex paint pro. Got the NormalBlendBrush set as my brush and I dragged the right mesh into the "Blend With" slot. But I still can't paint something to blend with the terrain.

    My situation:
    • I have multiple mesh parts that, together, form my "terrain" (it is not unity terrain). They have the Terrain material.
    • I have 1 cube with some subdivision, which I want to blend with that terrain. It has the Cube material.
    Materials.jpg

    Normals.jpg

    It is quite frustrating to dig up this specific feature and get it working. It is a key element for achieving realism and as far as I know, MegaSplat is the only texture array / object blending app out there. So if you have some time to elaborate on how to use this, I would really appreciate it. I might figure it out eventually, but I will probably not be the last asking for this feature to be explained. Right now the explanation is incomplete.

    Thanks in advance. And again, awesome product!
     
    mwituni likes this.
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You need to mark the colors of each vertex in each triangle with one red, one blue, and one green color. This is described in the docs and is what the mesh converter does, as it is used to filter the texture choices. Alternatively you can use the "preprocess in geometry shader" option to do this in the geometry shader, but I would recommend doing this in your own code as invoking the geometry shader is very slow.

    I would be interested to know how you got the texture graph to glitch like that- any repro?
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The displacement data comes from the height map, which is always packed into the alpha channel of the diffuse texture. The packing modes for normals and specular components are described in the documentation, but in all cases it's just copying channels around in photoshop so that you can get more information in a single texture and thus reduce the number of samples you need to take in the shader.
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, I've been meaning to do a quick tutorial on this. Basically, the main things you want to do is ensure that your UVs, texture choices, and normals all line up at the intersection. The problem is, without doing boolean geometry operations, many of the control points for this data (vertices) don't line up. For instance, there is no geometry along the intersection point in your cube/terrain example - so the values you are trying to match are interpolated values across the face.

    So, first, I notice that you have different materials for each object- this is fine, but I notice that per-tex UV scale is on one but not the other, which means the UVs may not match exactly. Per texture normal strength is also on one but not the other, which can change normal intensity, and tessellation is on one but not the other. To start, it's likely easier to make them use the same material so that these settings are all aligned.

    The way the normal blend brush works is that as you paint, it raycasts to find a point on the target object, samples it's normal, and blends the normals of the object you are painting towards that value. This means that depending on your view angle and position, you will get slightly different results. I kept it this way because without generating geometry, there is no actual way to get the normals of an intersection to line up perfectly (since they are interpolated positions across two faces). Usually, you can paint around a bit and get them to seem up nicely.

    I'll try to get a quick tutorial done on this soon- likely not until next week, as I'm just getting back from a trip today and have a busy week..
     
    mwituni likes this.
  32. MetalBear

    MetalBear

    Joined:
    Sep 17, 2013
    Posts:
    4
    Thanks for replying so quick. I understand the alignment requirements etc. As for the materials having different UV's, I thought to set the macro texture to follow the normal UV's and the "terrain" layer to follow tri-planar projection and world pos.

    To explain the different materials; I want to use macro textures for the objects. This link is a good example of what I wish to achieve: link (I understand it works slightly different, but the same end result should be possible right?)

    So I want lots of different macro textured props, to blend with the terrain. As I understand it, I would have to create a different macro texture supporting material for each prop type?

    Another interesting technique to apply for blending objects with one another, is screen space ambient occlusion. My knowledge of shaders is not advanced, but with shader forge I sometimes use this as a way of masking. As I understand it, it is cheap way of highlighting the intersection area between two meshes. Looking at what dice has applied to their engine, it seems to blend automatically when inserting objects into their terrain.
     
    Last edited: May 15, 2017
  33. gibmation

    gibmation

    Joined:
    Dec 1, 2014
    Posts:
    311
    Yes this solved this thanks.
     
  34. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    139
    Does anyone know how to convert a regular normal map into a sao normal map? It appears most of those maps are green while a normal one is blue. I believe that's why when my textures are so shiny because the smoothness is probably cranked to 100% by default.
     
  35. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, that should be possible. Note that another option is to pack all of the macro textures into an array and paint which texture you want each mesh to use. There's an option to disable blending on the bottom layer so this has no extra cost, and you can still splat map on the top layer when you want to blend to another texture. The big advantage here is everything can remain one material.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Just put your smoothness data into the blue channel and your ambient occlusion into the alpha channel. The blue channel of a normal map can be reconstructed from the RG channels, so it's not really needed.
     
  37. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    143
    Channel Packer is a little tool that can help you to make packed textures. Take a look on my signature ;)
     
  38. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    Hi Jason, I'm sure you get asked this a lot, but what version of Unity3D do you think is stable for things like MegaSplat?
     
  39. ajz3d

    ajz3d

    Joined:
    Oct 12, 2015
    Posts:
    31
    By macro you mean 1:1 UVs unmodified by texture scale? This might be the culprit because I have UVs filling the whole UV square while the terrain is rectangular.

    screenshot_17-05-16_00_08_37.jpg
    (top down view on a puddle)

    BTW inspector becomes extremely unresponsive when I enable puddles. Even scrolling contents of inspector window with MegaSplat shader loaded into it is a pain. Is this normal?
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    In 1.08, there's a vector2 uv scale, so you should be able to adjust this as needed. Also, I believe the slowness with puddles enabled in gone in 1.07, but maybe that wasn't fixed until 1.08? I can send you a patch with these if need be, just send the invoice number to me in email.
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I do all dev in 5.4 and test in 5.5. 5.6 is currently broken, and the latest from Unity is that the fix will come in 5.6.1p4..
     
  42. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    139
    Alright I think I got it working. Not sure what I did but I think after I fixed/replaced the textures with unity still open I restarted client and seems to be working now.
     
  43. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    ah interesting. right now i do everything in 5.6.0 p4

    is there something especially broken which hinders megasplats use/features?
    for me everything I used worked pretty flawless
     
  44. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Texture arrays apparently won't work in your build.
     
  45. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    @jbooth

    +1 for a video tutorial on how to use the blending from diferent objects or terrain and objects.
    If possible maybe the different ways on how to do it for different reasons like your normal way and the two suggestions from MetalBear.

    Thank you.
     
  46. magic9cube

    magic9cube

    Joined:
    Jan 30, 2014
    Posts:
    58
    Thanks, that's working much better. Given my mesh is generated at run-time i think i'm going to require the more advanced features included in the graph editor. The graph glitch appears when i click anywhere in the editor at run-time. The glitch extends back into the unity editor proper as well and vanishes after i close the graph editor and re-run the scene. I have a static class named "World" which is maybe related somehow. v 5.5.3f1
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'll take a look and see if I can repro that glitch soon. You're static class shouldn't affect anything. So is the idea that you want to apply the graph at runtime?

    Currently there is a runtime procedural mode for meshes (you change the mode from painted to procedural 3way in the shader generator settings on the material). This will basically do two triplanar projections (one for each layer) with 3 texture clusters that gets blended with noise, and is pretty optimized (runs entirely in the vertex shader). It's not an arbitrary graph that you can customize though.

    If you want to apply a graph at runtime, you could basically emulate what the graph does; pack up the source data into a texture (vertex positions, etc) and blit to an output texture, then unpack the output values from the texture onto the vertices. However, the shader it produces is not as optimal as the built in procedural mode (though that might not matter if you're only working on 62k vertices anyway). For instance, it uses 3 octave noise functions instead of one octave ones, etc. Also, the process of mapping the data back to vertices is not going to be blazingly fast, so you'd need to amortize that across frames or something (the texture graph does this as well). But I bet you could get it all to work.

    I was originally exploring the idea of the graph being able to produce a plugin-runtime function that would run entirely in the vertex shader. However, I wasn't sure how useful that would be to people, and have instead focused on higher quality texturing and having less constraints..
     
  48. Aubrey-Falconer

    Aubrey-Falconer

    Joined:
    Feb 13, 2008
    Posts:
    438
    Thanks jbooth for this fantastic tool! Is crunch compression supported for textures referenced from texture arrays? I haven't been able to find any documentation which addresses this question, and the arrays became corrupted when I enabled crunch compression for the source image assets in a test project. Just experimenting with build size reduction techniques.
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Never tried it- my bet is that, if it doesn't just work, it's because Crunch doesn't support Texture Arrays or Unity hasn't supported them w/ crunch.
     
  50. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hello,

    at first, I'm not sure that it makes sense what I'm trying to ask. I'm working on an RTS and now I need nice terrains. My workflow is at the time GAIA(just heightmap and textures)->Erosion Painter(global apply)->MegaSplat. With some settings on the shader I'm able to configure a very nice terrain in a short time, but the terrain just looks good in the first person mode. When I look on the terrain then that's not so good. I'm still able to get some good results, but it could be better.

    1. After I map the textures (Unity terrain textures to texture array), then I see very clear the border between the textures. Before converting the textures the blending between textures is better.

    2. The lot of details, which are visible in first person view, are not visible in the top down view.

    Any suggestion for improving top down quality? Don't missunderstand me, its good but by far not that good as in the first person view.

    Some pictures, one first person view, 2 bad looking top down, 1 better looking top down:

    FP.jpg TD.jpg TD_most_detailed_angle.jpg BetterTopDown.jpg
     
    Last edited: May 19, 2017