MegaScatter - Easy Procedural object placement


MegaScatter is a system that allows you to easily scatter any number of objects in to your scene into areas either defined by splines or by textures. You have complete control over how many objects of each type are added to the scene as well as how they are placed. You can define random rotation, scaling, offset values as well as color variation. Objects can be told to place them selves on any underlying terrain or collider objects and align themselves to that object. You can define limits such as the slope angle an object can appear on as well as a range of heights so you can easily have grass appear a low levels turning to rocks at higher levels. The scatter system can also be told which objects in the scene to not scatter on and how far away from those objects an item can be places. And objects can be told not to overlap themselves or other objects in the scatter layer.

Objects can be scattered either in the editor or can be scattered at run-time to the options you have defined. Scattered objects can either be scattered as copies of the objects themselves ot the system can be told to combine all the meshes to massively reduce the Draw Call count. Another great advantage of having the objects scattered at run-time is greatly reduced file sizes and loading times. The demo scene in the video is only 10Mb when the objects are scattered at run-time, the same scene produced normally would be 43MB not to mention the hours it would take to position the objects by hand.

And another great advantage of the scatter system is the scene can very easily be re scattered to suit different platforms or CPU usage without having to rebuild the scene or having etc in the editor.


MegaScatter is available now on Asset Store and more info on the system is on our website at www.megafiers.com

Video of MegaScatter Scene
The demo scene just contains a simple terrain and a model of a house, everything else in the scene (apart from flying things) is added procedurally at runtime with MegaScatter using 1 simple flower object, 2 simple grass objects and 2 rock objects. All the color variations, scaling, rotation etc is handled by the system and at any time you could just say I want more or less objects and the scene will be repopulated for you. Even the data that drives the swaying plant shader is generated by the system with control over how the plants react.

Awesome. Is that a Unity terrain or a mesh terrain? If the latter, will it be compatible with Unity terrain, to take advantage of the grass culling/tree billboarding in large scenes?

That is a Unity terrain in that scene but it could be a mesh terrain or just a series of mesh objects. We will be adding support for scattering terrain objects in a later release but initial release will be without that feature. There is a big todo list :slight_smile:

Nice… so assuming you had a single texture on the steeper slopes of you unity terrain, you could potentially scatter some rock meshes to that texture and tweak the random stuff to go for a kind of skyrim vibe, no?

You can indeed, there are options to limit the scattering of the object to within height limits and or slope angle limits, or you could just outline the area you want with some splines as well as the other limits. I am working on the docs and website for the system at the moment and will be adding those to the website with guide videos over the coming days so that will give you a better idea of the options available. Always open to ideas, as with all our assets they have been converted from our own tools developed over the years but as we found with MegaFiers and MegaShapes how we use them is very different from how others would like to use the tools and it is always fascinating to hear the ideas we hadn’t thought of.

I was asked via email about the draw call decrease the system can provide so did a test to compare the scene built with MegaScatter compared to as if it were bult with multiple objects. The scene contains 3145 objects and the draw call count with objects is nearly 10,000, the mesh combining system got the object count down to 46 which meant a draw call count of about 250 (the flower mesh has 7 materials for some reason), if it were a single material then the draw count for that scenes scattered objects would be around 100 which is quite a reduction from 10,000.

Chris, this is awesome! I can see this greatly streamlining my workflow for populating terrain, not to mention optimizing drawcalls with the mesh combining. I can’t wait for this to appear on the asset store.

Now, if you can just add data serialization to Wrap vertex mapping, I’ll have everything I need. :slight_smile: (Sorry for the minor thread hijack. :))

That has been started :slight_smile:

Ooh, very nice! :slight_smile:

Okay so back to MegaScatter (in this thread, at least :)):

Can you perform mesh combining with prefabs that have LOD meshes and thus support LOD rendering?

Can you mesh combine in procedural “clumps”? By that, I mean somehow having MegaScatter subdivide scattered objects into groups of objects in proximity to each other and then mesh combining those groups, rather than combining everything into one combined mesh. I’m thinking that approach would better support occlusion culling, but I’d be interested in your perspective.

What are the chances of seeing an example of the rock-meshes-on-cliff-slopes I mentioned earlier? :slight_smile: Settlers 7 is another good example, too.

Also, can the scatter results be manually tweaked? And can they be seeded or baked, so they are the same across game instances in a multiplayer game?

@chiapet1021 - Scattering objects with LODs can be done with the scatter object mode, there would be no combining of meshes at the moment, I will add that to the wish list. You can clump in areas, you can set a max vertex count for each combined mesh which will allow you to make more or less combined objects, or you can define multiple splines to define the regions. It is interesting just how many cool ideas come out from other minds :slight_smile:

@PrimeDerektive - You should certainly be able to scatter to cliff tops with combination of slow and height limits, do you have any example picture of the effect you are looking for and I will see if I can create a replica with what I have.

hrmm, maybe something like this?

Also what about those other questions? :slight_smile:

