Search Unity

World Building MegaScatter - Easy Procedural object placement

Discussion in 'Tools In Progress' started by SpookyCat, Jan 28, 2014.

  1. gfrast

    gfrast

    Joined:
    May 5, 2014
    Posts:
    30
    Hi,

    is it possible to use megascatter also just as a placement-tool for prefabs, without combining them? (keeping separate instances, animations, etc...). if yes, this would save me a LOT of time - i'd definitly buy this package.

    cheers,
    Alex
     
  2. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    yes the combing of meshes is an optional feature i use it to mass place ai
     
  3. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @gfrast - You can choose to either scatter and have the meshes combined by using the Mesh Scatter layers or you can just scatter Objects which will just place the selected objects in the scene along with any animations or child objects they may also have.
     
  4. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Just suibmitted an update to the Asset Store and our website, this adds a new beta feature to the Scatter Along layers which allows you to align the objects to the direction of the spline, any other rotations you apply are then added to that so you can still have random rotations etc. It is a beta feature so if you find any issues let me know. Also updated the MegeShapes system to the current version so adding a few new features.

    Changes in v1.19
    • Add beta option to Scatter Object Along layer to have objects align with the spline direction. Extra rotations will then be added to that.
    • Add beta option to Scatter Mesh Along layer to have objects align with the spline direction. Extra rotations will then be added to that.
    • Imported SXL splines will now no longer change values to centre the spline.
    • Imported SVG splines will now no longer change values to centre the spline.
    • Added Centre Shape button to Shapes Inspector to allow you move the pivot to the centre of all the points.
    • Added new InterpCurve3D method which will return the postion, twist and also rotation quaternion for a point on a spline.
    • Autocurve now does the first and last handles on open splines.
    • Added 'Update on Drag' option to MegaShape inspector, if checked spline meshes will update as you drag, off then they will update when dragging stops.
    • Fixed inspector for spline animations so buttons aren't hidden.
    • Added SVG option to export MegaShape splines to SVG files.
     
    MikeUpchat likes this.
  5. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Just starting to use this with the latest asset store build on Unity 4.6. I don't seem to have the "color mesh" checkbox under the "add surface object" section. The "add color" under color variations is in the inspector but no "col curve" to adjust the colors (probably because no checkbox for "color mesh").

    My inspector looks a little bit different than the version in your video from February 2014 - https://www.youtube.com/watch?x-yt-...t-cl=85027636&feature=player_detailpage#t=189

    The checkbox I'm talking about is at 2:55 in the video above and the vid should be around the 3:09 mark where you can see the "col curve" that I don't have.
     
  6. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @MIK3K - Could you submit a support ticket at the website and include some grabs of the inspector, just tested it here and all works fine.
     
  7. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Oops, I'm an idiot. I was using the "Mega Scatter Object" by itself instead of the "Mega Scatter Mesh." That one has the "color mesh" checkbox. I better go through the videos again I think and actually read the PDF. I apologize for the false alarm.

    Other than the color variation thing it worked great. I imagine it will be even better if I use it correctly. :confused:

    Edit - Did a quick test scene and everything is perfect!
     
    Last edited: Jan 30, 2015
  8. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Was wondering if you were using an Object layer instead of a mesh layer. Glad it's working as it should be :)
     
  9. Craig87

    Craig87

    Joined:
    Feb 17, 2014
    Posts:
    7
    Hi Spooky Cat,

    In an earlier post some asked about using LOD objects in a Scatter Mesh and you replied...

    Was this wish list feature every implemented? :)

    Thanks!
     
  10. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Just submitted an update to the Asset Store, this brings some improvements to the scatter systems and also brings the version of MegaShapes included in the system up to date with numerous bug fixes and new features. Also the system is fully Unity 5 compatible.

    Changes since v1.19
    • MegaScatter Fully Unity 5 compatible.
    • Fixed exception if trying to build a mesh with a shape with no splines.
    • Fixed exception if trying to interpolate along a shape with no splines.
    • Fixed exception if trying to interpolate a spline with no knots.
    • Autocurve fixed so the last knots handles on an open spline are correct.
    • Fixed some potential errors in the constant speed interpolation.
    • Smooth value is now a slider and shows results in realtime for easier use.
    • The align object option is now copied when a layer is copied.
    • Added new option to the Uniform scaling option, you can now choose how the uniform scaling is applied and to which axis so XYZ, XY, XZ, YZ with the other axis having its own scale.
    • Fixed offsets in Scatter Object Along not being applied correctly along the length of the spline.
    • Fixed offsets in Scatter Mesh Along not being applied correctly along the length of the spline.
    • Further small changes to make compatible with Unity 5.0
    • Made changes for latest Unity 5 beta to fix any import warnings.
    • Fixed exception when adding a new curve to a shape.
    • The Clone Spline layer now works with the spline twist values.
    • Fixed exception when adding a new curve to a shape.
    • Added option to Spline Tube Mesh to flip normals for inside tubes.
    • Added option to Spline Box Mesh to flip normals for inside box tubes.
    • Added option to Spline Ribbon Mesh to flip normals.
     
  11. diccon

    diccon

    Joined:
    Sep 13, 2013
    Posts:
    22
    Hello, I have recently started using megascatter and I'm liking it a lot so far, however there is one thing that I would like to do that doesn't seem to be supported - or maybe you can suggest a way?

    I would like to place clusters of islands in an ocean, that are spaced far apart (the clusters are far apart, not the islands). So I have created a prefab consisting of a small scatter shape and scatter object with a single layer containing an island object prefab set to scatter with a small radius. Then in my scene scatter object I create a layer for these prefabs, with a large radius so they are far apart. The result is that the clusters are nicely generated, but they are all identical because they each have the same seed. Is there a way to give each generated scatter object a unique seed so each cluster comes out differently?

    I guess I can write my own script to do this at runtime but if there is already a way then please let me know!

    I have a screen shot of some island clusters in a scatter rectangle so you can hopefully see what I am trying to do.

    scatter.png
     
    Last edited: Mar 17, 2015
  12. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    There is a 'seed' value for changing the random number generator. The scatter layer has a seed value and each scatter object on the layer also has its own seed value, do they not help at all?
     
  13. diccon

    diccon

    Joined:
    Sep 13, 2013
    Posts:
    22
    Thanks for your reply, yes I am aware of the seed field. Because my scatter layer contains an object that itself contains a scatter object (from a prefab), when the objects are created in the layer they all have the same seed, so they are all identical.

    I think all that I have to do is write a script that queries the parent scatter object for all of the child scatter objects that it created, then give them each a unique seed before they perform their own scatter (they are all set to build on start).
     
  14. Chaerephon

    Chaerephon

    Joined:
    Jan 3, 2013
    Posts:
    8
    Hi Chris, just wondering if Megascatter is compatible with the Standard Shader? IE how much functionality will be lost if scattered objects are rendered with SS? I'm assuming just color variation and wind FX?
     
  15. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    You would lose the blowing in the wind and the color but those could easily be added back into a custom version of the standard shader, I adapted the SS for example to do my custom spring deformation, video below.
     
  16. Chaerephon

    Chaerephon

    Joined:
    Jan 3, 2013
    Posts:
    8
    Pretty pistons! Looks great, will purchase today.
     
  17. Nyxxakai

    Nyxxakai

    Joined:
    Jun 14, 2012
    Posts:
    41
    Is there a setting to fade off the scatter depending on distance from the camera?
     
  18. mikaelwallin

    mikaelwallin

    Joined:
    Dec 11, 2013
    Posts:
    20
    In Scatter Object Along is there a way to distribute the objects evenly. Like making a hedge or a fence?
     
  19. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    i'am looking for know if MegaScatter can deform mesh along terrain on placement
    like one ffd with bounds
    please
     
  20. victorjunaidy

    victorjunaidy

    Joined:
    Mar 15, 2012
    Posts:
    9
    hello,

    i need a tool to place filler building based on satellite image map. the building orientation and location should be exactly following reference satellite image.

    i can not use mapity because of the location does not have osm data. can megascatter place building with exact orientation and location based on satellite image?

    thanks
     
  21. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @mikaelwallin - You can use the Snap values on the Mesh Layer params and have no overlap on for more control, but the system is mainly a scatter system, our other product MegaShapes has multiple systems for building things like hedges with a rules based system were start and end objects can be added, as well as regular spaced objects and special objects as can be seen in the video below. (Note the video is about MegaShapes not MegaScatter)


    @victorjunaidy - The system does not currently use textures to define orientation and location, if you can provide some examples we can take a look at adding such functionality.

    @kilik128 - The system does not conform meshes to the ground it will position them onto the ground and align them with the ground if you want but will not deform the mesh to fit. Again our other system MegaFiers has a conform modifier which allows for objects to conform to a terrain or ground mesh as seen in the video below.
     
  22. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Hi Spooky Cat,

    I'm running into some issues trying to use SpeedTrees with Mega Scatter. For example I am trying to use Mega Scatter Object Texture. This works OK if I directly select a Mesh (e.g. LOD0) within a SpeedTree, but if I select the actual SpeedTree prefab itself (to support the LOD groups including Billboard) it doesn't work at all. No objects are created.

    Any chance of adding support for SpeedTree .spm prefabs?

    Thanks!
     
  23. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    I will look at that but can't see why it shouldn't work as the system just Instantiates the objects, you are using the Scatter Object types and not Scatter Mesh?
     
  24. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Yes I am using Scatter Object Texture. It works if I select either LOD0, LOD1 within the prefab but not the prefab itself. I also notice that it doesn't work if I select the billboard within the prefab.
     
  25. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Found the problem, the Scatter Object Texture system was using a method meant for the Mesh scatter layers where it would look for mesh data in the top object which would work most of the time but for Speedtree prefabs the top object has no mesh data. Anyway Scatter Obj Texture is using the right method now so all working as it should, thanks for finding that, new version will in the store very soon.
     
  26. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    New version in the Asset store and on our website with the bug fixed for Scatter Object Texture layer types so now Speedtree prefabs will scatter correctly for this layer type.
     
  27. Justin_H

    Justin_H

    Joined:
    Feb 28, 2015
    Posts:
    2
    Hi, I think this looks like a very promising tool, but I cannot seem to get anything to work as advertised. Here are the current issues I'm encountering while trying to use Texture Scatter methods:

    1) Objects are only placed when using a Texture; Objects do not get placed at all when using only Texture Object
    2) Objects are placed at random across the surface, seemingly ignoring the texture and masks all together
    3) When placed, objects are either sinking through or floating above the target surface

    The video tutorials and documentation gloss over many details regarding the setup. I'm sure I'm missing something. Please help.
     
  28. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @Justin_H - Thank you for the purchase, it is much better to submit a support ticket at the website then we can get you in the queue for any help you may need. When you submit the ticket if you could outline the steps you are taking and maybe include some screenshots of the inspector setup to show the params you are using and maybe even a video to show the problems you are having. Also I am a little unclear on question 1, you say Objects are placed with a texture but then say they do not get placed, if you could expand on that in the ticket that would be helpful. It does sound like you have something setup slightly wrong and as for objects going through collision objects the objects are scattered as to their pivot point, if that pivot is in the middle of the object then you will need to use the offset value to adjust the object as required.
     
  29. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Just submitted an update to the asset store and our webstore. This brings the lite version of MegaShapes included up to the latest version and brings support for OSM import and lightmap support for the basic spline meshing options, also fixes a couple of small bugs.

    Changes since v1.23
    • Fixed MegaShapeLightMapWindow problem when doing an app build.
    • You can now build lightmap data for MegaShape standard meshes.
    • Changed OSM importer to use ulong for ids instead of int so can now handle complex OSM files.
    • Fixed Shape labels being displayed if behind the camera.
    • Added a beta OSM data importer. Click the Assets/Import OSM option.
    • Added FindNearestPointXZ and FindNearestPointXZWorld methods to MegaShape API.
    • Fixed bug in the Scatter Obj Texture layer which stopped Speedtree prefabs from being scattered.
     
  30. Nyxxakai

    Nyxxakai

    Joined:
    Jun 14, 2012
    Posts:
    41
    If i say I bought it can i get an answer?
     
  31. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Sorry didn't see your post, once the objects are scattered then they just become like any other game object in the scene, so you could say have a shader that does a z test and then displays or fades, or for object scatter the objects could have Lods attached which would then work just as they would for hand placed objects.
     
    Nyxxakai likes this.
  32. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Just submitted a small update to the AssetStore that removes any obsolete methods etc. for use with Unity 5.1 and the upcoming release of Unity 5.2
     
    Nyxxakai and ZJP like this.
  33. AlexBes

    AlexBes

    Joined:
    Feb 11, 2014
    Posts:
    47
    Hi SpookyCat!
    Just bought Mega Scatter specifically to place Speed Tree vegetation, but it seems like it's not working.
    Here's my steps:
    1. Create circle shape.
    2. Create scatter mesh.
    3. Assign circle shape to mesh.
    4. Add mesh. Assign speed tree prefab.
    5. Press update.
    I get green rectangle around shape and no objects in it. Is it something I've done wrong?
    Thanks in advance.
    Clip2net_150708152741.png
     
  34. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @AlexBes - If you coudl submit a support ticket at the website with possibly some screenshots of the inspector showing the settings you are using and maybe a video showing the steps in full so we can see what could be going on. We have plenty of users using MegaScatter for placing Speedtree objects in their scenes so it just seems you have a missing setting somewhere but hard to say what it is without a little more info, so if you could submit a ticket that would be great.
     
  35. AlexBes

    AlexBes

    Joined:
    Feb 11, 2014
    Posts:
    47
    Thanks for quick reply! I'll submit a ticket.
     
  36. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Just for other users the problem above was due to an object with children being used on a Scatter Mesh Layer, the Mesh layers expect to find a mesh in the first object which is then combined with all the other meshes scattered into a new mesh to save draw calls, in this case the Speedtree object had LOD objects so the scatter system found no mesh in the top object, when a Scatter Object layer was used everything worked fine and the LODs all worked etc.
     
  37. AlexBes

    AlexBes

    Joined:
    Feb 11, 2014
    Posts:
    47
    Hi @SpookyCat!
    After working for some time with Mega Scatter I get an error:
    "ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index".
    Here's my steps:
    1. Added a few more splines to shape object. (Total of 23 splines).
    2. Pressed "update" in megascatter object.
    3. Got an error.
    I've done exactly the same steps before without any issues.
    Thanks in advance.
     
  38. AlexBes

    AlexBes

    Joined:
    Feb 11, 2014
    Posts:
    47
    Problem solved by creating new shape object and assigning it to scatter object. Then update and reassign original shape object and update again.
     
  39. Lelon

    Lelon

    Joined:
    May 24, 2015
    Posts:
    79
    I have a question,
    My terrain is infinite and randomly generated in real time, would this still work even tho the terrain is random and unpredictable?
     
  40. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @Lelon - That should be no problem, you would just define your areas as you wanted and setup the rules you want with a test terrain and then tell the system to scatter at runtime the system will then do the scatter onto whatever is below it at the time. You may need to disable the scatter system till after your terrain is built then turn it back on and call the ReScatter method to make sure your terrain is there before the scatter is done. You are also free to move any of the shapes defining the scatter regions or change their shape as well if you need to. All of the aspects of the system can be controlled via scripting or created at runtime if you want to via scripts or by having predefined prefabs which you add to the scene.
     
  41. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    Quick update to say a new version of MegaScatter is in the Asset Store which makes it fully compatible with Unity 5.3.
     
  42. Flargy

    Flargy

    Joined:
    Sep 5, 2014
    Posts:
    8
    Hi,

    I am thinking of buying mega-scatter and I am wondering if it might work with my project.

    I am not completely clear how mega scatter works so please bear with me if some of my questions
    are a bit out there.

    My project uses chunks, containing blocks of size 8m by 8m by 5m.
    Each terrain block is created proceduraly using noise and at the same time
    I use noise to generate properties for each block such as rainfall, type of terrain (plains, hills etc)
    and civilization (urban, wilderness etc).

    Is it possible to link the scattering to these properties.
    For example could I create a scattering that is only used on blocks with
    the properties of plains, high rainfall and wilderness.
    Thus each block would search out is its particular scattering and use that one.

    Can it do this at runtime while chunks are being created and would this cause much slowdown.

    Would it be possible to update the scattering mesh? Say when changes made by the player,
    for example, picking a flower or chopping down a tree.

    Can it the scattering be used to actually generate terrain meshes?,

    Can the scattering be used to place premade rooms and corridors.
    For example, might there be a way to hook it up to to a random dungeon generator?

    Can scattering be used on a prefabs with many gameobjects (say a block sized, blacksmith forge enviroment
    with many gameobjects) to fill rooms with content, block by block?

    Assuming scattering is done with seeds, does this mean in mutiplayer, players
    would end up with the environments as long as the seeds are the same?

    Your asset sure looks cool and I hope I can use it.

    Thanks,

    Flargy
     
  43. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @Flargy - I am sorry I did not get an email saying there was a new message here. Probably a bit late to answer the questions but, you can certainly script the scatter options and layers, so a simple example would be to create a square spline that covers the area on the block you want to scatter on which can easily be done via script with the Spline API, just need to define the 4 corner points in a Vector3 array, create the Scatter object and then set the values as you need, or have prefab scatter objects with the settings in and instantiate those.

    If you want the player to interact with scattered objects then you would use a scatter object layer instead of a scatter mesh layer, that makes the objects keep all their components just like any other game object placed in the scene.

    You can scatter any objects or meshes, but if you want objects to connect to other objects in certain ways then that is a little outside the scope of a scatter system as there are specific rules to joining objects.

    You can certainly scatter prefabs with multiple of child objects if you wish.

    The scatter system does indeed use seeds so as you say as long as the seed values are the same on different machines each machine will end up with the same scatter result.

    If you need anymore help please do email me at our website, much better than counting on the Unity forum notifications.
     
  44. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    I have just submitted a small update to the Asset Store, this adds a couple of improvements and a few bug fixes to the spline system and also makes MegaScatter fully compatible with Unity 5.4.

    Changes in v1.28
    • Fixed error with Spline Fill mesh when being used as a collider with zero thickness.
    • MegaShapes fully compatible with Unity 5.3 and 5.4
    • Fixed a problem in Unity 5.x where zero length tris would cause an error and stop the collider being built.
    • Fixed exception in inspector if you happen to create a spline with no knots in it.
    • Added option to turn of the autosmooth when a new knot is added to the spline.
    • Also added the AutoCurve option when the Add Knot button is clicked
     
    sbutler likes this.
  45. sbutler

    sbutler

    Joined:
    Sep 17, 2015
    Posts:
    9
    Loving MegaScatter, saving me untold amounts of time populating areas, but ran across one problem and I wasn't sure if this was a bug or just user-error.

    Every time I populate a spline with objects, they seem to just fill into the spline as if the spline was a linear only shape between each knot. It doesn't seem to want to populate the complete curvature of the spline when using the tangent handles. Using Unity 5.3.2P4 and latest version of MegaScatter, using MegaScatterObject mode.

    Screenshot attached, any thoughts?

     
    Last edited: Mar 30, 2016
  46. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @sbutler - The spline system is used to define the boundaries but it does actually use straight lines between the knots as it makes it much faster for detecting a point inside the spline, it made it impossibly slow to scatter inside spline curves when doing scatters of 1000's of objects. You just need to add a few more points in to get the shape you need, there is a small white circle at each mid point of a spline segment, just click and drag each of those to add a knot at that point. If you need exact shape placement then there is the texture scatter layer where you can define complex shapes.
     
    sbutler likes this.
  47. sbutler

    sbutler

    Joined:
    Sep 17, 2015
    Posts:
    9
    Ah ok, thanks SpookyCat. Yeah I actually started adding knots to get closer to the desired shape, works fine. If the scatter is not using the full spline shape though, what is the need to have splines in the system, why not just linear shapes to better represent what you'll get, if that's all it's using? Thanks for the quick response.
     
    Last edited: Mar 31, 2016
  48. livio3d

    livio3d

    Joined:
    Feb 17, 2009
    Posts:
    145
    Hi SpookyCat, i buy megascatter long time ago and im pretty happy how is work, is perfetc for my project, i have some question , on my chunks maps i add a scattermesh for generate trees,rock and other interactable object player can cut or dig, is there a way for regenerate one single object every 20 second untile i re-fill the scatter system? And second, my player have the ability to place objects and houses inside this scatter area, how i can block the system to overlap this items generated outsite the scatterobject script?
     
    Last edited: Apr 10, 2016
  49. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,761
    @livio3d - Currently there is no method to continue to add objects once a layer has been scattered, I can see how that would be a useful addition though so will look at adding a method that can be called from script to add extra objects over time, not sure when it will be done though. As for stopping objects being scattered over objects added to the scene you would need to add those objects to the List<MegaScatterCollisionObj> 'ignoreobjs' list. The MegaScatterCollisionObj class is:
    Code (csharp):
    1. public class MegaScatterCollisionObj
    2. {
    3.    public Collider  collider;
    4.    public bool       active = true;
    5.    public bool      includechildren = false;
    6. }
    So you would set the collider value to the collider of the object you don't want to scatter on, set active to true and includechildren to true if the object has multiple colliders, and then add it to the ignoreobjs list, then the next time a scatter is done that object will not be scattered on.
     
  50. livio3d

    livio3d

    Joined:
    Feb 17, 2009
    Posts:
    145
    @SpookyCat yep i test the ignoreobjs and i find a way for do what i need, i have another problem now after various testing, i spawn various terrain chunk runtime, all work fine until i spawn a rotated chunk , if one of my prefab is rotated the scatter dont work, and other thing is there a way to use ignoreObjs without using raycast or surfaceobj?