Has anybody settled on a successful solution for quality trees in VR with Unity? The SpeedTree/Unity solution is generally a train-wreck in the first place, but is even worse in VR. Unity's native terrain trees work pretty well, but the billboards face the camera and look really strange when the user rotates his head. What is everybody else using? Any good tips? Thanks.
Speedtree absolutely kills performance in VR. So far I've found the best thing to do is use low poly tree meshes.
Unity terrain trees would be great, but as you mentioned there is this billboard bug that hasn't been fixed yet (for a long time)... Using low poly tree meshes is fine, but not having a billboard functionality also kills performance. Someone in another thread wrote you should create your own billboards for every tree and use LOD group component to change between mesh and billboard. However, getting a proper billboard with lightning etc. is not that easy. It is really not fun atm to setup VR environments with a lot of vegetation in Unity. I just hope they will fix it soon.
I've been trying to find a solution for awhile now and I think I finally found one. Get a package from PolyPixel like the country side or Lakeside cabin one, they come with many great trees ( country side has more ). They don't have animations for wind, so pair it with the advanced foliage shader. Once you've done that everything looks and works fantastic. I have a 4kmX4km world generated with Gaia with dx11 grass shader using their realistic grass and I have finally hit target fps with a very large amount of trees. Also the billboards are great and work fine since it's not unity trees.
@mindless2831 Have you been able to get a large amount of animated grass working in VR? Everything I've tried seem way too expensive.
I scripted my own billboards that rotate around Y axis to look at cam. I had to optimize for mobile, so all trees are batched quads and managed in a single update loop (each tree does not have its own script), half get managed one frame half the other resulting in trees getting rotation updates at 30Hz. They also have stationary blob shadows and 3D collider approximations. They also make rustling noises when driving into them or scraping past them. I'm happy with them.
Terrain Tree billboards are uniquely broken, I think they fixed it for other billboard types. You have to use LOD's and setup a prefab to show at the lowest level instead of billboards. The issue has actually always been there. It's an artifact of the billboarding orientation, but its just actually noticeable in VR.
Unity really need to fix this, I see this question popup so many times on the forums. It's insane that while Unity has gotten a money boost several times for VR, this is still an issue. It's unbelievable funny but sad the same time.
@sbmhome Unfortunately I've done away with grass and use the new CTS terrain shader to give normal maps to my grass textures. DirectX11 Grass Shader is the only one that looks decent enough in VR, but it is also way too expensive to render. It can be used in small patches, but until the guy decides to try and optimize it it will never be a large terrain grass solution. Nothing else looks even kind of decent unfortunately. As far as billboards go, use Gaia and put non unity terrain trees in with lods ( even billboards ) and they will work perfectly without scripting. It's only unity terrain trees that have the issue that I've found...
Y'all need to take a look at this asset: https://www.assetstore.unity3d.com/en/#!/content/76657 Great performance and correct billboarding in VR. Oh and shame on Unity for not fixing billboards in VR, SHAME!!! Reflections still don't work either, it's absolute bullshit that they advertise Unity as VR friendly. They're just sitting on their piles of money.
What shader are you using on the trees? I've been using Legacy/Transparent/Cutout/Unlit, but the game starts lagging at a certain number of trees. I'm developing for Gear VR.
I was using cutout, because I thought it would be faster with less overdraw, but cutout breaks the weird cell batching that mobile GPUs employ. So it's faster to use a simple alpha shader, like you I used unlit as my tree textures have baked lighting from approx above. Also try and atlas all your trees into one megatexture. I was really suprised how much faster alpha ran than cutout. Not sure how many trees you need, but I never put more than 100 of these in any one scene, it could handle more but I am also throwing many other alpha quads around, weapon FX etc. If it was just trees then 200 is fine. Also to reduce script cost: Manage all trees in one update loop, make a tree manager script for all trees. Update each trees yaw every N frames to reduce engine calcs (below is every 4th frame). Code (CSharp): //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // UPDATE const int K_MOD_FRAMES = 4; int iMod = 0; int iTree = 0; static Vector3 vLookAt = new Vector3(); static Vector3 vUp = Vector3.up; void Update() { if (!v.tCamera) { if (Camera.main) { v.tCamera = Camera.main.transform; } else { return; } } vLookAt = v.tCamera.position; vLookAt.y = 0.0f; iMod = ++iMod % K_MOD_FRAMES; for (iTree = iMod; iTree < v.GRP_tBillboards.childCount; iTree += K_MOD_FRAMES) { v.GRP_tBillboards.GetChild(iTree).LookAt(vLookAt, vUp); } }
Thanks for that! So I'm looking through the list of available shaders and I can't seem to find an "alpha shader" or am I making a really noob mistake?
Oh yeah I forgot about limited mobile shaders out of the box. You'll need a fast alpha shader, here's the one I use, alpha channel must be in texture. Save it as "Mobile_UnlitAlpha.shader" anywhere in your project directory. It should then be available in available shader dropdown under "SiliconDroid" group. Code (CSharp): /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ____ ___ _ ___ ____ ___ _ _ ____ ____ ___ ___ ____ // / ___|_ _| | |_ _/ ___/ _ \| \ | | | _ \| _ \ / _ \_ _| _ \ // \___ \| || | | | | | | | | \| | | | | | |_) | | | | || | | | // ___) | || |___ | | |__| |_| | |\ | | |_| | _ <| |_| | || |_| | // |____/___|_____|___\____\___/|_| \_| |____/|_| \_\\___/___|____/ // // MOBILE: UNLIT WITH ALPHA // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Shader "SiliconDroid/Mobile_UnlitAlpha" { Properties { _MainTex ("Main Texture (RGBA)", 2D) = "white" {} } Category { Tags { "Queue"="Transparent" "RenderType"="Transparent" } Blend SrcAlpha OneMinusSrcAlpha Lighting Off Cull Back ZWrite Off ZTest LEqual Fog { Color (0,0,0,0) } BindChannels { Bind "Color", color Bind "Vertex", vertex Bind "TexCoord", texcoord } SubShader { Pass { SetTexture [_MainTex] { combine texture * primary } } } } Fallback "Transparent/Cutout/VertexLit" }
This shader is indeed more performant than Legacy/Transparent/Cutout/Unlit. Did you write it yourself or is this available online somewhere?
@shakozzz I derived it from a post by @bibbinator: Transparent Shader Performance It is public domain.
2017.3 beta 1 release notes include this tantalizing snippet: XR: Improved VR Terrain Trees: fixed billboard trees rotating all the time as viewer moves in VR, better transition of 2D to 3D trees, fast "sort-independent" trees with alpha-to-coverage blending and MSAA , billboard texture aliasing improvements (733507, 946544) Time to give it a whirl!
I'm trying to work with a client that uses Sketchup and a tree library for it. I've been able to import the models in and found that even with a handfull of trees the fps has dropped down to around 20fps using the vive. I even found to the point were if I went from 0 trees to 1 the framerate dropped by half. I've been turning off shadows and tried some of these shader options, but I'm not really bringing my framerate up. I also looked at Alt-tree, but the sketchup trees don't really seem to play nicely with that. Any suggestions there?
Also saw this: XR: Fixed billboard trees moving around in VR as viewer moves or rotates. Also fix VR issue of morphing tree vertices "growing" as camera moves closer to trees (733507, 946544) Going to try it tonight, have you tried it yet?
Sounds great. It was the reason I killed all my trees and now only using ultra-cheap pine trees here and there.
I was in the Vegetation Studio beta group. Very nice piece of SDK. With a bit shorter foliage distance it works pretty well. Also make sure to lower shadow distance to 50-75 meters to reduce draw calls
Hey guys have you tried native speedtrees on VR with Unity 2017.3? I still see the branches rotate along with my point of view....Do I need to do something extra?
Has anyone had any issues with Vegetation Studio? I am trying to create an open world game for VR and Vegetation Studio sounds perfect.
I tried the beta, it works pretty good, but occlusion culling is crucial and builld a word that does not display too much in a single panorama. I got framedrops with our sniper scopes because they render the game a second time inside the scope, Other than that the framerate seemed pretty solid
Ha! Just saw this thread. I submitted the project for 733507 right after meeting with the Unity devs at Oculus Connect that year trying to get them to do something about the Unity trees in VR.
I know this thread is old, but you can check this package. It's a new alternative to Vegetation Studio. Store Link: https://assetstore.unity.com/packages/3d/vegetation/massive-vegetation-121801 Forum: https://forum.unity.com/threads/rel...-in-seconds-and-draw-them-in-realtime.541280/ PS: I´m the author, so I´m not imparcial...
OK, @iayucar , but this thread is about trees in VR. Your tool is 100% billboards only, correct? That's not going to fly in VR at all.
Hi @Claytonious. Our tool uses billboards, yes. But works perfectly well in VR for distant trees. It's not a tool designed for a player walking through trees, or for close-up images of them. It's thought for those trees you need to see in the distance. Cheers.
I forgot to mention that Massive Vegetation includes two modes of Billboard's Rotation: one always facing the camera's orientation, what looks awful in VR, and another one always facing the camera's position, what looks much better in VR. Cheers.
Has this not been solved yet? I've tried a scene in the last 2017 and 2018 versions and still get the bilboards rotation when I turn my head.
Same... I thought this was fixed but the billboard rotation is still just as awful when turning my head