Unreal Engine deletes foliage - help

So unreal engine deleted all my foliage for no reason after I opened my level. If someone can explain the cause of the problem, I will be so grateful. I dont think recovering my grass is possible anymore though.

I posted this issue 10 days ago but havent gotten any feedback. Turns out I had it on the wrong development category so hopefully this post will reach the right crowd in the right area. But anyway…

To put it simple, after I managed to fix a certain foliage issue, I ran into a new problem which was that after opening my level all the foliage had been deleted. I contacted the Megascans dev team, made sure Bridge was updated, everything… and in the end I was told that this was an unreal engine settings issue not megascans. and so they sent me a link to come here.

If there’s no way to recover my foliage that’s ok, but I really would like someone to let me know what may have caused the problem, and the Do’s and Dont’s, so I can avoid repeating that mistake in the future.

I’m currently a student in 3D so I’m still learning but if this had been made for a client, I would be devasted… So, I’d like to know how to avoid repeating this issue for the future.

For the time being I made a copy of my level and converted the level to “world partition”. But I honestly have no idea if that’s going to avoid unreal engine from deleting my foliage again. If converting my level to World Partition IS the solution, please let me know. Any info helps. thanks.

Here’s the link with all the details of the problem(its where I had written all my steps, software version I used, etc.) :

If you can replicate the issue, then provide steps for people to do so.

Otherwise, there really isnt much anyone can tell you unless they happen to have ran into the same issue and managed to fix it…

A couple of questions:

  1. Do you still see a InstancedFoliageActor in your outliner? If not, is it possible you deleted it? If so, click on it, then the “FoliageInstancedStaticMeshComponent” and check if the mesh is set correctly, the culling and check if there are actually any instances:

  1. Is your landscape scaled? I’ve seen a few people have issues when the Z of the landscape is scaled too much…

all steps and details are all written in the link I provided at the bottom of my post. :slight_smile: It’s a little long so I thought having to write it out again would be a hassle which is why I pasted it in at the bottom.

  1. Hello. and yeah the InstancedFoliageActor is still there now that you mention it. I checked all the folders too. there’s no extra InstancedFoliageActor, just 1 so far.

the culling distance is already set to 0. It’s been set to 0 since far before I even added grass. what else do I need to check?

quick question: “FoliageInstancedMeshComponent” where can I find that or is it a command? can you explain it to me a step by step? I wanna be sure I do this right.

and I doubt I deleted it because all foliage was still there when I closed unreal engine. and I remember saving it before closing it because I had to “save current level as” too. I use the same habit with any 3D software since thats what I was taught to do. Right now so far I have 6 levels saved. each in a different phase/progress stage of the project.

Here’s a more detailed step by step of what happened in case you need more info:

after I had fixed the first issue I had, which was only setting my grass LODs to 0 and converting it to nanite and so on(details are in the link I provided in the bottom of my post)… all I really did was focus on painting in my grass foliage in foliage mode, then added some rocks and bolders in selection mode(like maybe 7 or more). Didnt mess with commands or settings of anything in unreal. I will say that I did delete all of my grass at some point and started over. I wasnt happy with how my grass looked. But I cant remeber if I had deleted it with the delete brush in the foliage mode or if I actually deleted the InstancedFoliageActor…I think I used the delete brush due to the fact that the InstancedFoliageActor is still there even when all my grass is gone. but anyway, I decided to start over and paint in my grass again… finally I was pleased with it. first thing I do when I finished painting my grass was hit save. then I hit save then did “save current level as” to make a copy of my last progress in case of anything. then after that I closed unreal engine, a “save foliage” pops up and I click save all.

Next day, All I do is add and delete bolders and rocks, moved them around in selection mode. tried some assets like a fireplace from megascans or paths, I didnt like it so I removed it and stayed focused on just positioning the bolders in the right places for better composition. once that was done I saved everything and closed unreal engine and went about my day doing other activities. But I havent done anything crazy or messed with the commands or the grass textures and it’s settings at this stage of the project. thats why I’m so confused to why unreal engine decided to delete my foliage the next day when I opened the project. I didnt even do anything, all I did was open unreal engine, I allow it to update, once it was done I open the file, the project opens and I select to open the last level I saved, then as soon as the project finishes loading in, I noitce all my foliage is gone.

  1. is my landscape scaled? that I have no idea. could you explain that please? I’m still sort of new to unreal engine so there’s some stuff I’m still unfamiliar with(main softwares I use are Maya and Zbrush but I’ve been liking to use unreal engine more and more). I never messed around with the landscape settings. All I did was sculpt it in the “landscape mode” and painted the landscape. other than that I havent done anything out of the ordinary except use commands to set my culling distance at the start of the project when I needed to paint in my grass, but I haven’t used the command after I changed my grass LODs and all that stuff since. I like to try to avoid using commands as much as possible since I’m not familiar with it.

