Announcement

Collapse
No announcement yet.

Massive problem with LODs in UE4

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Massive problem with LODs in UE4

    Hello, our studio has been having serious issues when importing trees into the engine.

    We're using SpeedTree version v7.1.7 and Unreal 4.18 for our pipeline. Our trees are usually around 7-11k so we need to use LODs so it doesn't heavily impact performance. Within SpeedTree, the LODs work fine and change smoothly from one LOD to another depending on camera distance.

    The problem is when we import them to Unreal (Enabling all options and importing them as painted foliage). When importing as painted foliage, the Smooth LODs don't work and don't match the LODs 1,2 and 3 thus producing popping. Please see screenshots provided. The smoothing works but it doesn't match the LOD changes.

    When importing as individual actors, the screen size scale is reduced greatly so the LODs only start to work at a very long distance.

    We don't know what's causing the issue. We tried to work with the very limited LOD settings in Speedtree that only let us change the screen area scale, but it doesn't affect the LODs in the slightest once imported into unreal. The SpeedTree compiler doesn't give us any other options either, and trying to manually set the LODs in unreal (By importing a speedtree tree with no automatic LODs) crashes the engine. The only solution we have seen is to manually set the screen size scale in the mesh properties, but that would cost us too much time we can't really afford.

    Is this a known issue? Are there any solutions? Is it possible to set the LODs manually in SpeedTree or is there no other option?

    We'd appreciate any input or advice.
    Last edited by morningstar666; 01-18-2018, 06:17 AM.

  • #2
    Hello,

    You most likely just need to tweak the lod in UE4, by adjusting the screen size options on each lod in the StaticMesh editor.


    However, there is a bug in the past few versions that causes smooth LOD on actor trees to be a little erratic. This will be fixed in 4.19 (the preview is out now).

    If you're comfortable editing shaders, you could merge the fix in yourself, as well. If you look in MaterialTemplate.usf, find the section computing LodInterp value near the top of GetSpeedTreeVertexOffsetInner(). Replace the current calculation (the part within the #if) with the following, and smooth LOD should work much better on actor trees.

    Code:
    float LodInterp = 1.0;
    #if !USE_INSTANCING || !USE_DITHERED_LOD_TRANSITION
        if (LODType == SPEEDTREE_LOD_TYPE_SMOOTH)
        {
            const float Dist = length(TreePos - ResolvedView.WorldCameraOrigin);
            const float ScreenMultiple = 0.5 * max(ResolvedView.ViewToClip[0][0], ResolvedView.ViewToClip[1][1]);
            const float ScreenRadius = 2.0 * ScreenMultiple * Primitive.ObjectWorldPositionAndRadius.w / max(1.0, Dist);
            LodInterp = saturate((ScreenRadius - SpeedTreeLODInfo.x) / SpeedTreeLODInfo.z);
        }
    #endif


    Hope this helps

    Comment


    • #3
      Hello Greg,

      Thank you so much, this was the issue that messed with the LODs, and switching to the 4.19 preview resolves the issue.

      Comment


      • #4
        Sorry for the double post, but we have just checked again and it works /if/ we manually/individually place the trees. But if we try to use the paint foliage feature the lods have the same problem again. We are importing them as painted foliage, should we re-import as individual actors? Do you know if the 4.19 update will also fix this issue?

        Comment


        • #5
          SpeedTree-style smooth LOD doesn't work on painted foliage, as the information needed to do it correctly isn't available. You can either have the LOD pop there, or you can use LOD crossfading.

          Comment

          Working...
          X