A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by jbooth, Aug 9, 2017.
Has anyone tried MicroSplat on a (recent) android phone?
On my laptop MicroSplat performs just great. Whatever i throw at it, my framerate is about the same.
Even when compared to the legacy diffuse terrain shader. And it looks so much better.
But when i had my weekly Phone test session, my framerate dropped from 60 to 20 fps.
Phone specs :
Chipset Qualcomm MSM8953 Snapdragon 625
CPU Octa-core 2.0 GHz Cortex-A53
GPU Adreno 506
My MicroSplat settings are all basic and fastest, and i am so far using 6 textures (512)
I am totally hooked on how my terrain looks with MicroSplat, but obviously 40fps drop is weird.
I've done a fair bit of profiling on iOS using instrument's GPU capture, but haven't looked at it in an android GPU profiler yet (not sure there's a good one out there?). An interesting test without GPU capture would be to see if you are memory or ALU bound. You can do this by simply moving the camera away from the terrain, such that everything uses a lower mip map. If this increases your framerate substantially, you know that you are bound by the amount of texture data it has to read. If not, then it is most likely bound by arithmetic instructions.
I did a quick test and found that moving away from the terrain indeed get's my framerate back up to 60.
As soon as i get closer...
So, memory bound it is.
I'll try the k256 setting and report back to you
Unfortunately the k256 setting didn't help much. Maybe a fraction faster.
Is there anything else we can try or am i doomed to a crappy looking terrain?
You can set the blending mode to fastest, which will limit the number of sampled texture sets to 2 per pixel. This should make it faster than a Unity terrain shader in most cases, since (if it was on a 4 texture terrain) it would have to sample 4 sets of textures. You can also set the max texture setting down to how ever many textures your terrain actually uses- I don't think this will be a big difference, but likely worth doing anyway. Other things to try are removing any features or per-texture properties to see if they are the bottleneck. PerTexture properties are stored in a very small texture, which means they are a dependent texture read, but since the texture is tiny the actual performance cost is very low, but on a mid-range mobile chipset this may have an effect.
The real thing to do is to get this under a GPU profiler on your chipset- good ones will show you what percentage of the time is spent on each part of the shader, allowing you to easily figure out where the bottleneck is. I'll look into doing this on Android soon, but it will likely be after Unite, and the hardware on android varies so much that it's unlikely we'll see the exact same results. If you want to move forward on this yourself, I would suggest the following:
With everything off, there are two parts of the shader that potentially make it more expensive than the Unity shader. Both are pretty easy to hack out, so you can see if either of them is part of the performance bottleneck. The first is the Setup routine- this routine is a pre-optimization step the shader runs to determine the minimal set of samples it needs to make. Setup returns a set of weights and indexes, if you hack out this function to return a fixed set of weights and indexes (weights as 0.5, 0.5, 0, 0 and indexes as 0,1,2,3, for instance), then it would screw up the look of the shader, but remove the performance cost of doing this step. The other is the ComputeWeights function, which could just return the input weights, skipping the height based blending all together. Also, if you attempt this, make sure to either do it in the fragment files, or do it in BOTH shaders the system produces.
Thank you so much for your in depth answer. I'll get into GPU profiling. Never done it before, but i'll figure it out.
Need that skill anyway.
I will also try your suggested hacks and get back on that.
Please let me know what you find- so many android devices, if we can find the bottleneck, I'm sure we can come up with something..
I need to set up several terrain materials for different platforms/quality levels, but I've run into a weird problem: If (on the Terrain settings), I switch the terrain to the default terrain shader, then switch back to Custom and assign the Microsplat material, the terrain shows only the first splat. I have to go to that MS material and slide the Per Texture Properties slider righward, and then the other splats appear. Any ideas?
(Happens with your Demo scene too, at least the one in Core.)
I'm on MBP with AMD 560, happens with both Metal and OpenGL editor.
Each terrain has it's own copy of the material- it doesn't actually use the template material directly. Whenever you change the template material in the editor, it automatically syncs the changes across all the terrain's internal materials. So if you change the settings via code or outside of the editor, you need to sync those changes across these internal materials- that's what the Sync All button does- but when you change a property on the material, it effectively calls this for you.
So if you are going to setup multiple LODs, you need to call MicroSplatTerrain.SyncAll() after the change is made to propagate those changes from the template material to all the internal materials the terrain uses.
Got it, thanks!
I encountered the same problem with one of my terrains. The problem turned out to be caused by varying values for the per texture UV scale. If only the global UV scale is used, or if per texture UV scale is used but all values are the same, there is no issue. Varying the UV scale for different textures causes the problem.
Most likely it's something with the texture derivatives being computed differently for neighboring pixels of different texture indexes. I had coded a fix for this a while back, but then couldn't seem to get it to happen without the fix, so backed out of it. I'll see if I can get it happening again and figure out what my fix was..
Streams/Lava, and the alpha hole module are finally out - after 24 days of waiting in line:
MicroSplat 1.1 submitted for review, with all modules updated. Please note that this is an internal version changing upgrade, which means that all modules need to be updated together, so please check the asset store version numbers before upgrading. Here's the change list:
Global Texturing Changes
Added distance mode to global normal/tint textures
Added opacity at near/far distance to global normal/tint textures
Added ability to warp Geo texture with an animation curve
Terrain Blending module
can now blend terrain on the tops of objects with a separate slope filter slider
You can now paint terrain blending strength in the color.a channel of your mesh, so you can blend a flat piece of geometry with the terrain, then paint 0 into the areas you was to show the original texture instead of the terrain.
“HeightWetness” added to the streams module, allowing you to specify a wetness level based on height which can be animated up and down for shorelines
Modules you already own removed from ad carousel
Added lighting mode option that allows you to force a particular BDRF for Unity’s lighting. When doing so, the terrain will be forced to render in forward rendering mode.
You can now disable height based blending for a speed boost on low end platforms
Fixed issue with lighting being too dark on terrain blended objects in deferred when in shadow
Hash id added to fallback name to prevent naming conflicts causing the fallback to find the wrong shader
Fixed issue with Undo on PerTexture properties
Fixed issue with 2nd and 3rd normal noise not being applied when per texture properties are enabled
Cool! I'll definately try the Streams/Lava module~Was the triplannar module submitted after these two and still needs waiting, Mr Booth?
These fixes would be very helpful! Looking forward~
Submitted at the same time - it was rejected for a trivial issue, so I resubmitted it with the 1.1 update tonight. Hopefully it'll all come out at the same time reasonably soon. Updates have only been a few days for me lately, it's just new assets that seem to be taking a while.
Eventually will definitely own all microsplat module. Using them one by one.
Any chance you can create a texture streaming module. Much like granite https://www.assetstore.unity3d.com/en/#!/content/51026 . But with all the beautiful features of microsplat.
For the most part they are two ways to solve the same issue - splat maps are a form of compression- low res control data used to paint blends between highly tiled textures to produce a highly detailed terrain. Where as virtual texturing systems are about having a really, really large and highly detailed texture that you load/decompress for the areas around you. Each has an advantage, but they don't really work together.
Regular old loading techniques should be good enough to load in any non-splat map data in use, such as tint textures, control textures, etc. The compression used in streaming systems is also not a good fit for this kind of data, since it is usually based around lossy jpg compression, which is designed around perceptual colors- not data.
I see now I understand it better. Am I right to say that lossy compression of the PBR maps (other than albedo) would mean streaming solution might not match splatmap approach when up close?
All right~The fixes mean much more to me, so worth the wait~
Depends - in Rage, for instance, they baked lighting and shadows into these maps, so what they were streaming was not a PBR stream of data that gets lit, but the final result as a giant JPG. If you were streaming a full PBR spec, then you'd need to compress it into 3 textures (no alpha channel in JPG), which means you'd have to have 1/3rd the resolution for the same data rate, and wouldn't be able to use linear information and take advantage of packing things into alpha. Since the RGB channel would be packed together as a Gamma color, it would greatly reduce quality on things like normals. And the process for creating data in this manner is also a bear- a Rage level took 3 days to bake. For most cases, the idea of precomputing a giant JPG and streaming it is not that useful.
Where Virtual texturing is really useful is as a runtime cache- basically, rather than rendering into the screen, you render materials into a texture page and use it as a cached result so you can use simpler shaders in your scene. Battlefield, for instance, does this for terrain- the terrain is your basic splat map approach with decals all over it - they render each chunk into a giant texture sheet, then map that onto the terrain. New approaches in rendering take that even further- at Siggraph a few years back the Assassin's Creed team presented a paper on GPU driven rendering, where every surface in the scene is cached to a Virtual Texture page as needed, then the entire scene is rendered from that in one draw call. Surfaces which stick around from frame to frame can use the previous rendering, so you get great amounts of savings per frame and most of your scene can actually draw in a single draw call. Anyway, great paper, you'll see stuff like this become a thing in Unity after SRP is mature.
Hi there, I would like to know the difference between microsplat and megasplat, does mega the full state of micro or they use different methods?
Edit: by using micro for a while, it seems it still uses unity terrain's splat map but a custom material, does this mean I can get the splat info directly from unity's terraindata?
Yes, MegaSplat is a replacement system for the whole texturing workflow, where as MicroSplat is a replacement terrain shader, and uses all the standard Unity workflows for terrain, for the most part (it reads splats from terrainData). The two shaders use very different techniques - MicroSplat is generally the faster shader, but MegaSplat can have hundreds of textures and work on meshes. MicroSplat is generally much easier to use than MegaSplat, as MegaSplat has to deal with terrain conversion, multiple workflows, managing large numbers of textures, etc.
There are lots of other differences, and I really need a comparison chart for people, but haven't gotten to it yet.
Thanks for the reply!
I'm wondering if I want to use micro instead of mega, though I've already own MegaSplat.
But I really don't need 256 terrain textures in my game, and without unity terrain's splatmap can make several other assets I need a bit difficult to use.
16 textures with micro is quite enough for me, but I'm wondering which one is faster and whether it's possible to have a discount with micro's addon assets if I already own Mega.
For most terrain uses, MicroSplat is going to be faster than MegaSplat. There's not really a great way to do a discount for MegaSplat users within the asset store structure. You can do upgrades, but MicroSplat is actually 9 different assets, not a replacement/upgrade for MegaSplat, so that doesn't really fit into that structure. However, the MicroSplat modules are all very well priced for what you get, and most likely your game doesn't need them all, so for most people I think MicroSplat works out to be cheaper than MegaSplat if all you really need is a good replacement shader for terrains.
Got it, I actually only need triplannar and tiling reduce, but I can't find triplanar in the store, the icon does show inside micro's inspector though
Yeah, they just approved it today- unfortunately they approved the 1.1 version, which means you really have to wait for them to release the 1.1 update of MicroSplat/Anti-tiling first (hopefully within a day).. If you install it now, it will just show a warning saying that the versions don't match.
I can wait
Playing MegaSplat for now.
Texture clusters are very useful, but I found different height maps may not blend nicely.
1.2 submitted for review tonight.
Vegetation Studio Integration
Ability to disable anti-tiling techniques on bendable object shader, as these can cause streaking when relying on triplanar to prevent smearing on vertical surfaces.
Bake out all channels of your PBR terrain to textures
Fix to streams module on terrains not at 0,0,0
Fix error when converting a Unity Terrain with no textures
Fix issue where parallax offset wasn’t working when tessellation is disabled
Fixed issue with per-texture properties bleeding across texture boundaries
Parallax now has a fade start and distance
Is there any chance of you making a short video showing the Terrain Holes module in action? I'm wondering how it works. Do you paint the holes with a brush, and/or can you import an image as a mask? Can you animate them? Could you use 3D models to "subtract" a hole in the terrain? Is there a way to limit them to certain textures? And so on. Also, I find your demonstration videos a good source of inspiration as to how to use these tools. Thanks.
I include the documentation for all the modules in the main module, so that's the best place to check if you have questions about other modules. The holes can painted by designating one of your textures as the "hole" texture and using the normal painting workflow, or you can set a water height to clip all terrain below that height.
Well, looks like Unity released 1.2 of the core module, but has not approved the other modules yet. I submitted them all in sync, so hopefully they'll all come through in the next few hours- but I would recommend not upgrading until all the modules you use have been updated, as otherwise the modules will disable themselves because of the versioning difference.
Hi, Mr Booth! I've got another question today..
I've been busy trying MegaSplat and MicroSplat 1.1 recently, and really like latest terrain blend feature, but when I try to blend a MegaSplat Plane with the terrain blend function, things got a little weird.. I tried to fill the blend alpha and then reveal the mesh material by hand, but the result seemed not very under control, the blend edge was kind of messy and the revealed area was not quite what I originally painted with MegaSplat, like this:
I used a two layer MegaSplat 1.5 shader by the way. Is there a different progress when dealing with MegaSplat Material? Or they are not very compatible by now?
The blend alpha and painted material seem to be affecting each other..
Let me verify- you are using MegaSplat for the mesh, and MicroSplat with the terrain blending module for the terrain? If so, the way terrain blending works in MicroSplat is that it simply draws a custom shader over the object after the regular shader draws- it doesn't know what shader it's being drawn over- could be any shader, so the edge should look the same on any material. Since it doesn't know anything about the shader it's drawing over, it can't really do a nice height based blend, so it does a linear blend and uses some noise from the height info it does have to rough it up a bit. Anyway, from the shots you've provided, I'm not exactly clear on what you are expecting it to look like vs. what our seeing.
Quick question: are there any plans for official Map Magic support, or is the recommendation to use the generic custom shader output node? I've been having a difficult time making that work.
You'd have to ask Dennis- he has full access to my repositories, but I would expect it to just work with the custom shader output node, since the workflow uses all the standard Unity Terrain stuff (unlike MegaSplat, which is really different). What are the issues your seeing?
Thanks, Jason. I'm essentially having trouble understanding the custom shader output node (while the megasplat, rtp, and cts nodes were incredibly simple), which is a problem with map magic and not microsplat. I'll do the homework on it.
@jbooth this my first go with Micro Splat, I really like it.
Jason, I know this isn't your area, but I really do appreciate the help. This is the issue I'm seeing trying to integrate Map Magic and Microsplat. Using this custom shader node, wiring it up to the first control texture in various channels, I see only the first texture in the texture array. I can change any of those layer dropdowns to any available value and the result is exactly the same. If I use megasplat mode (or cts, or rtp, for that matter), however, everything appears nicely textured. I'm more than willing to admit I'm a complete scrub when it comes to working with terrains, or understanding exactly how texture arrays are parsed. I apologize if I'm missing something remedial.
Can't you just use the regular output node? I'm not exactly sure what the custom node does, as I haven't looked at this since we wrote the MegaSplat one together, and it didn't exist then.
I can use the texture output node for the painting, followed by the standard Microsplat workflow of ingesting the maps into the microsplat material. Thanks, Jason.
how'd you do the tracks? Decals, or another texture? Looks great!
Thanks bro, they're Decals
Do you have any plans to have rain drops? also I've not looked into texture arrays yet is it possible to change a texture at runtime?
I have them in MegaSplat, so it'd be pretty easy to port them over- I just left it out because it didn't seem like something people were using much, so it helps keep code complexity down. They'd go into the wetness/streams/lava module.
You mean swap the whole array, or just one texture? The whole array is easy. If you want to swap one texture, you can use Graphics.CopyTexture to copy things into a texture array's slice (index). The main issue is that the size/format/compression/etc all have to be identical, so you'd want to get them all into the same format and do the copy's then. You could likely just pack everything into one giant array, and CopyTexture the ones you were actively using into the correct indexes.
Ah ok I have most of your modules, I might get mega splat also I have some biggish terrains 4k x 4k, but the action mostly takes place in smaller areas. I'm now thinking of creating meshes just for the walkable area's and using mega splat for those, so I can have more detail. From a performance point of view do you that is a good way to go? Also given that setup and the terrains being mostly vegetation free, do you think there's any performance benefit to converting unity's terrain to a mesh also and using mega splat for the whole thing? it's a PC/console game.
MicroSplat is usually faster than MegaSplat for raw performance - the big benefit of MegaSplat is really the texture clusters, high texture counts, and ability to work on arbitrary meshes - but the workflow and blending can be pretty different at times, so it really depends on your needs.