command I used: r.Raytracing.Geometry.InstancedStaticMeshes.Culling 0

I hope this is enough info. If there’s other questions you need me to answer or details you need know, let me know.

Seeing as the FoliageActor is still there, there’s a chance your foliage data is still there too.

The “FoliageInstancedMeshComponent” is a “Component”. Components are added to actors to give more functionality to the actor.

When you click on an actor, you’ll see any Components the actor has in the Details Panel at the top - in the case of the FoliageActors, they’re located below the “Root Component” (which is a small component used to store the actors transform).

In the snapshot below, I’ve framed in red the component to check, and framed the options that should be present. Click on the component to bring up its options in the panel.

If there are items in the “Instances” list it means most of the data is still there - it may be the static mesh is missing (just point it to the correct mesh).

Saving backups like that is what I do to - and it could help in this situation - if the Instances list is empty, you can open up another copy of your project, load one of the previous maps that has your foliage working, and just right-click on the Instances array and select “Copy” - then “Paste” that into your level that’s not working (right-click on Instances array, select “Paste”).

It sounds like there won’t be any landscape scaling going on as you’ve used the defaults - good to rule that out…

Alright thanks. I just followed your steps and everything’s grayed out? So I can’t use/change anything within the settings if I needed to. does this mean my foliage has been completely lost? :smiling_face_with_tear: here’s a screenshot

  1. I just checked my last saved file/level. The level we’re currently discussing is the Gen_6 level but now I’ve opened the Gen_5. the grass is there but it’s only half done. I was in the mid stage of almost finishing the grass but didn’t finish it as I did in Gen_6(which is what I lost). :smiling_face_with_tear: But I’m willing to take anything at this point :sob:

Worse case scenario… If there really is no way to recover my grass from Gen_6, do you know what the cause of it may have been? and how can I avoid it? and is converting my level to “world partition” something I need to do too to avoid it?

Because if there’s no way to recover my grass from Gen_6 then I’ll just have to use what I have which is to copy and paste the grass from Gen_5. But I dont want to repeat the mistake and have unreal engine permanently delete my foliage again. Of course I’ll be more careful and make more copies of my levels more frequently but, I can see the whole “copy and pasting” in my foliage every time unreal deletes it get old fast.

As for “instances array”…again I’m sorry but, where do I find that?

Also here’s a screenshot of what I see inside the FoliageActor within Gen_5(where the foliage isnt deleted).

Sorry for all the questions but thank you for being patient with me so far :sob:

1 Like

It looks like all the foliage components are missing - and it’s possible some of the foliage actors too. Maybe do a scan of your drive to make sure it didn’t corrupt anything…

I did a quick search to see if anyone else has experienced this, but all I found were some devs had lost references to the static meshes.

Maybe keep a backup of that map just in case more information comes to light, but it’s not looking good I’m afraid. (Maybe make a backup onto another drive too).

There’s another way of making grass and small foliage that you may find easier - and circumvents this issue:

Rather than painting the grass on with the foliage tool, you can use “Landscape Grass” - it works by assigning grass “types” (collections of your meshes along with settings similar to the foliage paint tool) to each material layer in your landscape material - so when you paint your landscape, the grass is automatically added in the correct places. Here’s some info:

1 Like

A copy and paste of the instances from where you have them to where you don’t should fix you up…
Depending on how many you paste in it could take time, but they can be pasted between engines just fine…

1 Like

Oh no, that really sucks. :worried: thank you for taking the time to help me though. and thank you for the link, I’m going to look into it. Will it help avoid the problem from happening again? or is there another process I need to follow? I’m scared it could happen again.

Note: it looks like not many people have had this issue except myself and a few others. But this one drew my attention. think you can look into it?

someone mentioned on reddit it could be that the world/level isnt set to “world partition” but it never got clarified if this worked or not. Thought maybe you could look into it and read what they said since you have more experience and knowledge than I do. here’s the link:

Unreal Engine decides to automatically deletes my foliage after level gets loaded, GRRRRRR : r/unrealengine (reddit.com)

I may have lost my foliage, but it will give me peace of mind knowing there is a secure way to avoid this from happening again. Again, thank you in advance.

Thank you, I was just discussing that with someone. and, is there a process you know that I can follow that could help avoid unreal engine from deleting my foliage again? I’m scared it could happen again. I’ve given as much detail as I could on what I did before the problem occured. you can see them written out here with my replies to RecourseDesign. you can check that out if you need more information. But if you need more info or have other questions just let me know.

Yeah, the fact that all the actual components are missing makes it look like some type of corruption happened - either your drive, or a crash while writing out data, or a glitch while writing out data.

