Search Unity

Any good solution for mobile VR trees?

Discussion in 'AR/VR (XR) Discussion' started by JoeStrout, May 15, 2020.

  1. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I'm driving myself nuts today trying to come up with an approach to trees that both looks good and performs well, for mobile (Quest) VR.

    upload_2020-5-15_10-57-22.png

    Here's a tree from WoW; you can see even on a flat screen that each tuft of leaves is an intersecting set of alpha-test planes. In VR, it'd look much worse, because with stereo vision those planes are going to be really obvious.

    We have an oak tree asset that uses a similar trick, but just throws a hella lot more planes at the problem. The interior of the tree is an absolute mess of overlapping polygons. It looks pretty good, but more than a couple of them in view causes the Quest to start skipping frames. I believe this is mainly because the overdraw factor is extremely high.

    Of course we could go with the low-poly tree look, where each tuft is essentially a mesh blob with a smooth (instead of properly jaggy) edge. But that doesn't really fit the visual style we would like.

    And of course for further away trees, we could use imposters. But an imposter for something as big and detailed as a tree would require a lot of texture RAM; more than a few of them and I think that would become its own problem.

    So I ask you... is there some other trick we can apply? Something that would let us define our tuft of leaves as a mesh blob, but have it look like it's made of leaves, with a ragged edge like real trees have?
     
  2. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    In general transparent shaders kill the quest frame rate ... if you can do without transparent textures and go higher polygon meshes (make the jaggy outline from polygons rather than alpha cutout) it works better. Shaders make a huuuuge difference also, play around until you can get a gpu instanced shader etc.

    I bet if you made a standard 'branch' out of lots of triangles and then copied it usig gpu instancing (so dont change colour or scale just rotation and location) you could make a pretty good tree .

    Add in some LOD scaling so cloae trees are higher poly, far trees are lower and I bet it would look great and run great also.

    Ive been trying to make huge forests for a flight sim and it is a real challenge.
     
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I don't believe GPU instancing has any advantage over ordinary static geometry, which is culled and batched automatically.

    I agree that transparency is expensive, but so are gazillions of triangles... and it takes so many triangles to make a decent tree this way. But yeah, maybe there's some good compromise in that direction. I'll keep exploring!
     
  4. RetroFlight

    RetroFlight

    Joined:
    Nov 16, 2019
    Posts:
    41
    Hmmm... when having lots of simple tree meshes I found gpu instancing significantly increased the amount I could render on the quest - like 10x as much for the same frame rate.
     
  5. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Won't be easy but definitely doable. You might want to take a look at vegetation studio and Amplify impostors. I've had very good luck with these on PC, especially with 2019.3 and URP. And that is in VR, single pass.

    think you might be able to use low poly trees on mobile (Quest) without much trouble. LOD's are your friend. Be aggressive with LODs. You will have work to get what you want though, it will not be drag and drop, plug and play. There is no magic or tricks, you will have to spend some time optimizing (using frustum culling/ LODs, textures and mesh optimizations).

     
    Last edited: May 26, 2020