Search Unity

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

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

  1. eat111112

    eat111112

    Joined:
    Oct 12, 2018
    Posts:
    1
    Hi, Jason.

    I recently bought MegaSplat and tried to use it with Amplify Shader Editor. I read on your website that there are two nodes can be used in ASE. However, I could not find any of them inside ASE's canvas. I wanted to ask you that if the integration with ASE is still available?
     
    Jossgasm likes this.
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Not near a computer right now, but you may have to unzip them? It’s also possible ASE has changed something with their node system; been a while since I used it.
     
  3. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi @jbooth

    I had a question about the 'distance resampling' option in the shader compiler. If enabled, am I essentially doubling the number of passes on the shader? Is this more expensive than the 'macro texture' option? Also, is it possible to enable 'distance resampling' per texture? Thanks!
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    No, it's all done in one pass, but you are doubling the number of samples needed, since it has to sample the textures at 2 different UV scales and blend them together.

    It's not possible to do something like this on a per texture basis - well, not without being slower than doing it all the time, anyway.
     
    Noogy likes this.
  5. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Perfect, thanks for the info.
     
  6. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I'm using Unity 2018.3.7f1.

    Just updated to the latest version of MicroSplat (2.5) and there seems to be a compile error in MicroSplatShaderGUI.cs.

    I'm not familiar with this code base, but it looks like line 57 should be changed from:

    string s = keywords[i];


    to:

    string s = keywords.keywords[i];


    Is this correct?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yes, I posted an update (scripts) in the discord and updated the store already, but it will take a few hours for the patch to go through..
     
    schmosef likes this.
  8. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    ok, thanks.
     
  9. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Hi.

    I have been using CTS for a few months now and have decided to change immediately. A while ago I bought MEGASPLAT. Now I notice that there is MICROSPLAT-Terrain Collection.

    My main need is to get a terrain effect as real as possible and with the best rendering possible.

    The terrains are from 8x8 to 25x25 km

    It is an all terrain car racing game that must have high resolution (only for PC)

    What can be done with MEGASPLAST that can not be done with MICROSPLAT-COLLECTION? My question is because I see that Megasplat has not been updated for some time and Microsplat is very up to date.

    Which tool do you recommend?

    Will the migration process be very critical (estimate)?

    Thank you.
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MicroSplat in this case; the main benefits to MegaSplat are the ability to have 256 textures and the ability to work on meshes. To do this, it replaces most of Unity's texturing workflow with it's own, so it's kind of an all-in package, not a simple terrain shader replacement.

    MicroSplat, on the other hand, uses Unity's standard terrain workflow. It performs several times faster than ANY other terrain shader when your using lots of textures, and has more features than any other terrain shader. It's limited to 32 textures per terrain, but can cluster those for 96 textures, which gets you pretty close to MegaSplat in all practical senses. It also has a lot more features than MegaSplat at this point (dynamically generated streams of water/lava, stochastic texture clustering, no keyword usage, etc, etc). So yeah, I'd recommend it in most cases.

    As for Migration from CTS, remove CTS, add the MicroSplatTerrain component, press convert. You'll need to add height maps and any other PBR textures you have to the config and press update. To mimic CTS's features, turn on Noise Normal, Distance Resampling, Triplanar, and tessellation if you want. Personally, I'd favor Stochastic Texture Clustering over distance resampling, and consider using the anti-tile array if you want to keep the noise normals but have a different one per-texture in your project instead of one for the whole terrain. (A lot more options in MicroSplat).
     
  11. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374

    First of all, thank you for your quick response. A thousand times better than the other provider.

    My profile is as a programmer. Therefore, I try to buy the tools that simplify my work that I do not master. The investment of money justifies, in my opinion, the time spent.

    That's why I need tools that give me quality and simplicity. That they do not need a high learning curve. I do not master textures, I do not dominate shaders. I have notions, just.

    My objective is to make stages and stages of rally and TT competitions based on real terrains (with the Real World Terrain tool). That is to say, that the texturing will not be random but will be based on a criterion (more or less approximate)

    I'm going to buy MICROSPLAT-TERRAIN COLLECTION. I believe (and I hope) that you will be able to help me in all these tasks and that it will eliminate the efficiency and communication problems that exist with CTS.

    Thank you
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Feel free to join the discord channel if you run into issues- a lot of experienced users in there that help people out when I'm not around..
     
  13. salexmatei

    salexmatei

    Joined:
    Apr 5, 2016
    Posts:
    4
    Hey I can see only No Spec Tex and No Spec Or Normal in Texture packing with 2018.3.6... ?
     
  14. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    That's correct- alternative packing models other than those were removed about a year ago in the 1.5 update. Normal now handles all the cases the old models did..
     
  15. salexmatei

    salexmatei

    Joined:
    Apr 5, 2016
    Posts:
    4
    Incredible reply speed :)

    What about megasplat_diffuse texture array? I mean I can't follow your toturial because things aren't there. It's frustrating. No offense. Any plans to do a new tutorial? This tool seems to hold a lot of power I so want to love this :D

    I'll be reading the manual then ^^
     
    Last edited: Mar 7, 2019
  16. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The manual is always up to date- it's infinitely easier to edit a manual than to re-shoot all the videos on youtube. The videos are more a development vlog than anything else..
     
  17. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Hey, When writing custom code, how do you get the vertex index? I need to access it in order to use it as an index from a procedural buffer to get vertex position.

    SV_VertexID and SV_InstanceID specifically

    Also, could the splatinput from CustomMegaSplatFunction_Final be made inout so that we can change things like wetness?
     
    Last edited: Mar 12, 2019
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I'm not sure you can get it from a Surface shader, can you? MegaSplat is a surface shader when not running with tessellation. Yes, you could easily change the API to include inout by modifying the fragment functions. I can do that next time I'm in the code, but it would be a simple change to make yourself.
     
  19. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    It would need to be part of a vertex function but it wouldn't have to include tessellation necessarily. It's okay if it does though for ease of exposing this.

    It does open up a huge amount of possibilities once you have that information. I'm planning to make a terrain that bypasses unity's mesh pipeline and keeps all the data on the gpu, which should be a lot more efficiant. Using the same methods as gpu particles.

    uniform sampler2D _MainTex;
    StructuredBuffer<ps_input> buffer;

    struct ps_input {
    float4 pos : SV_POSITION;
    float4 col : COLOR0;
    float2 uv : TEXCOORD0;
    };

    ps_input vert(uint id : SV_VertexID, uint inst : SV_InstanceID) {

    return buffer[inst];
    }

    half4 frag(ps_input i) : COLOR
    {
    return ps_input.col*tex2D(_MainTex, i.uv);
    }


    I'm still not entirely sure how/if lighting and shadows will work yet, thats the next step after i get a terrain generating on the gpu entirely.
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Actually the new terrain in 2018.3 already does this; but rather than generating vertices you just instance the same patch of mesh data ecerywhere and look up the height map and normals on the GPU. LODs are handled by using 4 of the same mesh scaled to fit one of the higher LOD. Simple and fast.
     
  21. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    I would still like to do this myself, i want to make a voxel-like terrain with this.
     
  22. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    So can you please open up the vertex instance and layerdata within the vertex function section?

    Edit: I apologize, ive been working with vertex/fragment shaders i think surface shaders have a lot of this functionality built into them but its all very poorly documented unless im missing something. I have a lot to learn in regards to surface shader Gpu instancing but i think it will mean that the index wont need to be included. However im now worried about where it would be best to edit the splat data.

    If the only point where we can edit the SplatInput and thus the height texture being used is at the end of the pipeline, then it would be after displacement, and so displacement wouldn't line up correctly with the texture. Am i understanding this correctly?
     
    Last edited: Mar 14, 2019
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There are pre and post displacement hooks if you want to modify the displacement functions. The instance ID can be gotten in a surface shader via a macro, but you will need the appdata structure for that. Easiest thing to do is make the modifications to the API you need in the fragment files, and then let me know what you ended up needing.
     
  24. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Okay, ill let you know once its working
     
  25. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Where in SplatInput is the index of the top and bottom layers?

    Edit: Nevermind, i figured this out. Do you know if its possible to edit appdata_full before vert?
     
    Last edited: Mar 16, 2019
  26. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    238
    Hi guys! Sorry if i`m asking noob question.
    I`m triyng to make gold ore deposit on the big boulders that are placed on unity default terrain.
    I don`t have any clue how to approach this problem.
    Found these pictures online
    MetaLDeposit.png
    And another variant as attached file. I have Amplify Shader Editor. Red somwhere that it can be integrated with Megasplat.
    What there ways achieve these results? How to make rocks meshes blend with unity default terrain shader and have gold veins with shining and shimmering effect on them.
    There are maybe few ways to do that. If you have any hints please share.
    Thanks guys!!!
     

    Attached Files:

    Last edited: Mar 18, 2019
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Terrain mesh blending is possible, but non trivial in MegaSplat. The process has been described more than a few times in this thread, and there's an example in the example folder, but it's not a trivial process like it is in MicroSplat.
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    vert is the first function that gets called in the shader..
     
  29. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Jason,
    My terrain brush has started painting in the wrong location. Was painting but couldn't see anything happening, when I zoomed out I saw what I painted was way out of the area I was working.

    The marker is in one spot but when I paint the terrain gets painted about 20 meters away. It was working fine, and then started doing this. I did a reboot and still have the issue.

    Any idea on how to fix?
    I was trying to work on puddles, wetness, and textures, but it is doing it with everything.

    I still have work to do on the terrain and now I'm at a stand still on the texture painting.

    Thanks.
    Using ver. 2017.4.23
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    The code to transform from screen to world space is well tested, and hasn't changed in a very long time, so I'm reluctant to think it's a code issue. The only complexity in that code is that Unity detects retna monitors and in that case you have to multiply the coordinates by 2 (which is pretty annoying, IMO, as the code really doesn't need to know about that). But that code has been the same since 5.4 I believe.
     
  31. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Yeah, it's weird. I don't know what happened. Nothing changed and it happened while I was painting yesterday. Tried again fresh today and still getting it in the wrong location.

    I'll keep playing with it. I had to update another asset, and it caused a crash. Maybe that messed up one of your files. I'll reimport megasplat and see if that fixes it.

    Thanks for responding so quickly. I'll post back if it fixes it.
     
  32. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Hey, sorry for being a bit of a nag on this.

    I've gotten the procedural generation up and running, though there is a visual bug I'm not sure about. Do you recognize this behavior? Could you point me in the direction of what i should be looking in to to fix it? There is probably some sort of value not being set but im not sure which value would cause this.

    https://gyazo.com/e2733929eec0f9842df5e28a574c6fc6

    Please let me know if you can think of anything that would cause this.
     
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I can't think of anything off the top of my head. Got any code?
     
  34. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    I managed to figure that one out, for future reference if you see that behavior again, it was in the wrong render order, set to after everything where it should have been after opaque or after lighting.
     
  35. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Ive managed to get the procedural generation working well without changing much in the shader so far, but ive come to a bit of a hurdle in regards to tangent generation. I've done a bit of research into triplanar texturing, which ill be relying on, and there are a number of techniques that don't require tangents or normals which give more accurate results than relying on built in tangents and normals in the mesh.

    https://medium.com/@bgolus/normal-mapping-for-a-triplanar-shader-10bf39dca05a

    I'd like to implement the whiteout technique described in the article above, i figure i should let you know about it because i think you could use this to improve the triplanar while freeing up data to be used for more effects to put within the normal and tangent within a mesh while using triplanar.
     
  36. lucpham

    lucpham

    Joined:
    Feb 2, 2017
    Posts:
    4
    Hi,

    I have been reading through the thread but could not find the information whether or not Megasplat supports LWR atm(on which version?)
     
    Last edited: Mar 25, 2019
  37. Captaingerbear

    Captaingerbear

    Joined:
    Mar 6, 2013
    Posts:
    57
    First, thanks so much for Megasplat. My terrains look fantastic thanks to this tool.

    The terrain I'm working on at present is essentially endless. It treadmills to keep the player near the origin so I don't wander into messy float territory, but now that I'm incorporating lava, I'm getting what I assume is a UV problem. When the terrain shifts, the texture visibly shifts as well.

    Note that this isn't occurring with any of the other textures. I am actually assigning UV coordinates to vertices manually when new terrain chunks are spawned, and I assume the lava must be overwriting them.

    If you've got any suggestions on how I can nail down the UV coordinates to avoid this, I'll be all ears.

    An animated sample of the problem.
    LavaPoppingGIF.gif
     
  38. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    I have an update on using draw procedural to create Megasplat meshes. Its so close to being usable. Currently it can cast and receive shadows using deferred rendering fine. However the problem im having now is that it only does this if it has another object behind it. Does this behaviour make any sense to anyone?

    Here you can see a megasplat plane being drawn with draw procedural, a regular plane is penetrating through at an angle, and you can see the strange behavior. Does anyone have any idea why this is happening?
     
  39. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Nope, MicroSplat has a module for it though...

    Been a while since I looked at that code, but it may be using the world position for some of it's data. That would be my guess anyway..
     
  40. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    Hi Jason, I seen Micro Splats has substance support now, is there any plans for Mega to get it back? Thanks for any info.
     
  41. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Yeah, at some point I'll port it back..
     
  42. judohurley

    judohurley

    Joined:
    Feb 27, 2014
    Posts:
    8
    Hi Jason,
    Micro Splat looks really cool, especially with the support for Substance. Sorry if this is an old question, but does or support Substance in 2018+?

    Also, is there support for meshes instead of terrain?

    Thanks.
     
  43. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    MicroSplat now has support for substances in 2018+ with their new plugin, but I have not backported that to MegaSplat yet. A mesh module is coming for MicroSplat, it's been mostly done for a while now, but it's pretty different than MegaSplat in that it uses a backing texture and requires unique UVs in a 0-1 space for the control textures, so you have to have models a bit more designed for it than with a vertex based approach.
     
  44. judohurley

    judohurley

    Joined:
    Feb 27, 2014
    Posts:
    8
    That sounds good. For my case I'm procedurally generating my meshes, so I'm fairly confident I could adapt the uvs according to your specs. I'm already generating multiple uvs as it is. I'll keep an eye out for the mesh module announcement. Keep up the great work!
     
  45. Captaingerbear

    Captaingerbear

    Joined:
    Mar 6, 2013
    Posts:
    57
    That seems like a reasonable guess, maybe I'll dig around in the shader code and see if I can adjust it without breaking everything.
     
  46. AndreyO

    AndreyO

    Joined:
    Jan 31, 2014
    Posts:
    20
    Hi!
    Unity 2018.3.10f1
    Terrain Paint can't load Texture Array Config
    upload_2019-4-1_12-0-32.png

    upload_2019-4-1_11-59-20.png


    upload_2019-4-1_11-58-30.png
     

    Attached Files:

  47. Harjawalda

    Harjawalda

    Joined:
    Sep 1, 2018
    Posts:
    15
    Hi Jason, I'd like to know if it's possible to utilize microsplat terrainblending with speedtree models. Applying the mesh blending plugin to the tree model applies the blending to the leaves it seems.
     
  48. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    It applies it to the first mesh in the mesh list- this isn't something I can change, it's the way unity draws- but if you can reorder the submeshes then it would fix it.
     
  49. INLU

    INLU

    Joined:
    Apr 15, 2017
    Posts:
    5
    Problems with painting water on an uneven surface. Water just lump on top of my textures. As a result, I get the form of parabolas on the plane, mostly up ... Even my terrain is not flat, then painting the water to the top is getting worse. I can not control the water, the height is different, and this function of water is applied differently. Only 1 layer of water, I can not do several types of water on my terrain. Some areas with mixing through the height map, in general, water can not be applied.

    MicroSplat Streams
     

    Attached Files:

  50. INLU

    INLU

    Joined:
    Apr 15, 2017
    Posts:
    5
    When I set height filters, I get even more problems. Mixing is reduced if my area is pico-shaped, that is, it has mountains. The higher in the mountains, the less influence of this function. And the lower, respectively, the greater the bulge. I think this is all because of the slope function that you used as the basis for texturing.