I don’t think that Redit post will help - it sounds like they still have their components, but the instance list was cleared. World Partition wouldn’t help in this situation to get your grass back, and for a map 6km2 or less, is more work for the engine than not using it.

You won’t be able to copy/paste the instances themselves as the components are missing - but you could try and copy/paste the actual FoliageActors themselves - I haven’t tried it but it should work (as long as you still have all your FoliageTypes in the project) - that would at least get your Gen_5 foliage back.

Using LandscapeGrass would avoid the problem as it uses a slightly different approach - the foliage is added while the material is being painted.

It does pay to plan for things like that at all times though - regular saving, regular backups (different drives) - using source control is a great way to keep a backup that you can revert to any previous version of your project at any time. There’s 3 sure things in life - death, taxes and UE crashes…

Actually the engone doesnt care. It will paste null mesh instances if you dont have the correct foliage types within the foliage system.

Before pasting one should take care to initialize the foliage by paining at least 1 instance of whatever it is that needs to be painted in.

Re grass vs foliage:
You can only use grass nodes on landscapes.
Landscapes suck and are often replaced by meshes. So suggesting for someone to stick to the grass node isn’t very helpful towards future development - even if it would cure 1 problem out of the other 20 non grass meshes he probably needs to handle anyway.

As far as the rest;
Don’t focus on “is the engine going to do it again?” The answer to that is always yes.
Work around it.

A good way would be to use houdini to draft the level and import things into the engine.
It should be able to handle foliage instancing import/exports jusy fine by now (it could 2 years ago before going free).

That’s true… I was just thinking about that. I need that freedom and control over the foliage as I do with painting it. Using the other method instantly robs me of that ability. and that will be a problem for future projects since design and composition is so important. We’re taught to use foliage strategically a lot to help guide the viewer’s eyes in a scene. But I wont have that if I use the other method. and that’s a big problem.

We havent been introduced to Houdini yet so I have no clue how to use that program(yet).
so how can I work around the problem without Houdini and just use what is available to me in unreal engine? If I could, I would dive into Houdini straight away, I’m not afraid of trying new things but I am in a time crunch with this project… :cold_sweat: I know there’s no 100% concrete way to avoid this bug or whatever it is, but I know there’s those lower risk options to work around it. Any ideas?

How common is it for converting to mesh these days do you think? We use a combination of both at work…

I just had a quick look and I think I’ll add another tool to rdBPtools to harvest Landscape Grass into either ISMs or Foliage.

Given the newer architectures/systems it is slightly less common to reach a point where you just need to because of poor performance.
Still, I don’t particularly consider 30fps at 4k as acceptable, even if AAA game studios (EA?) do.
Since I know removing the landscape wins me around 20fps in the long run, I usually work with the assumption it will be baked to a mesh before release.

@mmosita10
You basically have to do things manually.

The foliage is a collection of transforms, like any instance collection /hierarchicalinstancedstaticmeshcomponent etc.

You can loop through the instances and output their transform in a print string.

This will generate text in your log file you can copy and paste.
(Usually has to be done in small batches to prevent the engine from calling the loop infinite even when it isn’t).

You then paste that to excel or anything you like to generate a CSV to use in the engine.

You then create a blueprint with a bluetility function to import that data back and add instances at the correct locations transforms.

Its a few hours of work for setup at most.
It enables you to spin up or move to just about any other engine in the long run.

Its a hands on code apparoach. Not an artist friendly one.
If you don’t care for that, there isnt much else you can do other than study up on Houdini…

2 Likes

dang, alright. Thank you for the help though. I appreciate you for taking the time to help me. I hope someday in the future someone or the devs of UE figure out what the core cause is and fix it. maybe it’s just a 5.2 issue but who knows. But at least we tried. for now I’ll just have to work with what I have since the project is due soon. I still have a lot to finish in the scene and other assignments to finish. so I dont think I’ll have time to try and figure things out with the grass. I’m just going to have to work with it for now and constantly make save copies. but I’m definitely going to get into Houdini and learn it during christmas break lol again, thank you.

I’ve had similar issue, foliage loads in the first few seconds then gets deleted after loading level:

Did you ever find out why this was happening? Did it happen again? I’m on 5.3 and this has just happened to me twice in a week!
Just one of my InstancedFoliageActors disappeared when I wasn’t even working in Foliage or Landscape or anything. I had to roll back on the svn and then it’s happened again today. But it only seems to happen to me, not other people working on the project…

I had the exact same issue.
My scene I saved yesterday and packaged was working nicely. Today i opened it up and almost all (all but a few instances) foliage was gone. I redid the work thinking i screwed up something or added the foliage in the wrong level repoplated my landscape with foliage (working in same level as the landscape). When i reload the level i see them for a couple of seconds and then they’re removed. In the instancedfoliageactor they’re still listed.