Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

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

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

  1. azukaar

    azukaar

    Joined:
    Jun 3, 2013
    Posts:
    1
    Hello!

    I was interested in this asset but first I wanted to make sure it is suited for my usage.
    I currently generate a cubic voxel world using submeshes to split materials and I thought using MegaSplat could reduce the number of draw calls as well as providing texture connection abilities, but I have a few questions.
    - It seems to be using RGBA diffuse channel for mapping texture, can I use, say, UV4-7 for it instead? I actually do use the RGBA channel for texture color variation
    - The shader can load up to 256 textures, does that mean 256 per shader or per mesh? I would most likely have more than 256 blocks available, in that case is this going to be a blocker? If yes, can I use sub meshes in range of 256 textures? (ex: sub mesh for 0-256 then another one for 257-512)? Can I still connect texture between two submesh with 2 different instance of the shader?
    - As far as I understand I should use the node in Unity's UI to feed the textures to the shader, but can I actually load the texture at runtime? In my case I would like to do something like getAllBlocks listing all the block available at run time, and generate the shader. Is this do-able?
    - Which feature will I be unable to use as part of a procedurally generated mesh? (Outside from the obvious with the brush) I'm guessing things like flow maps
    - Are those 256 individuals textures or individual materials (ex: if Lava is part of it, can I give it different material shading options)?
    - I am using different UV scales per blocks (ex: the grass repeats every 4 blocks but the folliage every 2 blocks) will this break the connection?
    - Can I individual set which material can connect smoothly and which needs to have a hard line?
    - Can I manage things like non planar geometry? I have cubes with non connected faces (as in each face of the cube has 4 individual vertices) and sometime (ex: plants and folliage) those are crosses instead of cubes, do I need a separated strategies for them?

    I appreciate this is a lot of questions, thanks in advance for your help
     
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    You'd have to rewrite the shader system to do the lookups in the new UV locations, but it doesn't really matter where they are stored. Right now it uses UV0-4 and color for everything, because 4-7 were just added by Unity. Thought it's likely easier to add your colors to the UVs instead- less code to change.

    So the shader limits to 256 because vertex colors are often truncated to a fixed precision. If you were to store the same data in a UV channel you could have up to 1024, because thats the maximum allowed textures in a texture array. This is for each mesh, so yes, you could have one submesh use a different set of textures than the next.

    Unity doesn't allow shader generation at runtime, but I don't think you'd need to generate a shader - because that can be fixed regardless of what texture you use. To pack the textures at runtime you'd have to generate a texture array with the appropriate textures in them. What I usually suggest people do when they want to dynamically load and select textures, in some kind of user generated content way, is to pack all the textures into various texture arrays however it makes sense for loading, then Graphics.Blit into the actual array from the source arrays at runtime- that way you can still use my preprocessor to get the textures all into the correct formats and such, as the formats are not what people are used to for speed/quality reasons.

    The data for all of that is read from the vertices, so as long as you paint the vertices with the right data it won't care. You might want to look in the docs (linked in the asset store) as your mesh needs to have some data in the color channels to work (a preprocessor is included, but when generating at runtime you'll have to provide this data), and the format for everything is also described there.

    One material, 256 different textures in use. Effects like Lava are procedural and don't take those texture slots.

    Per texture UV scales are available, so as long as the scale is associated with a texture choice it should be fine. Interpolation between textures is based on the height maps, so you could try to create hard edges by messing with the height maps, but in general it's going to create an edge based on the height maps (note there is a blend factor called interpolation contrast to control how blurry this is). MegaSplat doesn't really care about your topology and works on arbitrary meshes, as long as the color channels have the required information on them.
     
    azukaar likes this.
  3. nlaha

    nlaha

    Joined:
    Mar 14, 2015
    Posts:
    2
    I tried restarting and reinstalling and it's still giving me that error.
     
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Somehow the assemblies aren't getting patched. You might need to clean your library folder? Hard to say..
     
  5. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    42
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    No, the custom function node is not sufficient to perform the task; it doesn't allow people to have options on their nodes, and would essentially turn the single node I provide into 27 different nodes to handle all the different options. Unity talks up the custom function node like it's a replacement for a proper API (which they have and closed off) but they are totally wrong about this, and it's another sign they don't understand their users or dog food their own products. If it was sufficient, they'd remove all their custom nodes and just use the custom function node instead, right? Lame.

    So what happened is unity closed down the node API to try to force people through this route in 2019.1, and everyone who wrote custom nodes was forced to hack the assemblies on load to get access to the internal API. It's possible that the assembly hack has failed and simply uninstalling and reinstalling it will work, or they changed something about the internal API- I will test once 2019.3 is out of beta. My suggestion is to use a proper shader graph like Amplify and abandon Unity's closed system for something more stable and extensible by the user. It's a better shader graph anyway, and I'll happily refund you for the unity version if you'd prefer the amplify version instead.

    Every day Unity manages to make writing shaders a little more difficult.
     
    KeithBrown likes this.
  7. bodzi0x95

    bodzi0x95

    Joined:
    May 16, 2018
    Posts:
    12
    Hi,
    is there any option to delete microsplat and go back to default unity terrain system without loosing all textures painted on it?
    Don't asky why, I think microsplat is great but we have more issues than advantages and no time to fight with it, and we don't even use 1/10 of its functionality :p.
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Yeah, just turn the basemap distance back up.. It doesn't edit anything about the terrain texturing.

    Can you post whatever issues you're having?
     
  9. bodzi0x95

    bodzi0x95

    Joined:
    May 16, 2018
    Posts:
    12
    To be honest it's too long to write, I mean - we have started using it during development when we had some parts of our game done and one of many issues was for example using microsplat with multiple terrain tiles (unity system) was terribly slow and painting textures from one tile to another didn't work well (something like the terrain layers were changing order). Sometimes terrain was loosing material in editor or only in build.. Ofc everything was easy to fix but still I'm only person in team who know how it works and I have a lot of other work as a 2d/technical generalist, too much to run from one to another team member and fixing it.
    Maybe it's because we didn't use it from the beginning and our project was simply not adapted from the beginning to work with all pbr textures and other features (and also I didn't have time to make all our textures to work with height maps). However asset is great and despite all issues I had, I'd recommend it to everyone (way better than CTS in my opinion).
     
  10. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Painting is entirely Unity's tool set- the painters I provide (for streams, etc) work fine over multiple tiles. So it sounds like your issues would have been the same regardless of what shader you used.
     
  11. bodzi0x95

    bodzi0x95

    Joined:
    May 16, 2018
    Posts:
    12
    I made the same terrain tiles without microsplat and it works, so as I said maybe it was problem that we tried to implement it during development and few people working with those files. Unity sometimes is weird.
    Anyway, thanks for reply and I will experiment with microsplat for sure, but maybe in next game or when I will have more time :p.
     
  12. dzlucas

    dzlucas

    Joined:
    Nov 2, 2016
    Posts:
    12
    Hey Jason,

    What would be the best place in the MegSplat_procedural shader to modify JUST the output position of a vertice, without effecting the shaders calculation of height / world space for the textures (I'm using triplanar) and height-based noise?

    I'm working on a GPU-only game where I keep my camera at the origin and modify shaders to move vertices around the camera. I modified the MegaSplat_procedural frag files to do this, and it technically works, but the textures move all over the place when I move around since modifying the position also threw off all the UV functions. Right now I'm changing the position at the top of vert() underneath "UNITY_INITIALIZE_OUTPUT".

    Code (CSharp):
    1. i.vertex -= float4(_playerPosBuffer[0].x, _playerPosBuffer[0].y, _playerPosBuffer[0].z, 0);
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Well, texturing can be in either world space or uv space, so it depends on what you're using. It also depends on which pathway you're using (mesh or terrain, tessellated or not), but ideally you'll need to move the UVs and the worldPos to counter your system.
     
  14. PineappleParty

    PineappleParty

    Joined:
    Jul 31, 2017
    Posts:
    17
    Hi I really need help learning how to use Megasplat. I've owned it for 2 years now. The tutorials are all outdated showing an old UI version. If anyone sees this and could help me learn it I'd be grateful. It sucks to buy something and then not be able to use it. Maybe there is a discord out there for people that do use it? :(
     
  15. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    There's a discord channel, my server is listed on most of my assets (I just recently made sure it was on every MicroSplat asset). Happy to help you get past whatever hickup has you stuck.
     
  16. thefallengamesstudio

    thefallengamesstudio

    Joined:
    Mar 7, 2016
    Posts:
    445
    Hey. Can you send me a pm so I can ask something privately? It's off-topic. I can't start a conversation using your profile page. You can also email me.
    Just to be clear: I'm not asking for vouchers or favors

    -- Lucian
     
  17. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    104
    Hey @jbooth,

    Another question about your Stochastic Sampler for Amplify shader :

    Do you plan to support texture array input ?

    Thanks,
    Jonathan
     
  18. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Nope.
     
  19. Zeven001

    Zeven001

    Joined:
    Sep 11, 2017
    Posts:
    9
    Hey i have a problem whit Runtime Painting Puddles, because i don't work and i think it is not yet supported because in the script i cant see Puddle mode do anything. I need this for tire tracks in sand and snow
     
  20. Zeven001

    Zeven001

    Joined:
    Sep 11, 2017
    Posts:
    9
    Also in Unity Version 2018.4.11 I got complete freeze of editor when i use Free look Camera of standard asset is Pivot based
     
  21. Zeven001

    Zeven001

    Joined:
    Sep 11, 2017
    Posts:
    9
    Sorry But I whas wrong the editor freeze when my camera is on deffered rendering
     
  22. gianluca-menini

    gianluca-menini

    Joined:
    Oct 2, 2014
    Posts:
    13
    Hi
    I would be willing to buy MegaSplat. Using Unity 2019.1 and/or Unity 2019.2 MegaSplat is compatible? Am I particularly interested in the product so that I can work on meshes (vertex painter) can be done even at runtime?
    Thank you
     
  23. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Yeah, it works with 2019.1/2 and the standard pipeline. There are some examples of how to paint at runtime, but if you want to do runtime generation of geometry is has to conform to a custom format. All this is available in the docs, which are linked from the asset package..
     
  24. gianluca-menini

    gianluca-menini

    Joined:
    Oct 2, 2014
    Posts:
    13
  25. Zeven001

    Zeven001

    Joined:
    Sep 11, 2017
    Posts:
    9
    hi
    i did not get a answer from you i hope to get it for the runtime painting part that i dont understand and i realy want to get it working.
     
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    I will test soon and see if I can repro. Is this on meshes or terrain? Make sure it's enabled on the shader and that you can paint it with the painting tools, because that would have to work for the runtime stuff to work.
     
  27. gianluca-menini

    gianluca-menini

    Joined:
    Oct 2, 2014
    Posts:
    13
    Hi,
    I bought Megasplat. I'm using Unity 2019.2.0f1. Amount the software and I'm error:
    "Assets\MegaSplat\Scripts\Editor\Utilities\TerrainToMegaSplatConfig.cs(310,35): error CS0117: 'Noise' does not contain a definition for 'Generate' "
    Come can I act?
    Thank
     
  28. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Can you try in a fresh project? I've tested in 2019.2.0f1 when it came out and everything compiled..
     
  29. gianluca-menini

    gianluca-menini

    Joined:
    Oct 2, 2014
    Posts:
    13
    I'm sorry, I had loaded Surforge before not realizing that there was, inside, the Noise class.
     
  30. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,311
    MegaSplat used to work fine for me, but I recently updated to the latest unity 2018 LTS and the latest version of MegaSplat, and now if I zoom into the terrain in the editor, the editor crashes, sometimes with a black screen first as if it's causing the video driver to reset. From very far away it is stable but if I zoom in close enough to see the textures close up it crashes every time. Any idea what might have changed to cause this?

    Edit: It seems to be related to tesselation; it's fine if i turn it off. It crashes when I zoom in enough that it should show the tesselation.
     
    Last edited: Dec 13, 2019
  31. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Sounds like a GPU driver issue to me..
     
  32. egable

    egable

    Joined:
    May 21, 2014
    Posts:
    17
    I keep getting an error about too many shader keywords in use. I have the shader properly set to Terrain, but my textures are not scaled properly on the terrain object. They are overly stretched. So I try to enable the Per Tex Scale option, and I get the error about too many shader keywords and the option fails to enable. It's ignoring MAX_DEPTH and _PERTEXUV keywords. Is it possible to make any of the keywords local to the shader? It seems most of them are used up by Weather Maker, LuX, Procedural Worlds assets, and NatureManufacture assets, all of which are important parts of my game. Also, is there a way to make it auto-texture a terrain based on height and slope information?
     
    Last edited: Dec 15, 2019
  33. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Well, ironically keywords in MegaSplat are only used as a storage system, not in the actual shader the way traditional shaders use them. In MicroSplat these have been moved into their own system thus avoiding any actual keyword usage. MegaSplat has a runtime texturing option, but it's based on triplanar projection and noise, not slope/height. MicroSplat however has the Runtime Procedural module, which is based on height/slope curves and closer to what I expect you are looking for.
     
  34. mig91

    mig91

    Joined:
    May 14, 2013
    Posts:
    2
    hi! i am using megasplat with ultimate terrains and i have a problem. when i turn on tesselation or low poly look mode on, terrain shader dont get any ambient light at all. how do i fix this?
     
  35. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,311
    FYI I managed to fix it by deleting all my MegaSplat shaders and materials and then recreating them from scratch. Something must have messed them up during the upgrade process.
     
  36. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Hmm, I wonder if Unity has changed anything with the ambient code in newer Unity versions. What version are you running?
     
  37. Bzuco

    Bzuco

    Joined:
    Sep 6, 2015
    Posts:
    52
    @jbooth
    No ambient light when tess. is enabled in deferred rendering is old issue from November 2018...so any version from 2018.2/3+
     
    jbooth likes this.
  38. mig91

    mig91

    Joined:
    May 14, 2013
    Posts:
    2
    2019.2.9f1
     
  39. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,263
    Maybe you answered this earlier but will there be later an update to megasplat to suport urp and hrp?
    Or should i go with your microsplat assets?
     
  40. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    I currently have no plans. SRP support is a nightmare to maintain, as Unity breaks something every release, and it requires a large rewrite of the shader structures. MicroSplat's architecture made that a lot easier to do, because it was already modular.
     
  41. Dark-Codex

    Dark-Codex

    Joined:
    Nov 3, 2014
    Posts:
    1
    Hello, the company I work for is constantly running into problems with MegaSplat, and it seems like there is little maintenance or new features coming to it now. We are considering migrating over to MicroSplat, but we need to know some things, is it possible to convert/keep our terrains and splatmaps when changing over? we would very much like to not need to remake all our terrains :p
     
  42. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    No, they are a totally different format- MicroSplat uses the standard Unity format for splat mapping, where as MegaSplat uses a custom format. What kind of issues are you having?
     
  43. uwalkin

    uwalkin

    Joined:
    Jan 20, 2019
    Posts:
    2
    edit -

    Moved. I posted here seeking support for MicroSplat because the "Support" link from the MicroSplat Asset Store listing leads here.

    I suggest changing the support link in that listing to the MicroSplat thread?

    - end



    Regards,
    uwalkin
     
    Last edited: Jan 11, 2020
    jbooth likes this.
  44. ron-bohn

    ron-bohn

    Joined:
    Oct 5, 2015
    Posts:
    106
    Currently, I am using atlases for manually UV mapping mesh prefabs. This method is tedious, yet highly effective
    and has helped me mostly eliminate set-pass call bottlenecks and vastly improve VRAM usage among other things...I've put in a lot of hours doing this for non-landscape stuff like cities and sci-fi.

    I was looking at Megasplat for handling the texture arrays on optimal as-possible mesh-based terrains.

    I am pondering the possibility of using Megasplat to replace my atlasing workflow on environment meshes such as buildings; using one texture system for dx11+ projects. Am I correct to assume that my building
    meshes would probably need to be combined using Megasplat? How would you say your system's workflow for this stacks against atlasing? I understand how frustrum and occlusion culling can be affected by this potential
    combining.

    I wouldn't particularly mind if your system (texture arrays) made my atlasing "skills" obsolete..lol...many other things to do in a day. Still
    need to be mindful of VRAM used by all those separate textures, but consolidating my set-pass call optimization workflows would be an obvious good choice with much allure. It could also obviously change my whole approach to how I make 3d art for dx11+ platforms.

    Any thoughts or general advice regarding future 3d modeling workflows for realtime would be very helpful if you are willing to share.

    I'm also getting into using GPU instancing for grass and such where appropriate so I would definitely be using that along with your product. I really like what I see and this might very well be one of the most useful assets I've come across for building optimized environments! Thanks!
     
  45. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Check out One Batch, my system for doing exactly this.
     
  46. ron-bohn

    ron-bohn

    Joined:
    Oct 5, 2015
    Posts:
    106
    Sorry if I wasn't clear. I looked at this before contacting you...Not sure this really addresses making mesh-based terrains with blending and such which is what I'm really looking for. I've also used mesh baker and I prefer my manual atlasing over that approach for many reasons including being able to be optimized and usable outside of unity. It seems that one batch is essentially the same thing? If so, that's really not what I'm looking for right now.

    Is one batch useful on terrain-like landscapes? I specifically posted on this forum because I felt it was the appropriate place after doing hours of research watching your videos. I couldn't find documentation links btw, just videos, otherwise I would have dug through that much more before engaging you directly.
     
  47. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    Depends what you mean by mesh terrains. If each is textured with the standard shader, then it would work fine. However, if you're talking terrains with splat maps driving texture combining, then it's not really designed for that. MicroSplat has a mesh terrain module, but each terrain would still have a backing splat map(s) associated with it. MegaSplat uses vertex data with meshes, so it would all get baked into the vertices and the terrains could all share the same material and texture array.
     
  48. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    66
    Great asset, i just purchased your bundle and it's really nice to unpack an asset and see no errors. I did run into a small issue which makes the terrain blending useless in my situation and I'm hoping you can help with. It appears it does not factoring in the current lighting mode. For example I use "standard shader no sheen" to get a less pale/pasty look in my game and when terrain blending is turned on it seems to grab the standard terrain lighting around the blended areas. Any suggestions? Thanks!
     
  49. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    3,999
    I'll test that- it should use the same lighting mode for both, should be a trivial fix if not.
     
    ron-bohn likes this.
  50. ron-bohn

    ron-bohn

    Joined:
    Oct 5, 2015
    Posts:
    106
    Mesh terrains, as in meshes, obj, fbx. 64000 (or 32000 vertices) chunks. Sorry, I thought this was assumed based on the info I prefaced with. With a multiple mesh terrain set-up, it sounds like MegaSplat would be less set-pass calls, particularly with dozens of said chunks. I'm really looking for profiler data in use-case scenarios because that's what ultimately matters the most. I might have to try them all, maybe and see what results I get. Not preferable. I do like microsplat, but I just don't use the built-in unity terrain system because it's heavy compared to a mesh. I don't know where to go from here honestly.
     
unityunity