Bug: Foliage "Clipping" In Front of Me

Hey there,

This happens when I paint some Foliage Type, rather than painting a static mesh of the same flower. I would rotate my camera and the foliage would just randomly appear and disappear, as if being culled. It’s not material dependent and if I replace the static mesh in the foliage type, it does nothing. No amount of property tweaking did anything.

Anyone got any workarounds? I’d rather not re-paint 5000 instances.

Best regards,
Damir H.

Edit 1: Ok, if I right click and hit “Replace with” and plug in a different foliage type, THAT foliage type retains the bug, and even acquires it in already existing types of that foliage, should there have been any. Seems that the “foliage slot” gets bugged.

Hello DamirH,

From what you describe it sounds like all of your LOD groups are being called at the same time instead of registering at different distances.

I have a bit more information that I would like to gather in order to narrow this problem down.

1.) What version of the engine are you using?
2.) If you are using the 4.9 version are you using the HLOD system?
3.) Does this only happen on one painted foliage mesh or on all of them?
4.) Can you link a screenshot of the clipping?

After I have this information I will attempt to recreate this issue and then investigate further.

Thank you,

Hey , before the answers note that the foliage this is happening with doesn’t have any LODs.

  1. 4.9.1, I noticed this bug earlier in 4.8.3 (might have been .2, can’t recall). I fixed it back then by just deleting the foliage and re-creating it again.
  2. Yes I am. Turning it off doesn’t do anything. (Do I have to rebuild anything for it to take effect?)
  3. It’s kind of hard to explain… Here’s my best attempt: Let’s say for instance it starts happening with FlowerA. I would walk around the one moment the flowers would be there, the other they wouldn’t (Probably important is the fact that they don’t all appear and disappear at the same time. There seems to be a narrow window at some points in the viewport where instances get culled). First thing I’d do is replace the static mesh of the foliage type to a cube or whatever… the bug would persist. I would duplicate the foliage type to FlowerA_2, right click on the thumb in the foliage editor and hit Replace WIth->FlowerA_2. The bug would persist. I would then do the same Replace With but use FlowerB, a foliage type that worked just fine and I already had them in the scene. This results in FlowerA disappearing from the foliage editor, and all its instances were added to FlowerB. However, now the bug happens to FlowerB, as if FlowerA brought it over. The only way to solve it is to delete FlowerA and re-add it, then paint it anew. In my experience this only happens with FoliageTypes, if I add the static mesh directly and don’t save it as a foliage type, the bug doesn’t appear.
  4. Here they are: Imgur: The magic of the Internet Just a slight camera adjustment makes or breaks it.

Hello DamirH,

I am currently looking into this issue for you. I am able to have the HLOD system work as expected in 4.8.3. It is in 4.9.1 that the HLOD system works sometimes and then doesn’t. I currently have a bump going on a previously entered bug that hopefully will be resolved. Unfortunately there isn’t much documentation on how this system is intended to work or some of the gotcha’s of setting it up. This could be a workflow issue and the development team comes back with working as intended.

I will keep you posted on this issues progress.

The bug number is UE-18688


I am sorry, I don’t follow, how is this a HLOD issue? It’s happening with painted foliage, with HLOD on and off, in 4.9 and 4.8 alike.

Ok, so you are saying that the foliage is clipping is occurring right in front of you.

In your painted foliage mesh Instance_Mesh Settings, what is you Cull Distance Set to?
If you find the mesh you used to paint inside of your content browser and you double click it to bring up your details panel, what is your LOD group set to? You can try setting this to Foliage. This will allow for the computations to occur as foliage painted instead of say a Base for a Static Mesh added to the level from your content browser. You should have an LOD0 group which is your standard base layer for calling what is on the screen.

Does this happen on any other meshes that you have painted or just the vines?
Do you have mesh distance field enabled in your Project Settings > Rendering > Lighting section?

If you have LOD0 and no other levels of LOD’s then HLOD will not calculate a group of LOD. I spent a bit of time researching and basically all that HLOD does is calculate when that LOD will be drawn. By default, if you only have one layer it can’t switch back and forward between it and another layer.

I would recommend just not using it at all.

Let me know the answers to the above questions and if you are willing I would like to see if this is mesh specific. If I could get a copy of that mesh and I can try and recreate the clipping on my end if the above mentioned troubleshoots don’t work.

Thank,

Well, there’s a bug in answerhub. If I type in a specific string my comment gets deleted. Gonna type it out again, this time ultra short version.

  1. Cull distance makes no difference
  2. LOD set to Foliage, no difference.
  3. Not mesh specific.

