No announcement yet.

I tried to implement it so that it can be moved with UE5.1 +nanite+SpeedTree

  • Filter
  • Time
  • Show
Clear All
new posts

  • I tried to implement it so that it can be moved with UE5.1 +nanite+SpeedTree

    Nanite can only use 4 UV channels.
    But SpeedTree uses up to 8 UVs. This is because parameters for Pivot and LOD interpolation are embedded.
    So when Nanite is enabled, the UE SpeedTree node returns 0.
    It works in UE5 by disabling nanite.
    Therefore, normally the shaking of SpeedTree cannot be used.

    It works in UE5 by disabling nanite.

    If you want to make SpeedTree wind swing on nanite, I think the following will be the response.

    Choice 1:
    Modify SpeedTreeNode or create similar function.
     The UV channel has been reduced by nanite, so the hardcoded UV channel specification points out of range. This is the reason why the SpeedTreeNode is played so that it does not move during nanite.
    Therefore, create a new SpeedTreeNode and accept the Pivot position as an external parameter.

    Channels are stored as follows.
    "Of these, the one that is most related to shaking is
    Branch Wind XY
    Front Wind XY
    Frond Wind Z
    will be

    // SpeedTree texture coordinate setup
    // Branches Fronds Leaves Billboards
    // 0 Diffuse Diffuse Diffuse Diffuse
    // 1 Lightmap UV Lightmap UV Lightmap UV Lightmap UV (same as diffuse)
    // 2 Branch Wind XY Branch Wind XY Branch Wind XY
    // 4 LOD Z, Seam Amount LOD Z, 0 LOD Z, Anchor X
    // 5 Detail UV Frond Wind XY Anchor YZ
    // 6 Seam UV Frond Wind Z, 0 Leaf Wind XY
    // 7 0 0 Leaf Wind Z, Leaf Group

    Among these, what is necessary for the main movement is
    Branch Wind XY
    Front Wind XY
    Frond Wind Z
    one of.

    In other words, the UVs are some Remove and arranged on the UE (the MetaData of SpeedTree is necessary, so it is done on the on UE).
    // 0 Diffuse
    // 1 Branch Wind XY
    // 2 Front Wind XY
    // 3 Front Wind Z

    The newly created SpeedTreeNode will pass this Pivot position from outside and calculate it.
    However, if we were to create a new version of SpeedTreeNode, we would need to modify the engine a bit.

    Choice 2;
    The video is SpeedTree data + nanite enabled.
    I'm adjusting the UVs like I'm doing in Choice 1.

    The difference will be a reimplementation of the SpeedTree sway in the material node.
    However, since the Curve information brought from SpeedTree cannot be used, a similar function was implemented. (Rough calculations combined from shader code in Unreal Engine)
    This way you can use the Pivot embedded in SpeedTree.

    Click image for larger version

Name:	NaniteTest.png
Views:	777
Size:	1.02 MB
ID:	12522

  • #2
    Hi can you elaborate more on this ? i see there's a SpeedTreeimportFactory, i can open it with visual studio, should we recompile it?
    Last edited by nicolas_nqn; 07-18-2023, 08:19 PM.