Search Unity

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

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

  1. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    Great thanks, let me know!
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    Fixed for the next patch..
     
  3. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    Perfect. Thanks!
     
  4. Mirraraenn

    Mirraraenn

    Joined:
    Jul 11, 2018
    Posts:
    9
    Hi Jason, long time no see. Picked up the MicroSplat Terrain Collection and just wanted to give you a heads up that importing that asset collection into a fresh project on 2019.2.14f1 on Windows 10 results in some shader errors for the sample content. It seems to be a first-time import issue as I can resolve it by going to both of the affected materials and toggle a shader property on and off to get your custom compiler to recreate that specific example shader, which resolves the conflict between the two shaders.

    upload_2020-1-19_10-57-56.png

    I don't know if the error below on binary to YAML conversion is related to the initial shader compiler issue or the examples. A quick google search leads me to believe that it relates to potential conflicts between Unity's native serialization of binary and text content and that users see this most often when that mode is set to Force Text, which I usually have set to be able to track changes more easily in git.

    upload_2020-1-19_11-13-4.png
     
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    I'll recompile those before the next release. Odd that those errors don't show up for me, but simple enough fix. The YAML thing doesn't seem to cause any issues, only shows up in newer Unity's, and complains about types I don't actually use in MicroSplat (uint16 and such), which leads me to believe there's not a ton I can do about it.
     
    Mirraraenn likes this.
  6. julesd

    julesd

    Joined:
    Sep 30, 2016
    Posts:
    15
    Does One Batch work with URP and HDRP?
    And also Skinned Meshes?
     
  7. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    No, standard shader only. It does support skinned meshes though.
     
  8. julesd

    julesd

    Joined:
    Sep 30, 2016
    Posts:
    15
    Being that standard will be removed from Unity at some point, I plan on sticking with URP and HDRP for my projects, thanks anyway.
     
    Last edited: Jan 25, 2020
  9. Mirraraenn

    Mirraraenn

    Joined:
    Jul 11, 2018
    Posts:
    9
    I'm attempting to try out the Triplanar module in the terrain collection with a brand new `MicroSplat` material, it only seems to pick the second texture in the `MicroSplatConfig` and for the life of me reading the documentation and looking at the example content I cannot see how to change any of the parameters or config to do the proper mapping. Is there something wrong with how I am attempting to use this module?

    Repro:
    1. Create a new `MicroSplat` material.
    2. Add three textures to its `MicroSplatConfig` and select Update.
    3. Enable Triplanar Mode (Triplanar or Height Blended) with default World space.
    3. Add `MicroSplat` material component and material to a terrain.

    Expected:
    Triplanar projection is rendered with three textures mapped.

    Actual:
    The second texture in the `MicroSplat` config is rendered across the entire terrain.

    upload_2020-1-26_11-10-23.png
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    You are confusing Texture Clusters, Triplanar Projection, and Triplanar Texturing.

    Texture Clusters allow you to use up to 3 variations of textures for each texture by packing multiple texture variations into multiple texture arrays. Essentially you have three variations on a theme which are constantly blended based on a noise function providing huge variations of texture across a surface.

    Triplanar Projection allows you to sample each texture from a top, front, and side projection and blend them in order to avoid stretched UVs. MicroSplat allows you to blend these either with linear blending or height map blending.

    Triplanar Texturing is a technique where you have separate top, sides, and bottom textures and texture the mesh based on those projections/textures. This the top projection is "Grass" and the sides are "stone" and the bottom is "dirt".

    Currently MicroSplat supports Texture Clustering, and Triplanar Projection, but not Triplanar Texturing (which I'm not sure what you'd need that for, especially since terrain has no bottom and having different top/side textures would be a rather strange way to texture a terrain). If you wanted, you could achieve this effect using the Procedural module by using a slope filter to texture the top/sides differently.
     
    Last edited: Jan 26, 2020
    Mirraraenn likes this.
  11. Mirraraenn

    Mirraraenn

    Joined:
    Jul 11, 2018
    Posts:
    9
    Thanks for taking the time to clarify that, It sounds like I was definitely confusing different techniques. Working with terrain rendering isn't something I work with very often, but I'm excited to see how I can utilize MicroSplat to create good-looking, performant ones.
     
  12. Ishizuke

    Ishizuke

    Joined:
    Jan 27, 2015
    Posts:
    37
    Currently I have experienced the problem with too many keyword in shaders (256 global keyword limit), so Megasplat shaders are reported improperly compiled. Like

    "Maximum number (256) of shader global keywords exceeded, keyword _DISABLESPLATSINDISTANCE will be ignored.You will have to delete some shaders or make them use less keywords."

    The docs says however, what currently 64 local keywords are allowed
    https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html

    The topic says about "shader_feature" and "shader_feature_local", but I don't know (not very familiar with shader programming), is it possible to replace #define directives in shader code by something else to make these identifiers local.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    The new local features are only available on newer versions of Unity, so it would have to handle it differently for both versions. That said, MegaSplat doesn't actually use shader_feature to compile its shaders, it just uses the keyword system as storage for options. In MicroSplat I changed this to use my own system and removed the need for any shader keywords, but I currently have no plans to do this for MegaSplat. A possible hack fix would be to just strip all the MegaSplat keywords from your materials at build time and restore them after the build.
     
  14. gghitman69

    gghitman69

    Joined:
    Mar 4, 2016
    Posts:
    81
    @jbooth
    hi I bought Stochastic Height Sampling Node for Unity's Shader Graph
    I have 3 error
    Assets\StochasticNode\Editor\StochasticSamplingNode.cs(515,34): error CS0103: The name 's_TempSlots' does not exist in the current context
    unity 2019.3 help me please
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    Can you try importing into a fresh project?
     
  16. gghitman69

    gghitman69

    Joined:
    Mar 4, 2016
    Posts:
    81
    yes new project 2013.3.0.f6 urp just import Stochastic
     
  17. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    Ok, maybe they changed something in the latest release, I'll check it out..
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    Yeah, looks like they broke everything- again.

    I'm removing the package- Unity has been aggressively making it difficult to support their stuff - basically moving the API to private so the only way to get access to it is to hack the assemblies, effectively locking everyone out from extending their systems. Given that it takes hours of work to figure out what they've changed, it's just not worth the time to support Unity's shader graph.

    Use Amplify, it's way better than Unity's shader graph, and quite frankly Unity never finishes their systems anyway, so don't ever expect that Unity's stuff will catch up. I believe you can get a refund for something like 30 days once a package is deprecated.
     
    Last edited: Jan 30, 2020
  19. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    Hi, Is there an easy way to copy scenes without Microsplat going completely crazy linking to terrain layer materials on other scenes. No matter what I do, I can't the "Grab from Scene terrain" or "Update" seems to constantly find the copied scene. Starting from scratch dumps all my materials and other info. I've tried to add in the new scenes microsplat terrain layers but once I hit update boom back to old scene again.


    Also, is there not a way to prevent the one tick update on that Microsplat material. It takes a long time to tick each thing and wait for it to process. An update button at the bottom would be ideal if at all possible.
     
    Last edited: Feb 4, 2020
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    If you copy a scene your copying the references to the terrain layers, texture arrays, materials, etc, etc. If you want to setup a different scene with it's own data, the easiest way is to resetup the terrain so it generates it's own MicroSplatData directory with shader/config/etc.

    Right now it recompiles the shader after every update- a way to disable that has come up before, but my fear is that new users will basically get confused about it after randomly clicking things and spam me with 1 star reviews for things not working because they have turned the auto update on the compiler off. Yes, seriously, this is what I have to think about. The workaround if you have a standard set of options you want to set is to set them in the keyword file directly then cause a regeneration of the shader and it will compile with all those options set at once.
     
  21. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    Hi Thanks for the quick reply. So there is no way to avoid the terrain layers linking to the copied scene data? I'd love to be able to access that as the rest seems to work just fine when I copy a scene.

    The shader issue isn't all that bad, I just discovered you can copy the data from one microsplat to another and just delete the splats and regenerate them. This seems to work so far.
     
  22. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    Just checking back to see if you have an answer. Thanks
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    None of this is MicroSplat specific, unless I'm misunderstanding what you're asking- if you copy the scene, everything in that scene that references an asset is still going to reference that asset. If you want to change that you'd need to copy all the assets and relink them all.
     
  24. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    I don't know how else to go about this. I'm sorry this is important for me to figure it out. The layers that microsplat creates(terrain layers) are locked up when I copy a scene. They seem to be bound to an asset that microsplat creates and I can't seem to find where I change this. I could just be doing something wrong. If I remove microsplat and try generating this by scratch, the painting and terrain details are removed, so not only is it about reattaching my paint texture layers, but I also need re-draw the entire scene from scratch. The only thing that seems to be retained is the heights if I remove Microsplat. If you had a way to unwrap microsplat to Unity default then I could go backwards and work this out, but I can't seem to find a solution.

    To see what I'm talking about If I open up the new scene I just copied, and view the unity terrain and choose paint textures. I then click on a layer which is now duplicated by microsplat and renamed something else. If I click open it refers all the way back to another scene that I copied from. If I make changes it will mess up that other scene since they're linked. If I was to copy scene after scene I'd have one terrain layer for all of them. Instead of adding one by one each layer over and over for hundreds of scenes I simply copy them.

    To copy a scene in Unity all you have to do is copy the entire folder, and drop the copied terrain inside the editor. You have to delete the old terrain as it is unfortunately linked to the asset as you said. This links the assets up to the new scene you just copied properly. Microsplat doesn't actually do the same in this case. It holds the old information so I've not found a way to fix that.

    I hope this is more clear. Thanks for your help.
     
    Last edited: Feb 4, 2020
  25. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    MicroSplat doesn't have anything to do with which textures are painted on the terrain- that's all stored in the terrain data object (which can be stored in the scene or on disk). It changes the basemap distance, which when you remove it needs to be reset. On versions from 2018.3 up, which have external terrain layer objects, it creates its own terrain layers if they are not existing; all texture management happens through the texture array configs instead of Unity's interface (because Unity's interface is non-extensible and doesn't have slots for all the textures that are needed), and it will create new layers as needed. MicroSplat stores all of its data in a MicroSplatData directory, once you assign the template material from that directory to a new MST component, it will find or generate any of the data it needs in that directory as needed- but if you're copying the data it will still have references to the old data (which you can find in the debug rollout).
     
  26. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    I made a video below hopefully you can pin point me to what I'm doing wrong. As one scene I've been successful at doing what I want. I thought I did all that you mentioned before even asking for help so I'm perhaps just missing something really small.
    I'm using Unity 2018.3
     
    Last edited: Feb 5, 2020
  27. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    Hmm, ok, so it's just the terrain layers. I don't think Unity exposes them as an editable list anywhere. If you are going to create unique textures for this version of the terrain, create a texture array config and generate a new diffuse/normal arrays with whatever textures you want in them. When you assign them to the terrain and press sync, MicroSplat will generate and assign a new set of terrain layers for your terrain in the MicroSplatData directory. It's not generating them now because the ones you have still match the source textures of your copied texture array config, because you haven't changed it at all and that would just waste memory.
     
    Cover-Club-Media likes this.
  28. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    65
    Ok that worked! Once I removed one from the list as you suggested and hit update every other texture linked to the correct folder inside the scene. I was able to replace the missing one with a copy of the terrain layer microsplat makes form the other folder and moved it over. Thanks for your help that helped a lot.
     
  29. zvladimir90

    zvladimir90

    Joined:
    Dec 16, 2019
    Posts:
    2
    @jbooth Have purchased stochastic for amplify shader. I get an error with every new shader I make
    Shader error in 'effect_hightmap_test': failed to open source file: 'Assets/AmplifyStochasticNode/StochasticSampling.cginc' at line 18 (on d3d11) (sometimes line19, sometimes line 20)
    Even editing your example by adding a simple multiply node gives me the error.
    This seems to be happening when I change the shader in play mode, creating a shader in editor mode and pressing play seems to work fine. the problem i i work on a project that has procedural terrain that only appears in play mode, so im am unable to utilize the stochastic node properly.
    Im using the latest unity (2019.3.0.f6) and the latest version of amplify shader editor.
     
  30. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    did you move something after the install? It can’t find the path to the cginc
     
  31. Enigma229

    Enigma229

    Joined:
    Aug 6, 2019
    Posts:
    6
    Will Megasplat allow me to control where different textures go by slope, height, etc?
     
  32. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    There's a graph based approach for that, but personally I think the MicroSplat module is easier for most people (as is most of MicroSplat)
     
  33. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    403
  34. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,864
    ibbybn and dsilverthorn like this.
  35. zvladimir90

    zvladimir90

    Joined:
    Dec 16, 2019
    Posts:
    2
    You are right. sorry for the confusion, moving it back to the asset folder works.
     
unityunity