Announcement

Collapse
No announcement yet.

UE4, Lightmaps, and Billboard LODs

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

  • UE4, Lightmaps, and Billboard LODs

    Hello,

    I am a UE4 Licensee Developer and full SpeedTree Licensee (Cyan, Inc.).

    I'm in the process of troubleshooting some foliage lighting issues on Speed Tree grass/plants. Specifically, up until now, I have been using runtime-lit grass, to avoid unsightly lightmapping artifacts across multiple LODs. Due to some pretty gross limitations to UE4's ability to light runtime foliage across a large area with varied lighting conditions (it will only use a single indirect lighting cache sample for the entire system, no matter how large).... I am now in the process of attempting to get my foliage to play-nice with static lightmaps.

    So far it's going okay, but a major hurdle I can't seem to overcome is the ugly lightmapping that gets generated for billboard-level LODs.

    Here's a look at what I am seeing with a grass mesh with 3 LODs (2 mesh, and 1 billboard):



    As you can see, the lighting is fairly acceptable all the way down thru the first 2 LOD's, but once the switch to the billboard occurs, the lighting gets super gross.

    Here's a look at the lightmap UV's I'm generating in SpeedTree:

    Click image for larger version

Name:	ST_LOD-02.jpg
Views:	1
Size:	123.2 KB
ID:	3320

    I'm using a 16x16 lightmap, which works perfectly with the UV layout on the first 2 LODs, since each blade of grass gets its own texel. But as you can see, the billboard LODs seems to have been generated without respect to the higher-rez mesh's UV layout... So it's no surprise that the result looks like noisy garbage.

    I've looked, but I can't seem to find any documentation or discussion regarding how to resolve this disconnect. The billboard generation process seems to happen in a black box without any authoring input (at least inside Speed Tree's modeller)... other than specifying the "billboard atlas size" in the Tree Properties. Certainly no UV controls.

    What's the suggested workflow for this type of thing? Obviously, one option would be to forego the use of billboards altogether, and just use "3D mesh" distant grass.... but we have a large amount of foliage visible at all distances, and I am apprehensive about the performance impact, not to mention losing the option to force more billboards on lower-end hardware.

    Any advice would be extremely appreciated. Thanks in advance!

    -eaa
    Attached Files

  • #2
    Hello,

    Currently the billboard and 3d geometry can't share lightmap space, as you saw, so you can't have LOD from a 3d model down to a billboard all with baked lighting (you can have one or the other, or dynamic lighting).

    If you wanted to try something in the SpeedTree importer code, I bet you could multiply all the lightmap UVs in the 3d geometry by (0.5,1) to move them into the left half of the lightmap, and then do the same to the billboard lightmap uvs, but offset them by (0.5,0) so they're in the right side. 0.5 is arbitrary, you could make that whatever value you want to use more/less for the billboards, and you would only want to do this is both billboards and 3d geometry is present. This would allow both to coexist in the lightmap.

    This may add some small errors in the lighting, since the 3d geometry won't be falling exactly on texels, which is something we are very careful to do when computing the UVs in the Modeler. Eventually I'd like to leave room in the lightmap for billboards, and then fit the billboards into that area when possible when they are created.

    ...however, you may have an easier option. Low detail grass is little more than a billboard itself. Your lowest LOD on the grass model could be just a leaf or two with grass textures on it. This would let the Modeler handle everything, and your lightmap would be fine. Just import into UE4 without billboards.

    Hope this helps

    Comment


    • #3
      Thank you so much for this answer, Greg. Nowhere in the SpeedTree for Unreal documentation does it make mention of "3D+Billboards+Lightmaps=No Go", so I really appreciate the clarification. I will simply attempt to use very aggressive LOD on my 3D foliage to keep the polycount down. That was my next stop anyway, but it helps to hear from you that it's a legit solution the problem.

      Thanks much!
      -eaa

      Comment

      Working...
      X