Search Unity

Red Herring's Multi-Level Shrubbery Creator

Discussion in 'Assets and Asset Store' started by duhprey, Nov 8, 2013.

  1. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Great Update.

    Really enjoying using the plugin. Recently there is a new asset MegaScatter https://www.assetstore.unity3d.com/#/content/14954

    It would be so awesome if you could add some similar functionality in a future update. In particular, the empty spline scatter.

    Request: The origin of the painted combined mesh is currently at world zero, please add an option for the origin to be the same as the mesh object that is painted on.

    Keep up the excellent work.

    Edit: MegaScatter also includes the source. Would you consider including the source with this package because it makes things easier when we have to customize it for our project.

    Cheers.
     
    Last edited: Feb 8, 2014
  2. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Good update! The wind gusts looked brilliant anyways, and the coverage maps are exactly what I wanted to make this the very useful tool I wanted it to be
     
  3. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    We may end up releasing the code in a future update.

    Hopefully if it works out the combined mesh will be positioned where the painted mesh is and move along with it. As well as other editor issues people have discovered, like a lack of multiobject editing. We'll be looking to allow any shader on there and look into splines, too, since that's been requested before.

    Thanks again for purchasing and trying it out. I'm glad you guys like it. Please consider writing a review too in hopes maybe others will pick it up :)
     
  4. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    Is there any "combining" optimization for saving draw calls in this tool?
     
  5. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    In a way, combining is the most basic function of this tool. Instead of creating separate instances, it paints each new quad of grass into a single object. At least until the object is too large (64k vertices). Then it starts a new object.

    Same with the detail meshes although you can paint many fewer because each detail is many more faces than 1 quad.
     
  6. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Version 1.8 has hit the asset store. I look forward to your feedback.
     
  7. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    A couple of points, hitting ctrl-z removes the script altogether (might have already mentioned this)
    and trying to load a mesh (simple cube) causes Unity to stop responding, have to hard close.
    Sorry, for only reporting negatives.
     
  8. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    I see what you mean about hitting ctrl-z. I'll add that to the list.

    What do you mean about loading the mesh?
     
  9. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Loading a mesh instead of grass.
     
  10. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    So you load a cube with the detail mesh panel and then it crashes? Is that immediate crash or after painting?

    Did you load a texture for the cube?
     
  11. stiltskin

    stiltskin

    Joined:
    Feb 27, 2010
    Posts:
    95
    hi Duhprey,

    really nice plugin! I have some questions for you -

    1- are there any plans to be able to paint on unity terrains? It doesn't work right now. That may sound like a crazy request, but the terrain's built-in grass shader is terrible and I would love to place the grass using your system instead.

    2- I made a prefab with painted grass but i have a few problems. First, the grass seems to be stuck where it's painted in the world so the concept of a prefab is broken. The other issue is that I all my other instances don't even have grass on them.

    Do these questions make any sense?

    OK, thanks!
     
  12. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    The questions do make sense.

    1. I'm surprised it doesn't work on Unity Terrains. I'll add that to the bug list. I never thought to check :) But now that we have the wind working we hoped people might like it better than the default unity grass in some cases.

    2. That one I am aware of. To be honest, we assumed this would only be used on static built levels, so we're trying to fit in things like moving objects, duplicating them, multi-object editing. All the usual unity stuff which is currently breaking. Unfortunately it also changes a lot of assumptions so it'll take some time. But that will be the next release (plus a few other features like the ability to swap out our shaders with your own).

    Just a note, this won't ever work on skinned meshes, but we're contemplating making a similar kind of hair/fur painter asset that works like the grass here, but is specialized for skinned meshes and animates based on movement as well as wind...

    Thanks for trying it out.
     
  13. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    I was thinking this looked like it would be useful for my levels which are constructed of reusable prefabs in the editor (not run time) but I didn't realize it didn't support that sort of workflow. Looking forward to prefab support!
     
  14. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    I think this tool is lacking the option to add a random rotation variation for the painted meshes.
     
  15. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    @angel_m, I'm not sure what you mean. It currently does a uniform random rotation around the normal vector for each object. Do you mean the ability to make that less random? Like a parameter from 0 - 1 (the current way == 1)?
     
  16. Mark Terry

    Mark Terry

    Joined:
    Nov 30, 2013
    Posts:
    3
    Loving this plugin! I've spend weeks now trying to work out the best way to create a large field of grass on a mobile. This is so easy to use and so far is running at a good speed. I think any slow-down is probably all the alpha transparency (which my iPhone seems to hate), and especially because I'm setting my character height to be about 30cm so a lot of the screen is literally covered in layers of alpha-tested grass. Still experimenting with the best balance of "coverage" of grass and frame rate.

    Because of this, I had to reduce the number of grass elements from the simply crazy amount that is possible on a desktop, but still ends up showing more grass than the Unity Terrain. And now I find that when I optimize distributions I only get one green circle in a very large area. Am I right in thinking that the grass culling happens based on these clusters? In which case can we have an option for setting the number of elements in a cluster. I think you mention 16,000 instances? So for a sparser planting of grass to run at a good rate on mobiles could we either set this number lower, or, perhaps even more usefully, the maximum radius of a cluster?
     
  17. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Those are good suggestions for the clustering. You're right the green circle represents where the culling is going to happen. Initially the cluster implementation was trying to take into account putting as many grass instances into one cluster as possible to reduce overall draw calls. But there is likely a few different parameters, like cluster radius you suggest, that would help balance draw calls with overdraw and mobile performance.

    we're also considering an alternate clustering that puts grass into a grid and treats grid spaces as clusters. This would be many more draw calls than currently, but could do wonders for culling.

    We hadn't really targeted mobile initially, but it seems like there's some interest. Once we resolve the bugs we're working on for 2.0 (prefabs, moving targets, multiobject editing) we'll take a look at ways to optimize for mobile.

    Thanks,
     
  18. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    I'm mainly on Mobile and experiencing the same problems.

    +1 for mobile please. Otherwise, awesome asset.
     
  19. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    "Once we resolve the bugs we're working on for 2.0 (prefabs, moving targets, multiobject editing)"


    Cool!
     
  20. thehen2

    thehen2

    Joined:
    Apr 1, 2014
    Posts:
    54
    Just wanted to say that this is the best asset I've bought yet. Incredibly valuable and couldn't build my art style without it.
     
  21. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Thought I'd give a quick status update. We've got all the features in that we've been targetting for this release. We're just doing cleanup now, hoping to submit the update either this week or next.

    Also a reminder, we'll be raising the price for this version from $15 to $30. So if you've been thinking about getting it, now would be the time! :)

    Thanks for all the kind words!
     
  22. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Hmm, seems adding the script to as object with a hole in it blocks the hole with some sort of collider.
    Seen this or addressed it?

    Thanks
     
  23. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    I haven't seen that. I'll have to play around with what's going on there.
     
  24. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Yeah, after thinking about it, I have another cave setup in another scene that works fine, could be because this one has a door parented to the main object I am painting grass on.
     
  25. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Version 2 has been submitted to the asset store. It should be up shortly. There are a few new features as described before, but this version also breaks backwards compatibility. So if you have existing grass paints in a project don't upgrade it to this version. I'll make a new video demoing all the latest features this weekend.

    Thanks,
     
  26. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    I just started using Shrubbery. I've been looking for something like this for YEARS. A couple of things stand out to me though...

    1. When I use a Coverage Map, half the landscape works, the other half either gets no grass or a less dense amount. When I say half I mean there's an exact line through the middle so the bottom half works and the top half doesn't. I thought it might have been to do with my UV's but it happens regardless of changes I make to them. As I try it again right now it seems to be working, weird. Any idea what might cause that?

    2. The Vertical option seems to not work too well with Detail Meshes (Grass works just fine). If I turn it right up to 1, I want every object to follow the surface normals. On flat ground they all point up as they should, but on slopes they don't follow the slope normals any more. Their angle becomes more random.

    3. When I start painting grass down, these red boxes appear and become ridiculously dense making it hard to see what I'm doing. Hitting play then stopping seems to be the only way to clear them. But they come back as soon as I paint some more. Can they just be turned off? The green spheres as well (which don't go away after playing). Seems like they should be hidden away by default until you want to check them.
     
  27. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    @FractalCore, Awesome, thanks for the support.

    I'm not sure what to think about the Coverage Map issue in #1, I'll look into that. Number 2 sounds more straight forward to fix. And then good point about 3, those are aids to help understand grass distribution, but turning them off is a good option to have. I'll put all three onto our bug list.

    Thanks again for the feedback.
     
  28. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    is there any performance test on mobile with this vs terrain grass?
     
  29. jharger

    jharger

    Joined:
    Jul 22, 2011
    Posts:
    11
    Hi,

    We have tested in on mobile by itself, and the results seemed reasonable on a somewhat complex scene. However, we've never done any comparison against terrain grass.

    Thanks for the interest!
     
  30. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    can you elaborate a bit? what device was used and what fps it got?
    also it would be great if you could create an apk with the demo and share it publicly, so we can test on our phones before purchasing.
     
  31. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    While I don't know what device jharger used, I think it was an iphone4, the speed was over 30fps (maybe 50?) but it wasn't really a stress test. I think the better solution is to make an apk avaliable to test it.
     
  32. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Hi, any progress on that APK file? it should take 5 minutes to compile and upload... I just want to test it out on a mobile before deciding to purchase
     
  33. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Sorry, I haven't received notifications of these messages! I'll take a look at it soon for Unity 5.

    It is clustered by locality (if you press cluster). I've been considering a distance limit on the clusters (currently only count limit using k means).

    The shader can be replaced, but it is an alpha test version that's there by default.

    While I'm at it I'll look into building an apk.
     
    hippocoder likes this.
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looking forward to the update :)
     
  35. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    The update is in the asset store. There may be some bugs present, but I'll fix them as I can. It seems to work at least in the general case.

    Here's an APK test.

    I'll be curious to hear how it runs on other devices.
     
  36. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Ok, on a Samsung Galaxy S4 (pretty powerful device), I doubt it goes to more than 7 fps. Hard to tell because it has no fps counter but definitely not usable.
    On a Nexus 7... 1 fps maybe?
    In short, this won't work at all on mobile unless you have a Galaxy S6 or an iPhone 6 which are as powerful as a laptop.
    The main problem is that since it uses the standard Unity grass, it is slow to snail speed. Unity grass is very very very slow on mobile if you try to create anything with lot of foliage.

    It would need a whole bunch of tricks for this to work. Like merging the triangles manually after they are placed so they batch better. And also LOD system that on distance they will merge to even lower quality grass with less definition.
     
  37. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    That's a good point. I should have enabled the optimizations that are available.

    Here is a version with those.

    Please also try this version to compare.

    I'm not sure what you mean by "Standard Unity grass" but if you mean the terrain grass that isn't true. Its using a different shader and different code to generate the grass mesh.

    Otherwise all those tricks you mention are being done. Both versions are running 1 million triangles of grass. This optimized version reclusters the grass by locality, allowing it to disable about half the grass (those sections behind you) and disables the grass at the far corners. It fades in gradually, but you can't see that as I haven't added movement to this mobile demo. It's very easy to see in the editor though if you grab a copy (once it updates in the asset store) :)

    Edit: I forgot to mention this asset store update will contain the code.
     
    twobob likes this.
  38. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Why oh why do I always find these things a few weeks after I should. Looks amazing.
    Added to wishlist.
     
  39. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    the new apk runs slightly faster, maybe to 9 fps vs 7 fps on a Samsung galaxy 4, but still way too slow.
    If I look down, it runs fast, but if I look horizontal (like you would when walking), it slows too much. I don't know if you have some distance variable that it can switch to a faster method at a closer distance, otherwise it's of no use for most cases on mobile the way it is right now.
    what mobile device do you have to give it a try?
     
  40. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    I'm not sure a whole lot can be done to speed things up beyond that. I was pushing the limits with that demo, realistically if you want to use this tool for mobile I wouldn't paint a million grass textures in such a small region (30x30 meters). Maybe keep it to thousands or tens of thousands.

    Or if your level is big enough of course you can paint millions and the grass in the distance will not be drawn. So it's really about keeping the density of grass in any particular place much lower than what I put in that demo.
     
  41. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
  42. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    I haven't used it, but it appears Tom's using a different, but complimentary, technique. This is a replacement for Unity's terrain grass except that this can be used on any surface and not limited to terrain. Tom mentions that his method is meant for dense base grass and could be complimentary to methods like this, bringing in other foliage on top of the base.
     
  43. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Shrubbery is updated on the asset store now. I am working on some solutions to stop letting you add grass before you run out of memory, but for the time being it's wise to avoid adding too much grass in one area, for a variety of reasons (including performance at runtime). Once I figure out a good number for "too much" I'll put that into the code :)
     
  44. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    @duhprey
    I'm importing this into Unity 5.1.2f1 and I'm getting these warnings...

    Assets/Shrubbery/WindZoneAdapter.cs(82,155): warning CS1030: #warning: `Currently untested in any version other than Unity 4.3! However, you may remove this conditional compiler flag and use at your own risk!'

    Assets/Shrubbery/Editor/LightmapTool.cs(102,79): warning CS0618: `UnityEngine.LightmapSettings.bakedColorSpace' is obsolete: `bakedColorSpace is no longer valid. Use QualitySettings.desiredColorSpace.'

    Assets/Shrubbery/Editor/ShrubberyEditor.cs(541,36): warning CS0618: `UnityEngine.Renderer.castShadows' is obsolete: `Property castShadows has been deprecated. Use shadowCastingMode instead.'

    Assets/Shrubbery/Editor/ShrubberyEditor.cs(552,53): warning CS0618: `UnityEngine.Renderer.castShadows' is obsolete: `Property castShadows has been deprecated. Use shadowCastingMode instead.'

    Assets/Shrubbery/Editor/ShrubberyEditor.cs(378,15): warning CS0219: The variable `e' is assigned but its value is never used
     
  45. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Hi Licarell,

    Thanks for the heads up. I will get those out of there.

    Note, only the first one implies any issue with running and only if attempting to use terrain windows rather than custom defined.
     
  46. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    That's awesome Thanks!
     
  47. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Hi, I purchased this for a specific job and I am having problems with it. I can get it attached to the mesh, get the grass texture loaded and the brush activated. However, the brush will create a few grass details and then freeze. Twice I have had to shut down Unity from the task manager, something that rarely happens.

    I have one 14 tris rectangular mesh and one low resolution grass mesh with alpha. Nothing else is in the scene at all.

    I am getting the following error: Overflow Exception: Number overflow.

    Unfortunately, I can find no other tool that will paint grass textures on a mesh so am hoping you can help me get this to work.

    Thanks.
     
  48. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    For general benefit,

    This problem was related to scale. It should work to let you scale the target surface to something other than 1, but it isnt. The easy work around for now is to scale on import or in the modeler before it gets to Unity.

    There probably won't be a fix to changing the scale after you start drawing. I'm not sure there's a way around that one...

    Thanks,
    Duhprey.
     
    Teila likes this.
  49. NightmarexGR

    NightmarexGR

    Joined:
    Jun 7, 2012
    Posts:
    217
    Hello , can i use this plugin for fur in animated objects or skinned meshes ?
     
  50. duhprey

    duhprey

    Joined:
    Nov 13, 2009
    Posts:
    166
    Good question, its very close, but I don't think it'd work as yet for fur. I'd probably need to write something quite a bit different to handle the underlying skin motion (and to make sure the fur's momentum made sense relative that motion).

    The code is available in the latest version, so you have a starting point in that...