Very cool! And thanks. :slight_smile: Follow-up question: If you use “max vertex count” to determine mesh combining, does MegaScatter combine meshes closest to each other? Is it random? Is it based on other parameters like object type? All of the above? :slight_smile:

It should be no problem scattering the rocks and trees like in the image just comes down to defining the areas to scatter in either by texture or splines. The scattering random function is seed driven so it will be the same each time or on different platforms.

Currently the mesh combiner will make objects for each different object type being scattered and that is then also split between the number of splines or color masks. So if you have a scatter of 4 different object types scattered to 3 spline areas then that would create 12 combined mesh objects, and those combined objects could be split further if they use more vertices than the limit that is set. I will be adding an extra option to group closest objects, which will likely go hand in hand with handling LOD meshes as well. But as it stands the way you build the splines can give you pretty fine control over the end grouping of meshes. Plus you can always use the Object mode scatter which will not reduce draw calls but will keep all the LOD data etc.

If there is a desired way that something should be done in your view do let me know.

Sounds like you about covered it. Just spitballing here, but I think if you could combine multiple object types for mesh combining, that ability combined with your closest grouping method would be even more powerful for draw call optimization. That way, I could mesh combine both the trees and flowers close to each other within the same spline, for example.

Some other questions/ideas (sorry :)):

Are there any limitations to scripting for a prefab that you scatter?

Are the scattered objects stored in any sort of data structure that can be used at runtime to access individual objects and interact with them post-scattering?

I’m wondering if MegaScatter could be used for something like procedural placement of gathering/resource nodes in a strategy or online game.

One thing on combining different meshes in to the same object, does that actually reduce draw calls as they would still have different materials and shaders so there would be no differene from 4 objects with different materials compared to one object with 4 materials. Pretty sure when I did the mesh combining in MegaShapes there was no difference in the draw calls when combining meshes of different materials, maybe something has changed from 3.5?

I will be adding the next update the option to have a list saved of the scattered objects, so that could be used to query positions etc, it will also be used to do run time scattering even faster as positions will be saved and not have to recalculated, it will also allow manual manipulation of the scatter result for fine tuning.

We will also be adding a Query Object system where you can take the ScatterQuery class and add it to an object and add your own code that will be called for finding a position, placing, etc etc so the system can be easily tailored for custom scattering solutions.

Just working on the docs, website and tutorial videos for the system so hopefully soon you will be able to read the docs prior to release.

Thanks for the ideas , keep them coming :slight_smile:

Oh, good call on the materials keeping the draw calls the same. I suppose you’d have to atlas and bake the textures into the combined mesh in order for draw calls to be reduced. I’m not that concerned about that needing to be in there. Others might, but then you’re getting into Mesh Baker territory, and this doesn’t need to be another version of that by any means.

I like the ability to have and access a list of the scattered objects. I’m really seeing potential in an asset like this for all sorts of procedural scattering. I was thinking, for example, you could scatter a bunch of killable mob NPCs at runtime, so that their spawn points aren’t always the exact same location, but they would be restricted to the splines you define. In that situation, it would be awesome to be able to “scatter” a mob again after it’s been killed. Not sure exactly how that might work with MegaScatter; maybe I’ll figure that out after reading through your docs.

As long as there aren’t limitations on what type of object or prefab you can scatter, I can see this being hugely powerful from a procedural gameplay perspective. :slight_smile:

Love the thought of a mob spawn scatter. The ability to set up scatter spawns of deer/wolves/etc in a forest, bears around mountain edges, goblins/orcs/bandits around their camps would be an awesome tool! Had already been lurking and reading the thread with some excitement about the prospect this tool is showing. If the mob spawn scatter is also part of it, I’m definitely sold!

As someone who is fairly new to the Unity world and who is currently building a fresh toolkit of assets, what makes Mega-Scatter stand out from other tools already out there? Terrain Composer, Axis Game Factory, and others seem to have the functionality with procedural type methods to place objects. What is really different about it with how you are planning Mega-Scatter?

Spawning objects on/near splines or inside splines would be very simple with the system I can add some helper scripts for getting random positions for given set of splines, it will then just be a simple call such as GetPosIn, GetPosAlong etc and I guess those could be extended to take constraints such as slope, height etc but simple stuff to add for first update.

I have not actually looked at the other systems as I do the systems we need for our projects and then decide to turn some of them into Assets that others may want to use, but having had a quick look at say AGF some things that may well be different is ours will work on any objects not just Unity terrains, also the system can be told to do the scatter at runtime so greatly reducing file sizes and load times, and the values can be controlled via scripting for adjusting the scene at runtime as well, ie reducing the density for slower platforms, enabling disabling layers dependent on the game, ie leaves layer coming on for Autumn scene, flowers for spring, all with no memory overhead of having to store pre made scenes and data. The system is not meant to be a full blown terrain sculpter and level designer but to do what its name suggests scatters objects into defined regions with user defined constraints. I will investigate the systems more :slight_smile: