No announcement yet.

How would I make a pickable berry bush/ flower/ etc (Unity)

  • Filter
  • Time
  • Show
Clear All
new posts

  • How would I make a pickable berry bush/ flower/ etc (Unity)

    So we're making a game where you can harvest some plants for resources, and planning to use speedtree for those plants. As we're working with the Unity version - it seems like we don't have any control over what textures get atlased during the export (which I'm not clear why this is, from what I've heard other versions do). If we were able to mark a mesh as "non atlased" I would just assign berries to that and disable the material instance when it gets picked.

    However right now the berries get atlassed together with my leaves and are part of the same material. Is there any way, short of maintaining 2 speedtree files for each pickable plant, that I could do this?

    Last edited by jalex; 11-08-2015, 10:16 PM.

  • #2
    Replying to say that I found - somewhat - of a solution, it was something that was inadvertently solved while solving another issue... but I'm not sure it's a true solution. Let me explain

    So I should correct myself above in stating that the behavior i'd like would be the ability to specify if a certain Leaf or frond gets its own material, not necessarily texture atlasing. It's probably a bit of an edge case sure, as normally you'd want as few materials per tree as possible, so you combine all Leafs into one, all Fronds into one, and the Branches into one right? However if I had 2 leaf groups, one "berries" and one "leaves", I'd want to be able to modulate the alpha cutoff on the berries without affecting the leaves.

    My other issue I was having was that the berries (just square cards) were looking bad when not auto facing the camera. Didn't want my leaves and branches facing the camera, but little red circles, just made sense. Once i found that option, I realized that by doing that it actually separated out the material for me (I assume out of necessity to have the 2 different camera behaviors).

    So that was great. You can see below that I've adjusted the alpha cutoff. And without changing the object out... berries, and ... no berries!

    Also with this method I can Lerp the growth so that they don't just "pop" in. Very promising, I like it!

    My question was..if I have a plant I want to harvest and for some reason, the pickable part, I don't want to auto face the camera - it would then be in the same material as my leaves, and this wouldn't be an option.

    I'd probably then resort to a texture swap, where I'd duplicate the atlas after generation and mask off the alpha in the pickable region? Oblivion / Skyrim used SpeedTree right? Did they do something like this?

    However, wouldn't be able to do any smooth lerping there for growth, and then that's an extra texture per plant I'd need to store (though thats not a big deal my textures are tiny).

    So - any way I could reliably force a certain Speedtree item to get a separate material in Unity?
    Or is there some other option I'm not seeing?

    (Uncompressed pics)

    Thanks for your support on here. It's been really fun to learn this stuff.
    Attached Files
    Last edited by jalex; 11-08-2015, 10:15 PM.


    • #3
      There is one draw call per geometry type per material. Materials that can be atlased are batched together to achieve faster rendering speed in-engine. What you did was switch the berries from "facing leaf" to "leaf" geometry type, which is why they were now broken out separately. Seems perfectly fine to do that, as you don't really want berried facing the camera anyway.

      There are options to affect the Compiler usage in the material, but the subscription versions of the Modeler have many things hidden/disabled to 1) be faster and easier to edit and 2) provide a smoother pipeline to get a good-performing tree into the final engine. I'm thinking that the compiler usage option most likely could be put back into the unity version, so I will log to look into it.

      Careful construction of your trees is probably the only option currently to be able to pull parts out of it in-game. In fact, you might want to even consider not using SpeedTree for the pickable parts. For instance, if you had minimal branch wind on a tree so the branches didn't move a whole lot, you could place things in the tree with a particle system. The SpeedTree leaves and twigs would still move, but using a particle system could free you up to do a lot of things like different kinds of pickables in the same tree, pickables falling out of the tree, etc. Just an idea.