Exact Steps and Symptoms:

  1. Add foliage type to the foliage painter tool (as opposed to adding a static mesh directly and painting with that without saving it as a foliage type with the little save icon on the thumbnail). This bug only happens with foliage types to my knowledge.
  2. Paint the added foliage (in my case the vines). Eventually the bug starts happening.
  3. Replace the mesh in the foliage type asset, the bug is still there.
  4. Create a NEW foliage type, right click on the thumbnail of the buggy foliage type in the foliage painter, hit Replace With > MyNewFoliageType. The new foliage type retains the bug.
  5. Do the same replace, but instead of a new foliage type, use one that already exists in the scene, effectively merging the foliage types. The existing foliage will now start exhibiting the bug, as if it picked it up from the buggy one.

My best guess is that there’s some invalid transform that causes the cluster to get culled.

Let me know if you need any more clarification.

Answerhub is bugging out and deleting my comment, so here it is as a pastebin: Well, there's a bug in answerhub. If I type in a specific string my comment gets - Pastebin.com

Hello DamirH,

The foliage type is meant to be used with procedural foliage.

That process is to assign a foliage to a foliage type and then assign that foliage type to the foliage spawner. You can turn this on by going to your Editor Preferences > Experimental > Procedural Foliage. This will enable the procedural foliage system which will allow you to populate your scene with foliage inside of a specific volume. From there you can adjust the density and such inside of your Spawner.

Adding your foliage type to your foliage brush is not recommended for that workflow. Essentially what is happening is the foliage mode has it’s own system for calculating instance meshes inside of the scene. It takes mesh’s straight from your content browser and adds them to the foliage system, which spawns as one mesh system, then is able to calculate and draw in your viewport. The foliage type has a system of adding a static mesh’s to it’s draw call, and there are some functions in it, then it is added to it’s actual spawner system to be calculated when it is added to your viewport.

The foliage type, in itself, is not meant to be called as a spawning/call function. So what happens when you add it to the foliage brush is you call the foliage within the foliage type, then call the system for how that is called when it is added to the foliage brush. Then the foliage brush to calculate all of that and then draw it where you paint it. That is not the intended workflow for either the foliage mode or the foliage type.

I believe this is where the problem occurs.

Thanks,

Hey Damir. Sorry for the frustration with posting your comment. All of your posts were sent to Moderation, and I’ve approved one of them for you. I think it may have been caught by the spam filter due to a high amount of repetition (possibly the 15 uses of “foliage”). I’ll tweak the settings to try to be more accommodating. Cheers!

Ah, that clears things up! Sorry for spamming up the moderation queue and thanks for the clarification!

Hey ,

Unfortunately this has proven to be false. We started the whole map from scratch, painting static meshes instead of foliage types. Everything was well when we left the office yesterday, but this morning it started happening within 5 minutes.

We reloaded the non-bugged map and started experimenting… turns out it starts disappearing the moment we hit around 1.52k instances of the foliage. LOD group, cull distance, nothing makes a difference.

Weirdly enough, this doesn’t happen with all static meshes, only with the vines I showed you. But if we replace the static mesh to anything else it keeps happening.

Still doing experiments trying to figure out what is causing it…

Best regards,
Damir H.

Hey DamirH,

That is interesting. Honestly, there are very few troubleshoots left I can think of. Short of experimenting with your unique project I am at the end of my troubleshoots. Unless it is a unique issue with that particular mesh. In which case I can try and make a test project with that mesh and see if I get the same result.

Hey ,

I could strip down my project to the minimum and send it to you to replicate, would that be alright? I tried migrating the mesh to another project and it didn’t happen so I am out of ideas.

Best regards,
Damir H.

Hey DamirH,

That’ll be fine. As long as it still occurs in that project.

Awesome. I’ll do that tomorrow at the office. Due to the nature of the project though, could you give me a forum username or email I can send the dropbox link to, as I can’t post it publicly.

Sure. If you go to to the answer hub and then go to advance options, there will be a section to look for people on the forums. Type in my name there. From there you can send me a private message.

Awesome, I’ll send it in the morning then!

Hey , the Answerhub was down most of the day so I wasn’t able to write an answer - I found the culprint, and I have reproduction steps!

Namely, our game is using world composition. Our title screen is just a streamed level far off onto the side of the global world. Once the player starts the game, we teleport him to the global position of a spawn point, stream the surrounding levels and start the game.

In order for this to work properly, we had to be able to rebase the world origin to make sure that the player ends up placed at the correct location every time, since the automatic world origin rebasing sometimes shifted it around giving us incorrect results.

The solution I made was a very small utility blueprint that would just Rebase the world origin at BeginPlay, like this:


I’d pass in 0,0,0 and it all worked fine!

Enter, the problem.

In order to accommodate quick testing, we have a game mode that skips all the title screen shenanigans and just drops the player pawn right away. We then just hit a right-click and “Play From Here” and do our things. THIS is what caused the foliage to disappear for whatever contrived reason. The moment I turned off the world origin rebasing at the “Play From Here” game mode, the bug disappeared.

So in essence, the bug was caused by rebasing the world origin to 0,0,0 at BeginPlay.

Crazy world.

Ah,

Ok. Yeah crazy world. I’m glad you found the solution.