Download

Foliage Quesitons

Hello all. Been mucking about for a while now, but now I’m starting to really dig into the engine and how to implement different possible games in it. As such, I’m bumping into areas where there isn’t enough easily digestible information out there for a non-coder such as myself. So, please bear with me as I try eliminate my ignorance.
Now, correct me if I’m wrong, but as it stands, the only ways to get foliage into a scene are to paint it in by hand, or use an area/volume based blueprint to create the instances. There is currently no way to define a material so that any static mesh assigned that material will get foliage instances on it, is there? Is it perhaps possible to create a blueprint that can achieve this effect? If you can’t use a material to control where foliage appears (and what kind, etc.) would it be possible to create a blueprint that defines a static mesh with a boolean parameter that controls wether it has foliage on it or not?

Next, is it possible to “bake out” a foliage system into a group of instanced meshes. For example, first I use the foliage system to create a “forest”. Can I then take that forest, freeze it so it can’t possibly regenerate and look different, and then be able treat it like a regular static mesh, so I can move it around, rotate it, duplicate it, etc? This would be useful in a situation where a harvesting type mechanic is in play. That way, I could remove the “forest” from an area that has been harvested without affecting any other “forests” in the level.

Lastly (for now), my previous question sort of leads into this one. Is it possible to have more then one foliage system? Consider a multi-biome style landscape, I would want to be able to assign different foliage systems to different biomes, ideally merely by assigning a given material to the proper areas. Is this not possible with the current implementation? It seems that right now, foliage is a unique level wide entity, with no way to restrict which foliage meshes are used where. Am I mistaken in that understanding? If so, how would I go about implementing multiple foliage systems? Via blueprint?

Thank you all in advance for any information you can provide in helping me better understand this system Cheers,

J^2

Quick bump. Just wondering if there’s any more detailed info out there for this system. The tutorials are fine, if all you want to do is paint some trees on a landscape. I’m hoping to get more specific with my usage of the system, but I need somewhere to start. Any direction would be appreciated. Cheers,

J^2

Right now, there aren’t any environment or biome tools.

Until these are released (4.8 environment tools?), your best bet is using the landscape foliage tool. You can designate a very, very large brush, and have an assortment of instanced actors that are only painted on one layer (i.e, grass and flowers only appear on the grass layer).

Hope that helps!

Havoc, environment tools in 4.8? You have a source for that info?

They mentioned it in a stream and in some threads (will post you the links when I find them) :wink:

In a not exactly related question, does anyone know if it’s possible to access texture pixel data from within blueprint? I’d like to be able to use an image to help define areas on my mesh that can have foliage spawned. This would go a long way towards allowing me the functionality I need. Cheers,

J^2

And yet another question:

Is there a way to attach a foliage system to a static mesh? Let’s say I have a hexagonal mountain tile like this:

and I want to use the foliage system to put a forest on it. I can figure out how to get the foliage onto the mesh. However, I want to attach that foliage to the mesh so whenever I place that mountain, it has a forest on it. Is this even possible right now or do I have to manually place the trees and make a static mesh out of the forest? Perhaps create an empty actor and attach the forest and the mountain mesh as components? What is the best, more efficient way of getting this type of functionality? Ideally, by using the foliage system, each tile would get its own uniquely laid out forest. But it seems, as far as I can tell with the fiddling and tutorials I’ve done, that the foliage system is singular, meaning there’s only one for the whole level. Which makes it unusable in my situation as I will want forests with pine trees, or birch, or jungle trees and that’s not possible if it’s an all or nothing solution.

I’m really hoping that with the focus they had on the foliage system as shown in the GDC presentation on how they made the latest demo there will be much better documentation on what can and can’t be done with the foliage system. It’s such a powerful system that I think it deserves a lot more attention docs wise then it is getting. Hopefully the 4.8 release will change all that. Cheers,

J^2

No one has any suggestions? I’ve been diggin through the demo blueprint BP_Random_Foliage and it shows how you can detect if there’s a mesh under the spawn area and get the normal of that surface which I assume you can use to determine the slope of the surface, which is surely helpful, but is there a way to get the color of that point on the surface that you can get the normal from? If so, I could use that to determine not only if I can spawn something, but what would be best to spawn there. Sure would be nice… Anyone know if it’s possible? Cheers,

J^2

I can’t help at all with your questions, but Epic is doing a 4.8 foliage stream in a few days.
Link

Thanks for the heads up. I’ll be there for sure. Cheers,

J^2

