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. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Hey, sorry, this got lost in the shuffle of my laptop being stolen. I took a look this morning, and it appears to be some interaction with the height map blending of the height maps producing the undesirable look. I notice that if I adjust the interpolation contrast, the shape of those edges changes considerably- I also noticed that if I manually paint on the layers instead of using the brush's auto mode, I tend to not have those issues either (though they can be created). My best guess is that the auto mode, which attempts to paint on the lowest weighted layer, is effectively causing it to flip back and forth between the textures rapidly, and because of the way the height maps are interaction you end up with these kind of "left over" bits of grass creating a channel between the areas. A bit hard to explain, but I hope it helps..
     
  2. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @jbooth !!! Thanks for the reply.
    Frankly I do not know if he has given me a solution to fix it. My English is very basic and I am not able to see the solution within your explanation. So I do not know if your explanation helps me or not to fix the problem ...

    Do you plan to fix this problem with an update?

    regards
     
  3. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Well, no, it's based on your data, so I can't really fix it..
     
  4. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    76
    When I disable Terrain Blending checkbox on the MiscroSplat shader, it rebuilds but the scene still looks the same (blended). Do I have to manually remove all of the blending scripts and materials to get the objects to render normally? I'm looking for a way to manage this at runtime for increased performance.
     
  5. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    What data do you mean? What have I written you for messages? or to the data of my textures that could be wrong and that is why MegaSplat misinterprets them?

    I'm telling you because as you asked me, I sent you a private message with a project so you could test the problem, and I do not know if you've seen it.

    This problem is very annoying and totally breaks the visual realism of any scene.
    What can I do when this problem appears in all the projects that are created with MegaSplat ??? Since it does not appear in a single project ...
    The project that I sent him privately believes only to send it, but I have about 4 more projects that have MegaSplat and where the same problem always appears, but they are too heavy to send them to you. So create a new one to send it to you privately.

    With this problem I am forced to not be able to use MegaSplat in any project since this error always appears ...

    Sorry my bad English
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, you need to remove the second material from the objects and remove the blending component as well, ideally.
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Re-read my message above; I opened your project and wrote to you what I found.
     
  8. Goodgulf

    Goodgulf

    Joined:
    Jan 12, 2016
    Posts:
    59
    For anyone who's interested to try out a Unity Mesh Terrain with MegaSplat: you may want to check the tutorial I made. It could save you some time figuring out the steps.
     
  9. se_carri

    se_carri

    Joined:
    Nov 2, 2016
    Posts:
    2
    Hi there,

    I've opened an empty project with Unity 2018.4.4f1 and I've imported Megasplat.

    After that I tried creating a terrain, and using the terrain painter tool under Window > Terrain Painter, I painted the terrain with the example array textures. After saving the scene and saving the project, closing, and reopening, the terrain had lost all the painted information. It looks like it's not saving the Splat Texture properly.

    Am I doing something wrong or is that version of Unity not supported?

    Thanks in advanced,

    Sergi
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Press the SAVE button in the painter..
     
    se_carri likes this.
  11. se_carri

    se_carri

    Joined:
    Nov 2, 2016
    Posts:
    2
    Thanks !

    I was coming from the Vertex Painter Pro tool and even though you mention it in the doc I just couldn't see it under the brush dropdown menu. It'd be cool to have under fill or something.

    Really appreciate the quick response,

    Sergi
     
  12. CherstvyDmitriy

    CherstvyDmitriy

    Joined:
    Jul 19, 2017
    Posts:
    25
    i have a question. Does your asset suport instanced rendering? is it better then vegetation studio pro?
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    My asset doesn't render vegetation; it complements something like VST not competes with it.
     
  14. ajaxlex

    ajaxlex

    Joined:
    Jul 15, 2016
    Posts:
    38
    Hi @jbooth - thanks for a great tool in microsplat. I am using the base microsplat asset plus a number of the add-ons. I am applying texture maps to MapMagic terrain. I'd like to use the terrain-blending extension to better integrate some rocks into a shoreline, but I have one immediate issue, and one potential issue.

    I have installed the terrain-blending extension, and updated my material, checking 'terrain-blending' option. Then selected a pinned MapMagic terrain and selected the "Update Terrain Descriptor Data". Then I attempt to add the "Micro Splat Blendable Object" script to my target object, but I'm notified - "Terrain Shader is not setup for blending, please enable this..." etc.

    I will note that the terrain object Micro Splat Terrain Object component includes 2 custom splats, and in its Debug area, the Blend Mat is empty.

    Using Unity 2019.1.10f1, Shader Generator v2.6, Microsplat, Alpha Hole, Terrain Blending, Triplanar.
     
  15. ajaxlex

    ajaxlex

    Joined:
    Jul 15, 2016
    Posts:
    38
    Haha oops - forgot to add the second potential issue - I am guessing that MapMagic will need to generate the blend textures whenever it finishes generating a new terrain. Maybe Denis has thought of this, but if his node doesn't account for it, do you have any advice for invoking the generation of the blend texture? Thanks in advance!
     
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, it’s not going to work without generating that data and assigning a blendMst. The data is basically a hight map and normal map packed into a 16bit texture, and you can find the code which generates it and see how it’s done.
     
  17. viceca

    viceca

    Joined:
    Nov 10, 2016
    Posts:
    14
    Hi there @jbooth, I've found an issue when enabling the option "Draw Instanced" on the terrain when using the Megasplat shader, making it to not render, after some research and fiddling I've managed to get it to render by adding the pragmas:
    #pragma multi_compile_instancing
    #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
    and setting up the instancing on the vert part
    UNITY_SETUP_INSTANCE_ID(i);
    But this get it to render with no normals / flicker the color of the terrain, have you experienced this already?
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, there is no support for instanced drawing in MegaSplat right now.
     
  19. viceca

    viceca

    Joined:
    Nov 10, 2016
    Posts:
    14
    Ah, ok, are there any plans to support it?
     
  20. viceca

    viceca

    Joined:
    Nov 10, 2016
    Posts:
    14
    @jbooth after tinkering with it for sometime, I've managed to get it to work as I expected by:
    - adding these pragmas:
    -- #pragma multi_compile_instancing
    -- #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
    - adding "addshadow" to lighting pragma
    - and setting tangent to float4(1, 0, 0, 1) in the vertex part
     
    Bzuco likes this.
  21. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, that will work for the surface shader pathway, but not the vertex/fragment shader one. You'd also need to add the functions to sample the per pixel normal map as well, which you can find in unity's example.
     
  22. Azzuriel

    Azzuriel

    Joined:
    Jun 6, 2018
    Posts:
    3
    Hello jbooth,

    I am thinking about buying your product MegaSplat. I want to texture my procedurally generated meshes (terrain) in the Entitas Framework at runtime (e.g. Splatmap/Steppness). Since the whole thing is deployed with spatialOS, the Unity Editor namespace is poison for the project.

    Hence my question: Can I control the functionality described in your documentation exclusively at runtime and over the source code and this without having to use the Unity Editor namespace?

    Also, my meshes only exist at runtime, so I could only convert them to their data format using source code?

    I am using Unity in version 2018.3

    Thank you for your help.
    Best Jan
     
    Last edited: Jul 31, 2019
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, but you will either have to generate the required colors on the mesh at runtime, or you can turn on an option which does this in the geometry shader (slower, not available in Metal). Once that's done you can write your splat indices and weight into the vertices.
     
  24. Azzuriel

    Azzuriel

    Joined:
    Jun 6, 2018
    Posts:
    3
    Okay, all right, that sounds good. I'll try to implement your solution in our Entity Component System this weekend. Do you have an eMail how I can reach you? Thank you. Best wishes from Hamburg Jan
     
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, it's listed in the source files, but you can also DM me here..
     
  26. Azzuriel

    Azzuriel

    Joined:
    Jun 6, 2018
    Posts:
    3
    Good Morning,

    I bought your product yesterday. Can you please send me some code examples of how I can pre-process, convert, and use my Runtime Mesh? I'd also appreciate a simple example which uses code to create your platmap with just 2 textures, assigns the procedural runtime material and passes it to the mesh renderer. The editor functionalities are not available to me. Your Youtube videos explain many things very well, but always go back to the editor UI. Also in your documentary I don't find any code examples.

    thank you,
    best Jan

    P.S. As long as I control everything from the unity editor ui with your meshes, everything works fine, but this is not my goal.
     
    Last edited: Aug 21, 2019
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    All of this can be found already in the code base. For instance, there's a runtime painting example which will show you how to modify the mesh or terrain at runtime in an efficient manner. The converter code is also there, or you can use the option to process the mesh in the geometry shader.
     
  28. luellasfpg

    luellasfpg

    Joined:
    Jan 23, 2019
    Posts:
    16
    Hi, I recently bought the Stochastic Height Sampling Node for Amplify Shader Editor. I'm currently using texture arrays as input for a custom terrain shader, but the stochastic height node seems to only take a texture object node as input. Is there any way to use texture arrays with this node?

    Annotation 2019-08-12 140124.png
     
  29. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Not currently..
     
  30. luellasfpg

    luellasfpg

    Joined:
    Jan 23, 2019
    Posts:
    16
    Well, good to know. Thanks! Not currently... does that imply maybe in the future?
     
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No current plans.
     
  32. ncho

    ncho

    Joined:
    Feb 1, 2014
    Posts:
    99
    Trying to bring up Vertex Painter Pro in 2019.1 basically crashes my Inspector (it becomes unresponsive and then turns entirely black when resizing the frame). Any advice?
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Strange, I did a test on 2019.1 on OSX and had no such issue. Can you try it in a fresh project?
     
  34. JacobDSiler

    JacobDSiler

    Joined:
    Feb 10, 2018
    Posts:
    5
    Is there a way to change terrain textures based on Enviro weather?
    Perhaps even an integration?
     
  35. kelna2

    kelna2

    Joined:
    Nov 26, 2016
    Posts:
    3
    I recently have started the process of upgrading my game to LWRP and Unity 2019.2. I have Microsplat Core, Terrain Blending, and Microsplay LWRP installed and I'm getting this error when exporting to WebGL:

    Code (CSharp):
    1. Shader error in 'MicroSplat/Example': macro 'SAMPLE_DEPTH_TEXTURE' passed 3 arguments, but requires 2 at Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Shadows.hlsl(154) (on gles)
    2.  
    3. Compiling Vertex program with UNITY_PASS_SHADOWCASTER
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_RGBM_ENCODING
    5.  
    I have some other errors I'm working through as well so I created a brand new unity project using the LWRP template and imported the above packages off the asset store. And I'm getting the same error when I build to WebGL

    I'm not sure where the problem is coming from. Here are some screenshots of the error and my settings in Microsplat




    Any ideas of what I need to do to fix it?
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Do the error is from sampling a depth texture which MicroSplat never does. My suspicion is that one of Unity’s includes has an unused function with this macro in it, and that it doesn’t compile in webGL. Have you tested on a pc build?
     
  37. kelna2

    kelna2

    Joined:
    Nov 26, 2016
    Posts:
    3
    Just tested the brand new unity project and windows build works fine without any errors:


    Do you want me to send you the brand new project files? It's literally just Unity 2019.2 LWRP Template + Microsplat Core + Microsplat Terrain + Microsplat LWRP switch build target to WebGL
     
  38. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Not much I could do about it since the bug is likely in the LWRP include files, as I don’t use that function. You should file a bug with Unity..
     
  39. dzlucas

    dzlucas

    Joined:
    Nov 2, 2016
    Posts:
    12
    Jason,

    I've seen this mentioned in the thread but couldn't quite find what I was looking for so:

    I used to use MegaSplat for my procedural generated terrain (voxel engine, not height map) but I have since converted my engine completely to the GPU. I generate a structured buffer of vertices in a compute shader (each has position and normal) and I've been passing them to a vert/frag shader I wrote myself to display the terrain, but it's no MegaSplat... so my question is if it is possible to pass a generated buffer like this to a MegaSplat surface shader (if the vertices have the correct required data)? Or do I need to change the format I'm generating? I unfortunately don't know much about have surface shaders work so I don't know how to feed it data or the format it requires. Thanks.
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, the format is described in the docs; but each face will need one red, green and blue vertex (or the shader can do this in the geometry shader, but that’s slower). Then the splat weight and indexes are stored in the UVs.
     
  41. dzlucas

    dzlucas

    Joined:
    Nov 2, 2016
    Posts:
    12
    Yes, that is how I implemented it when I was using meshes and it worked great. But to be clear I am no longer using unity meshes and working only on the GPU side, generating the data in a compute shader as a StructuredBuffer of vertice data. I need to bypass the CPU and send this buffer over to the MegaSplat shader. Is this possible without using a Mesh, if the "vertice" data type is defined properly? Or do I need to have a Mesh for Megasplat? Sorry if my question is unclear.
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    As long as the shader gets the vertex data on the correct format it should be fine.
     
  43. dzlucas

    dzlucas

    Joined:
    Nov 2, 2016
    Posts:
    12
    So for this case would you recommend editing the surface shader code directly to make use of a StructuredBuffer? i.e instead of using "i.vertex" from appdata_full, do something like "vertexBuffer[id].vertex" where vertexBuffer was populated by my compute shader. -- or is there a better way you know of to pass the data without hand-editing the shader code?
     
  44. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You’d want to edit the fragment files so that regenerating the shader preserves the changes. You could also add it as an option as well.
     
  45. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Haven't used MS in a while but we have a new game with a specific need that I'm curious if MS would work well for.

    It's a custom delaunay triangulated terrain mesh with no shared verts. Hard edged but textured with normals, a stylized look.

    Currently I have a simple planar shader, since we start with a unity terrain and then convert it, I'm just creating the global texture from the splat map right now.

    But what I want is to hand paint it with normal support and all. And if I remember correctly MS would handle this I think? We don't want triplanar shading, the style is colors should blend over edges not the distinct color per face of typical faceted looks.
     
  46. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Should work fine for that..
     
  47. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    So trying it out now on our meshes, just using one of your demo scenes and dragged in the mesh and applied the material your demo meshes were using and using the example brush. But I can't paint on it, painting just has no effect.

    Thought maybe our mesh needs to go through your conversion process, but it's procedural so your editor utility doesn't work on it.

    Ideas?
     
  48. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    In the vertex painter paint tab, what channel should that be on? It's defaulting to UV3_Z.
     
  49. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I found your mesh conversion static method and ran our mesh through that, still can't paint. Must be missing something simple.
     
  50. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    So switching to the example mesh material from the example procedural material and now it paints and fill works. But something is horribly wrong tiling is really screwed up and it paints outside the brush area, filling whole triangles outside of the brush hard to describe.

    upload_2019-9-10_21-24-59.png