Impostors broken

I was trying to use the megascan trees and noticed that while painting foliage with the foliage tool, all impostors are broken (all rotated in wrong direction).
Then I tryied to create my own impostors using the “impostor baker” plugin from Ryan Brucks and noticed that the same problem happens : impostors looks fine when dragging a static mesh from content browser to the viewport but using foliage tool or procedural tool breaks all impostors.

So I guess something has changed in the code of the instanced foliage actors class but can’t find where’s the problem.

1 Like

I’ve run into and fixed this, so I’ll try to explain. It’s been a while since I worked on it so my memory is a bit foggy but I’ll do my best.

The primary issue is that painted foliage doesn’t play nicely with WorldToLocal and LocalToWorld transforms in ThreeFrameBlend, so the fix is to use tangent space instead. (Apparently the quality is a little lower but I don’t see a difference)

Here’s a picture of one such change - the local to world is no longer wired up and instead it uses tangent space transforms.

As you can see in the first picture, there is a comment there about scale. To get the scale to work I multiplied by ObjectScale X in a couple places. There were a few places where “DefaultMeshSize” was used and in those places I multiplied Default Mesh Size by ObjectScale X instead of using DefaultMeshSize as is. (There are 3 such instances in my ThreeFrameBlend)

In that first picture you can see that I multiply the Tangent Space Transform node by Object Scale X as well - that’s the only place I use Object Scale as a multiplier for the tangent. So I have 4 uses of Object Scale total - 3 that multiply the three uses of “Default Mesh Size” and the one in that first picture. I can’t remember why I needed that one in the first picture but…I did. I think because it was transforming world to tangent to world again, which lost the scale, and the other tangent-transform related nodes are just transforming from world to tangent or a normal-type vector from tangent to world so the scale doesn’t matter…or something like that. (Again…been a while…)

Also there are a couple different octohedral impostor things online - I’m not sure if mine is a modified version of Ryan Brucks’ or of the other one you can find around, but I don’t think the ThreeFrameBlend is very different in either.

TL;DR:

  1. Use Tangent To World and World To Tangent transforms instead of Local to World and World to Local
  2. Multiply by Object Scale in a few places since tangent transforms don’t handle scale the same way world → local → world does

I don’t remember having to change anything other than ThreeFrameBlend - I made some other changes to support things like color variation in my version, but I think the scale / rotation problems were just in ThreeFrameBlend.

Hope that helps.

3 Likes

Thanks a lot! You saved my day)

1 Like

No problem - happy that someone found what I wrote useful

1 Like

I tried making your changes in the screenshots above and “maybe” its slightly better but still getting weird artifacting and especially when looking at them from above.

Can you confirm that for you it appears fixed and maybe I just need to find the right copy to modify ? (I was using the Megascans Tree’s one since I could easily test)

Apparently the new version of UE5 has impostor baking supported via plugin? My fix was for the UE5 preview version and based on the Ryan Brucks / Luciano thing (can’t remember which one, they are mostly interchangeable) With my fixes applied the impostors look pretty similar to the static meshes from every angle.

Yes I got it to technically work using the 4.27/5 ImpostorBaker plugin but the quality output looks so much worse than Luciano’s ones on his YT channel.

The intergrated plugin is the same that the one made by Ryan. It’s the same code.
I tryied your “fix” but it doesn’t work, it still has issues with rotation.
Also, with UE5 and Directx12, I now got a new issue with the impostor material: Impostors are pitch black, world normal visualization is black too, and a message shows on those impostors “your scene contains a skydome mesh with a sky material but it does not cover that part of the screen”.
I don’t understand the point of adding this plugin to the 5.0 engine while being 100% broken.

I’m planning on upgrading to the release version of 5 soon - once I do that I’ll try to revisit this thread with and updated fix.

The fix definitely does work looking top down in the UE5 preview version - maybe there is some weird case where it doesn’t work but if there is I haven’t run into it. Rotating foliage-painted trees looks fine on UE5 preview using my updated materials.

