Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GeNa - Sophisticated procedural content spawner

Discussion in 'Assets and Asset Store' started by AdamGoodrich, Oct 22, 2016.

  1. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    Hi Adam,I have two question.

    1、My "Draggable Rotation" function doesn't work,I checked Draggable Rotation,press the Shift Key and then drag the mouse with the left mouse button,there is just green visualiser,haven't arrow.

    2、I have a house model,when I spawn it,the spawn height is doesn't right,it into the terrain.
     

    Attached Files:

  2. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    I have never had any issues with draggable rotation - in fact its demo'd in the next video, so am not sure what is up here. Perhaps there is no active object selected ?

    To change the height of your house check its Y offset.
     
  3. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Here is my Unite presentation on World Creation in Unity. If you can get past the first 10 minutes off waffle, the rest of the presentation is all demo and it shows off a whole range of tools :)

     
  4. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    239
    Understand,thank you Adam.
     
  5. rastlin

    rastlin

    Joined:
    Jun 5, 2017
    Posts:
    127
    I've been trying GeNa in Unity 2017.3 RC2 and there seems to be a lot of issues with the asset. Not sure if it's caused by Unity problems or API changes, but the asset is barely usable. Here is the list of issues I noticed so far:
    • The spawner always spawns only ONE prototype instance, regardles of Max/Min Instance settings.
    • The visualizer seems to work funky, I see just a green circle, but not green "balls" in the editor. If I play a game and stop, the "balls" are displayed until I move the visualizer
    • The Global Spawn does not work, period. It results in the exception being logged in the unity console, I tracked it down to line 611 in Spawner class:
    Code (csharp):
    1.  
    2. #if UNITY_EDITOR
    3. if (!Application.isPlaying)
    4. {
    5.    if (EditorUtility.DisplayCancelableProgressBar("Spawning", displayName,
    6.        (x - minX) / (maxX - minX)))
    7.    {
    8.        Debug.LogWarning("Spawn cancelled by user.");
    9.        cancelled = true;
    10.        break;
    11.    }
    12. }
    13. #endif
    14.  
     
  6. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    This seems odd - GeNa has generally been very stable across releases.

    I did some lightmapping exploration on 2017.3 rc1 i think and found it to be really buggy so I deleted it off my machine.

    I will be updating GeNa shortly to add Vegetation Studio support, and will explore this as part of that - and hopefully after Unity has made the release more robust.
     
  7. rastlin

    rastlin

    Joined:
    Jun 5, 2017
    Posts:
    127
    Just updated to 2017.3 release, sadly none of my issues has gone away.

    Additionally I noticed there seems to be some weird things going on when baking the NavMesh with GeNa-spawned prefabs.

    When I place the prefab manually, the bake is respecting my NavMeshObstackle configuration for prefab. When I place the object via spawner, the prefab seems to have similar carve as manualy placed. However once I bake the NavMesh the obstacle mesh carve settings seems to be entirely ignored.

    I'm spawning the tree-prefab as Prefab, not as a terrain tree.

    From the looks of things, after bake the carving looks like it's based on mesh boundaries - I'm using build-in Nature-Tree shaders for the prefab as I'm doodling with the Trees in general.

    Image demonstrating the problem below:
     
  8. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Now that its released I will explore and see if I can replicate your issue. Please drop a message to https://proceduralworlds.freshdesk.com/support/home so that this does not drop through the cracks.
     
    BackwoodsGaming likes this.
  9. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    If anyone has been on the fence about any of my products - DevDog is doing a massive christmas giveaway and there are 5 copies of each of my products available as giveaways if you sign up today!!

    http://christmas.devdog.io/
     
  10. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Just tested in Unity 2017.3.0.f3 - had no issues spawning lots of instances as per image below. One little trick to be aware of... if your throw distance is substantially smaller than the object size, then GeNa will only ever attempt to place the next one within that range - and then the ensuing collision will stop that location being used.

    2017-12-22_10-25-50.png

    Again no issues - see visualization above.

    Worked for me, although I did get an exception. Will track into this. Unfortunately its very esoteric.

    GeNa just places prefabs and sets flags as necessary - check the flag settings on your prototype to check that your flags are correct for what you want to achieve.

    As general comment - I have largely done the work needed to support vegetation studio in GeNa. I will release an update in the next few weeks that removes the 2017.3 upgrade question, fixes the arrow cap warning, digs into that global spawn exception and also adds veg studio support.

    Any other issues please send them to my support system so I can track and ensure they are resolved in the next release.
     
  11. rastlin

    rastlin

    Joined:
    Jun 5, 2017
    Posts:
    127
    Thank you Adam for checking my issues.

    Based on you suggestion I checked my spawn criteria, and indeed all the behaviour was due to "Check Height" being selected and set to Min Height = 50 by default. I had a very levelled terrain, so in essence none of my area qualified, which resulted in only singular spawn. Interestingly this had an effect even if "Spawn criteria" check box was not selected as it's initially the case when you create a spawner.

    As for my NavMesh carving it indeed was related to the fact that GeNa selected a bunch of static flags, when I applied the to my manually spawned prefab, the result was the same.

    So besides the exception you noteced as well, I'm happy able to use all the neat features of GeNa, thank you :) .
     
    AdamGoodrich likes this.
  12. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Merry Christmas everyone!!

    I will be taking this week off so support will be sporadic!
     
  13. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    @RonnyDance Looks like what you did wrong was set the height of the original plane you used to create your POI incorrectly. The Y value should be -0.02 or -0.05 in order for the height of all your assets to be correctly configured when you drop them into the spawner.
     
  14. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Thanks adam you were fast as always. I deleted my post after fixing the wrong coords of the prefabs I found directly after posting.
    One thing is anyway causing me trouble.
    I have multiple house prefabs which are grouped:

    Like
    house1 is consisting of: house1 prefab, stair prefab etc.
    upload_2018-1-7_10-48-33.png upload_2018-1-7_10-51-47.png

    I can't drag them as prototype to gena. I want to spawn the whole village which is grouped in 3 groups:
    houses (all houses), props (all props), fences (all fences). Right now the problem is that I cant drag and drop any groups, I have to drag and drop the blue prefabs itself which would be lot of work and will not work with houses which are consisting of different prefabs like house 3. Any ideas? Gena can't detect groups of prefabs?

    Thanks as always!
     
    Last edited: Jan 7, 2018
  15. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Nope it can't and this is by design.

    From a design perspective a prefab is a group of elements that have been designed to work together - e.g. a 3D forge house is a collection of walls, floors etc.

    If I broke these apart and aligned them all to the terrain at spawn time - then the house would be destroyed.

    In a similar way - there is no way I can know what should be grouped or what shouldn't - so all high level prefabs are individually spawned - and then individually positioned, rotated etc in order to stay true to their respective layout when the POI was created.
     
    RonnyDance likes this.
  16. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Hmm thats sad, because the Asset Author just created the objects / prefabs like above in the screenshot and not like 3DForge.
    Can I fix this problem by creating an empty prefab myself putting house_03 (2) for example? If not I will have to spawn them by hand on terrain which is lot of work. Thought I can do it faster with GENA.

    Thanks again.
     
  17. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    You absolutely can do this faster with GeNa if you set it up right.

    Additionally you can save your spawners as prefabs, so you can re-use them over and over again.

    GeNa will spawn whatever prefabs you throw at it and they will get positioned and rotated based on their settings.

    If that prefab happens to be a whole bunch of houses... then GeNa will spawn them as a single unit and on anything but purely flat terrain that's going to be an issue.

    In the tutorial below you can see that every house is still a single prefab - and what is actually being dragged onto GeNa as a flat collection of individual objects.

    Tutorial here: http://www.procedural-worlds.com/gena/tutorials/poi-and-fence-spawning-in-unity-3d/

    Not sure how you did your setup - but if the childed group of buildings is not a prefab - then just unchild the buildings so that you have a flat structure - and then recreate the spawner.
     
    BackwoodsGaming likes this.
  18. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    By creating clean prefabs with everything nicely included (props, house etc) Gena works perfectly.
    Thanks again for the explanation and hint.

    One thing I noticed though:
    I have a big cementary POI ready with different prefabs which have different scales. Like some walls have 0.5, stones 1.5 etc.
    When spawning the Prototype with GENA the POI is not spawned right because the walls have all a minimum scale of 1. I saw the the "Same Scale XYZ" with Min Scale of 1in the Placement Criteria. I think thats the main issue, that I can't set the min scale to something below 1 like 0.1 so Gena takes the Scale I used when Prototyping the POI.

    Is this also intended? How can I spawn prototyped POI when having different scales for the Prefabs?
    Btw.I am talking about the Graveyard Demo Scene and Prefabs of Barts PBR Graveyard asset. (https://www.assetstore.unity3d.com/en/#!/content/58915).
    Pretty sure you also have the Asset ;)
     
    BackwoodsGaming and AdamGoodrich like this.
  19. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Disable integer only in global settings in order to get smaller scales. System in middle of unity update so i can't check.
     
  20. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Hello,

    Has a "NavMesh check" ever been considered for placement criteria? Or is there any way I could add this functionality to the current version?

    It would make Gena a very powerful enemy spawning tool when dealing with runtime enemy spawning across a variety of different landscapes/environments.

    I imagine it would have a lot of other good uses too.
     
  21. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Nice idea. I will add this into the roadmap!
     
  22. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    llJIMBOBll and MrG like this.
  23. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    Don't do it! its a trap!!! Lol, j/k, great group of people here. :)
     
  24. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Pfft! :)
     
    recon0303 likes this.
  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
     
    recon0303 likes this.
  26. emmcd3

    emmcd3

    Joined:
    Dec 16, 2012
    Posts:
    26
    Hi Adam,

    An idiots I can only spawn a tree at time. I'm having a devil of a time getting ctrl + shift + click to spawn across the terrain. I also do not get the grid as in the tutorials. I knew I shouldn't have ventured into the art studio world. :)
     
  27. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Well... assuming you asked GeNa to spawn more than 1 tree (by setting min and max instances).. then the next most likely offender is that your seed throw distance is too small..

    GeNa simulates natural growth over time by allowing each tree to 'throw a seed' that will turn into another tree. If the distance is too small (as compared to the size of the tree), then the seed will fail to germinate.

    Hard to say really as there is little information to go from in your post and GeNa has a range of things that influence the spawn.

    If you would like some more help join our discord server here: https://discord.gg/rtKn8rw
     
  28. emmcd3

    emmcd3

    Joined:
    Dec 16, 2012
    Posts:
    26

    Here is what I have for settings :
    Min style
    Max 211
    Throw distance 69.7
    Spaw range 69.7

    I didn't take at the console before, but, the root of it all might the following exception : "invalid operations ... opp station is not valid due to the current state of the object:.

    The settings look okay or should permit at least another object to be spawned. The console exception states that there is an invalid exception due to a
    The current state of the object.
     
  29. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Yep - that would seem to be the root of it - and being Unity could be from any number of causes. Feel free to reach out via Discord if you want to do a screen share - will only take a few mins to get you sorted.
     
  30. emmcd3

    emmcd3

    Joined:
    Dec 16, 2012
    Posts:
    26
    Thanks again for a quick response. Would same time tomorrow night be all right with you. I'm in SF, CA it is 1930 hours now . Would 1900 be suitable for you?
     
  31. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Just connect and reach out - if i am around i will help you out - tend to be fairly fluid.
     
  32. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    239
    Hi Adam,

    I've been using Gaia and Gena for a while now and I'm wondering if you have any ideas on how I can create trails (walking trails, animal trails etc.)?

    Thanks.
     
  33. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Hmm... easy roads perhaps ?

    I have something at the moment but its still not much more than a prototype.
     
  34. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    239
    I thought about easy roads. I can fiddle with that. If you can think of any other ideas, let me know. Thanks!
     
  35. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    239
    What would be ideal, is if after generating the terrain and adding the ground textures, I would have the ability to then go in and paint my trails. Then, when I run the spawners for objects, trees and grass, it would stay away from the path.
     
  36. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    239
    World Creator has this feature for roads & rivers. I guess they are using a mask type system that applies to a path so that textures can be applied to the trail/road/river. I have not licensed that asset, but here is a video example of how it works. I'm sure it's not trivial, but you can get an idea of how it might work. If you could do something like that, it would be epic. :D

     
  37. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    that would be really cool, then people are able to make paths all over the terrain... I have so big terrain so I cant paint small, and my road tools is terrain based so It cant make it smallen then the smallest brush and thats too big.
     
  38. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Hello! Is the Gena update released with the vegetationstudio intergration? :)
     
  39. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    No. Been focussing on the new CTS update and its tutorials.
     
  40. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Made this video on how to enhance a Gaia terrain with CTS last week. While obviously I am a big advocate of Gaia, you can create your environment any way you want.

     
    ScourgeGames likes this.
  41. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Allright thats cool no problem.. I just realized something that it would be cool if Global Spawn would only spawn from min height to nax height? is that possible to get the global spawn to follow rules? it takes such a long time to paint it all by hand..
     
  42. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Global spawn wont spawn below the min height (as a convenience) - and is already also constrained to the height range you select ... so you essentially already have this.

    It's a feature I really like as I use it to spawn different vegetation at different heights.
     
  43. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    hmm, okay.. well I set min hight to be really far up in the mountains so only the mountaintips are like "spawnable, like not blue" and the rest is blue wich is under the min height.... and hit global spawn, still it spawns the whole terrain....?
     
  44. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I appreciate 2018.1 is only just out, but GeNa is not wholly importing, so it seems. The menu item in GameObject is missing. No errors are generated, but what does import, does so very quickly, far moreso than in 2017.x. This is GeNa 1.5.0.2.
     
  45. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    Hmm. Oddly enough, the menu item just appeared. I had loaded Aquas, but that is broken for now, although I know there's an update coming. So I deleted that. Then an Aquas script in Enviro threw an error, so I deleted that entire folder, as I didn't need it. Then the Dreamteck welcome screen appeared out of nowhere and more Aquas errors, which were in an Editor folder, in the Assets root. Once I'd despatched that, GeNa appeared properly. Huh. Oh well, I'll plough on and see what happens next :D
     
  46. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Hi, I have a terrain and want to know if I can populate the terrain with an 50 enemies(enemy is a prefab) with only one click? I mean, it is possible to config a gena spawner to do that based in the terrain location and area?

    ps: enemies must be across all the terrain, not only in a specific part
     
    Last edited: May 4, 2018
  47. ScourgeGames

    ScourgeGames

    Joined:
    Aug 22, 2017
    Posts:
    239
    You could probably make it populate like that, but its placement is meant to be local to the place you are clicking. That being said, if you are going to put 50 enemies on your terrain, you should really consider using a realtime spawner with pooling.
     
  48. KristofferH

    KristofferH

    Joined:
    Oct 27, 2012
    Posts:
    52
    @AdamGoodrich Hi Adam, this is an interesting assets indeed, but I have a few questions that I haven't seen any information on.

    How does Gaia and GeNa handle Global Illumination? You're talking about fully procedural generation and real-time spawning, but how does this work with the Unity's GI system? Do you still have to bake all the GI within the Unity Editor after the scene has been constructed, and bake light probes for the dynamically spawned objects at run-time? I saw that it can automatically place light probes. So all of this procedural world generation is done inside the editor, right? And then you bake the lighting, and build the stand-alone game. Or, could you use Gaia and GeNa to procedurally generate an infinite terrain at run-time in the stand-alone game itself (without the editor's baking functionallity) and have it lit properly with Global Illumination?
     
  49. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    They both put stuff into your scene - its up to Unity to handle GI - and the whole thing with Unity GI is that its pre-computed - so you can't use it on runtime generated environments.

    However, GeNa also has the ability to modify the settings of things as they are placed into your scene. So for example it can automatically place light probes, and modify your object settings so that it uses them instead of being light map static - this can reduce your light baking time from many hours down to less than a minute. This is a editor only feature as unity do not expose these API's at runtime.

    Gaia can do editor and runtime spawning, but i do not support runtime spawing as it introduces a number of issues. There is a runtimestapmer.cs file there that you can look at if you are feeling brave. Gaia 2 will be able to do both editor mode and runtime infinite.

    GeNa does both editor and runtime spawning. You pre-configure it in editor mode and save that as a prefab, and then call it at runtime.
     
    KristofferH and StevenPicard like this.
  50. brackets

    brackets

    Joined:
    Jun 12, 2013
    Posts:
    1
    Hi everyone,

    Was unable to compile GeNa under 2018.2b7 due to the Unity build process becoming a bit more picky with regards to Editor-time vs Run-time. If Unity detects that a Editor-only method/property could potentially be called/accessed at runtime, it will throw an compile-time error. Here is my simple fix for the single GeNa error I got in Spawner.cs @1523. LightProbeGroup.positions is read-only at runtime; previous attempts to mutate would caused a runtime exception, but now are considered compile time errors. GeNa never actually executed this method at runtime, but for better or worse, Unity still considers it an error. To fix we just put editor guards around the body of the method. I left the definition intact so the documentation/definition is still available to your C# editor of choice.

    Code (CSharp):
    1.        
    2.         /// <summary>
    3.         /// Return probe group with the nearest probe to the given position, or create a new one
    4.         /// </summary>
    5.         /// <param name="position">Position to check for in world coordinates</param>
    6.         /// <param name="canAddNewProbes">Returns whether or not can add new probes at this location</param>
    7.         /// <returns>Nearest probe group or null</returns>
    8.         private LightProbeGroup GetOrCreateNearestProbeGroup(Vector3 position, out bool canAddNewProbes)
    9.         {
    10. #if UNITY_EDITOR
    11.             List<LightProbeGroup> probeGroups = m_probeManager.GetProbeGroups(position, m_minProbeDistance);
    12.             if (probeGroups.Count != 0)
    13.             {
    14.                 canAddNewProbes = false;
    15.                 return probeGroups[0];
    16.             }
    17.             else
    18.             {
    19.                 canAddNewProbes = true;
    20.                 probeGroups = m_probeManager.GetProbeGroups(position, m_minProbeGroupDistance);
    21.                 if (probeGroups.Count != 0)
    22.                 {
    23.                     return probeGroups[0];
    24.                 }
    25.                 else
    26.                 {
    27.                     //Create new probe group and return it
    28.                     GameObject probeGo = new GameObject(string.Format("Light Probe Group {0:0}x {1:0}z", position.x, position.z));
    29.                     probeGo.transform.position = position;
    30.                     if (m_probeParent == null)
    31.                     {
    32.                         m_probeParent = GameObject.Find("GeNa Light Probes");
    33.                         if (m_probeParent == null)
    34.                         {
    35.                             m_probeParent = new GameObject("GeNa Light Probes");
    36.                         }
    37.                     }
    38.                     probeGo.transform.parent = m_probeParent.transform;
    39.                     LightProbeGroup lpg = probeGo.AddComponent<LightProbeGroup>();
    40.                     lpg.probePositions = new Vector3[0];
    41.                     return lpg;
    42.                 }
    43.             }
    44. #else
    45.             throw new InvalidOperationException("This method is only available inside the Unity editor");
    46. #endif
    47.         }
    Hope this helps anyone using GeNa under Unity 2018.2b7 beta.