I’ve been able to get a decent result of placing tree instances about my mesh using a blueprint, sourced from the BP_Random_Foliage demo, but I’ve hit something of a roadblock. I’ve created a sort of master tile blueprint that creates whatever type of hex tile it’s supposed to be by attaching a static mesh component of the appropriate type to itself, say a flat hex mesh if its a plains tile, or a mountain hex mesh if its a mountain tile. I figured it made sense to include the rest of the tile based logic, such as if there’s a forest, it makes sense to generate that forest as a series of instanced static meshes also attached as components. And that all works, aside from one little hiccup. I’m using the Line Trace By Channel node to find the height of the mesh’s surface to spawn on. I had to turn off Ignore Self to make that work. The problem is, it’s now spawning trees on top of other trees vertically.

Which makes perfect sense. It’s doing exactly what I am telling it to. Which isn’t necessarily what I want it to do. Is there a way to tell that node to ignore the other components of the BP? OR better yet, just have it look at the specific component I want it to? I can give it a list of other actors to ignore, but not a list of components. Does anyone know of a way around this? It seems a shame to have to separate out just this one function when I can keep all other generation code within the BP. Perhaps it would make sense to make an array of spawn points before adding the instances? But part of the logic is to look for other trees to avoid spawning them too close to each other. Hmm… I am stumped here, no pun intended. It seems pretty apparent that most of the code is aimed at actor level and above detection, not component level. However, I can think of at least a few cases where have component level ray cast collision would be useful. Am I just getting head of the engine designers? I know that the enhanced component functionality is relatively new and all. Should I post in the Answer Hub? I don’t want to waste anyones time with what is obviously not a bug… Any help would be greatly appreciated. Cheers,

J^2

Fixed! Ish.

So, I thought of a workaround. Basically, I decided to just limit the height at which a tree can spawn. It works. Mostly.

Still have a weird lil bug where it is spawning a tree at the origin of the mesh. Not sure why that is. Otherwise it’s looking OK. Cheers,

J^2

Great news, we need more foliage and nature improvement tools :slight_smile:

Yup. Back for more…

Hi all. So, I’m getting back around to poking at foliage. Right now, since we are procedurally building levels at runtime, we can’t really use any of the lovely foliage tools provided by Epic. I’ve created my own using the HISM class via Blueprint but we are seeing VERY disappointing performance when compared to foliage created using Epic’s tools. Let me do a quick breakdown of what we are trying to do and then throw out some numbers and images to properly illustrate my disappointment.

So, for those how haven’t seen it, I am working with Zeustiak’s Map Generator with the idea of making a Civ-ish type TBS game. As you can see in that thread, he’s come a very long way and can make some outstanding maps. I am doing my damnedest to help him out in the art asset/content area and having mixed results. The hand-made hex meshes look fine and the performance is also fine. The materials are meh at best and that’s definitely on my list of things to explore down the road but good enough for now. I bought the monthly Speedtree subscription and made 5 trees of each type of forest Z decided he wanted, Boreal, Coniferous, Deciduous, and Jungle. I then made a blueprint system for spawning forests by randomly choosing and placing trees from the proper type, etc. And it all looks OK. But the performance is abysmal. I’m getting nowhere near the performance I would expect when compared to foliage placed using the foliage generator in 4.8.

For example, if I make a forest using 4.8’s procedural foliage spawning system, I can get a LOT of trees on screen at once and still have a very good frame rate (over 60 FPS with thousands of trees). Here’s proof:

Now, trying to do something not even close to that level of complexity using the trees as HISM objects instead of foliage since we can’t use the foliage spawning system in a procedurally generated map (big sad sigh here), I can’t even have a few thousand trees in a scene without the frame rate dropping to single digits. Por Ejemplo:

Trees on (FPS is less then 4):

Trees off (technically, just had their visibility toggled, but FPS jumps to over 45):

These are the same trees in both examples. And I even have shadow casting turned OFF with the latter examples I’m working with where as the foliage spawner has shadows ON! Since if I toggle the trees off (I have a hotkey that toggles the visibility of the master HISM objects), frame rate becomes silky smooth I know it’s the trees causing the problem. So, I have to ask, is Epic eating their own dogfood with this new foliage system? Or is the new foliage system using some different, specially optimized object class that works better then the HISM available to us mere mortals? Perhaps there’s some trick to using the HISM that I don’t know about? I’d love to be able to get the performance I am seeing with the Foliage Generator but I need to have precise control over where the foliage is placed and I need to do that placement at runtime. Is anyone else trying to do anything remotely like this? Am I trying to make the engine do something it just can’t? Any advice or suggestions would be greatly appreciated. Cheers,

J^2

Anyone have a clue on this? I would particularly like to hear from a developer whether the Hierarchical Mesh is supposed to be on par with the foliage tool at this point or if it is still a work in progress.

We don’t know if the problem is our use of the node, or if the hierarchical instances just aren’t ready yet.