Ok, so the “your scene contains a skydome mesh with a sky material but it does not cover that part of the screen” issue is related to the pixel depth offset. If I don’t connect anything to this pin in the imposter material, the message goes away but obviously the impostor looks wrong (the shadowing part)

I’m having the same problem with Megascan trees
If they’re painted as Foliage with the Random Yaw option, then they don’t rotate correctly to face the camera. I tried @jmargaris fix but it didn’t work I’m probably too dumb

Hi ! Same as @Matthu23
It is still broken with Megascann tree’s and the random yaw in foliage.
Anyone can give us any insight ? @jmargaris ?
Thank you

Hello @Haoris @jmargaris @ShannenR @Matthu23 @MrVinceZ and everyone else! I’m facing the same issue with impostors in general. In 4.27 working perfect, migrate all to 5.1 and it is a nightmare.

Has anyone come with a fix for this? Really badly want to move to EU5 and this is the main thing stopping me!!! Thank you!!!

1 Like

Well part of the problem and what causes the black textures I believe is because the Imposter Material is using “ObjectScale” but UE5 Foliage Meshes Inherit from a new Parent class and you need to change it to use “FoliageScaleFactor”, the quality of the Imposters are still quite poor comparably though I feel. (Fornite now uses Nanite Trees so EPIC probably will probably not come back and fix / improve this Imposter plugin)

oh you need to connect a node called “Impostor Switch” something like that into your original material blue print, at the very end of you material attribute node.

Thanks to jmargaris, I solved my problem following your guide.

All changes are in one file [ Impostor_ThreeFrameBlend ]

First, use Tangent space instead of all the Local space. I modified 4 nodes:




Secondly, multiply 2 nodes by Object Scale X

the one above scaled the “display panel” (but not scaling the texture).

if only scale “display panel”, you will see this:

and the one below scaled the impostor texture itself.

then it goes correctly:

In my case, I used a [ MF_Impostor_ThreeFrameBlend ] file from Project - DreamscapeSeries, I found 3 other [ Object Scale X ] multiplied node, for reference only:



this file was verified in UE 5.2.1 and UE 5.3.1, it workd fine for Foliage / LandscapeGrassOuput / PCG Spawner usages.

Love from China.

1 Like

I’m glad you were able to figure it out - it seems like a lot of people had problems making it work so maybe my explanation wasn’t very good or different people used different versions with different problems.

Hopefully with your better images other people can also fix their issues - great work.

Hey there, thanks for your help you’ve almost completely fixed the problem for me. However now my imposters are rotated so that they are no longer orientated perpendicular to the ground like a tree should be, instead they float parallel to the ground. Would you have any idea how to get them to keep their correct rotation? They seem to keep the correct yaw rotation, but it has rotated 90 degrees on either the x or the y axis. Attached is a photo to help explain. The imposter is on the left and the static mesh before it changes lod to the imposter on the right.

FIXED: For anyone else having the same problem as me, follow all the steps @yexiang8411 but for all of the “World to tangent space” and “Tangent to world space” nodes, use “instance and particle space” instead of tangent. Fixed it for me, imposters back to how they should be.

EDITED: Found an issue where the imposters wouldn’t scale correctly with the original mesh. Attached screenshot shows fix. Had to remove the part where the “transform vector” nodes output is multiplied by “object scales” “Scale x” for all outputs EXCEPT the one that goes up to the “ADD” node close to the “ray origin” camera position node.

Interesting - I would note that there may be a difference when using painted foliage via a brush vs using a single instance. When you use painted foliage you end up with one large actor, so some of the transform / origin stuff is a little different. When I was trying to make it work I focused on brushes - it’s possible that one-off meshes behave a little differently.

(Maybe it also changes with versions)

Hey there.

I tested this on my trees as static mesh, single instance foliage, painted foliage and procedurally generated foliage and they all behave the same. I think it must just be unreal engine changing the way they do things behind the scenes all the time requiring a bit of tweaking. My game is a giant forest of painted and procedurally generated trees and all the imposters work perfectly now, and static mesh versions of the trees also behave the exact same way despite the material using “instance and particle space”.