Search Unity

Showcase Able to render trees in Quest 2 fast!

Discussion in 'VR' started by creat327, May 3, 2021.

  1. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Finally!

    After a few days and after searching the internet and the forum for ages, I figured out how to render Unity trees in built-in going from less than 10fps to 72fps in Oculus Quest 2.

    It made no sense to me that my android from 2015 was able to render it at 40fps and the Oculus Quest 2 couldn´t even handle it at 10fps. People on the forum said that the Oculus couldn't render trees fast. Sorry, but that's not true. Unity CANNOT bother to check its own shaders. I tested in Unreal and the speed was ridiculously faster so I decided to spend the time to track it down.

    1) Unity does not do GPU instancing on android and built-in. Why? I don't know. It's known issue since 2017 and for the same reason they took 2 years to fix the trees rotating with the VR camera, they just decided not to ever fix this.

    2) The VR tree shaders in Unity are a piece of junk. I would use another icon more explicitly. I replaced it with my own custom shader and bang, x8 performance gain. All Unity needs to solve this is to write a freaking terrain with a forest and test it on Oculus Quest. Instead of spending time doing whatever they are doing with URP/HDRP / DSFLSKDFJLDSKFJSDFJDDFSD system... you have a built-in system that was HYPER fast ages ago and keep ignoring it as if it never existed. It was fast, super-fast, you destroyed and neglected it.

    Need the shader? Sure, I'll release it for free when Unity releases a decent water package that hasn't been looked at in a decade. Or when they fix GPU Instancing for Trees in built-in. Calculating that after a decade they just allow people to release a thousand packages instead of creating something that should be standard... good luck.

    The other option is I upload it as a paid asset, which seems to be the norm now to do with things that should be standard in Unity. Soon you'll need to download paid assets just to move the mouse on screen unless you "upgrade" to some new render pipeline.

    Something good out of this post? yeah, know it's possible to render trees fast. I'm releasing my game to Oculus tonight and you'll be able to check yourself.

    Signed
    The old Unity user that used to love it, alpha tester, beta tester, and gave up on it when realized users are ignored for years on basic requests. Awesome IPO though!
     
    Last edited: May 3, 2021
    hopeful and studentvz like this.
  2. Halfspacer

    Halfspacer

    Joined:
    Sep 13, 2014
    Posts:
    23
    Mobile optimization is tricky, and figuring out what runs well and what doesn't means getting to know the hardware you're developing for. Clearly you somehow managed to figure out how to optimize your trees (Well done), so I'm not sure why you're up in arms about it. Making your game is a lot more enjoyable when you don't have to rely on Unity to do it for you.

    I can highly recommend this resource from ARM on Optimizing Mobile Graphics,
    https://developer.arm.com/documentation/100140/0402

    And this superb Intro to Shader Coding course by Freya Holmér,
     
  3. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    The issue is that it's been a known issue since 2017 (all over the forum people complaining) and it's a super easy fix. All it requires is someone at Unity to load a terrain with trees in an Oculus Quest to figure out what's going on. But they prefer to say "meh, we'll just say Quest can't handle it". Unity is not here to make my games, it's here to help me make the games. For years is been slowing me down instead of helping. That's why I used to be a Unity super fan and now I'm a super hater. Nobody in there seems to care for us.

    ps. My game ran faster in 2014 than today with the same features. The only difference is Unity has slowed down and dragged performance to crap while requiring everyone to upgrade their hardware to achieve the same. High fives!
     
  4. Halfspacer

    Halfspacer

    Joined:
    Sep 13, 2014
    Posts:
    23
    But what exactly is your issue? What's the vertex and draw call count per tree, how many are you placing, and what type of shader are you using? (Alpha test for instance is notoriously expensive on mobile), and how is your terrain set up?
    A good terrain setup for Quest (and mobile in general) is to set Pixel Error to 5, Detail Patch Resolution to 96, Draw Distance to as low as works for your game, and Draw Instanced On.

    At the end of the day though, vegetation is extremely tricky to pull off on mobile; Especially on mobile VR where you're rendering twice at framerates much higher than your average mobile game. This primarily comes down to the way mobile GPUs handle transparency and is far less capable of dealing with excess overdraw.
     
  5. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    The issue is that Unity has a horrible system for VR. I know how VR renders, I managed 72fps with 10k trees on Quest right now. Just because I know how to do my stuff. But Unity by default would render that at 5fps on VR. And my Android from 2014 rendered it at 30fps. The problem is not the VR or the device, the problem is Unity. That's my issue.

    Optimize all you can all the settings you want, place 10k trees and compile and run on Quest. Good luck achieving more than 10fps if you don't know what unity is doing wrong. Try the same on Unreal and by default get 70fps. That's my issue with Unity.
     
  6. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    189
    For a "showcase" this is a whole lot of hot air. No images or samples. Not even any links to your app.

    And to be fair the like 10-20 times this past year when I directly asked technical questions in any forum or unity ticket here without angst I've always gotten detailed technical responses when I can provide or point out detail technical bugs, underdocumented features, asking about future developments/plans, etc.
     
    jaydnwlsn and Halfspacer like this.
  7. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    www.dogfightelite.com you have the video on the main page. Download links included. Ran faster in 2014 than today. In fact, the video is years old and it has more quality than nowadays because you need a high-end device to run it now. (It used to run on iphone 4 at that quality).

    It's already available at SteamVR but I'm waiting for Oculus to publish so you can check it on a Quest and then i'll share it.

    Glad you got all those responses. Search the forum for Unity Tree in VR and see if you get any results or help from the devs.
     
  8. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Sure, like this is nobody knows issue, reported and marked as "fixed" on their issuetracker
    Single-Pass Stereo GrabPass or Post Processing for Android/ Oculus Quest - Unity Forum
     
  9. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    189
    Last edited: May 8, 2021
  10. ray20ray

    ray20ray

    Joined:
    Aug 7, 2020
    Posts:
    33


    do you use LOD for the trees? speedtree -> less face count -> billboard ?
    or do you use Screen-Aligned Billboard or cross-tree?
    is alpha test the bottleneck for quest2 ?
    thanks!
     
    Last edited: May 8, 2021
  11. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    Just wanted to say I feel your rant. There's stumbling blocks all over the place. You do have to be prepared to jump in and solve some of them yourself, and I'm glad you were able to do so.
     
    ericpug likes this.