Search Unity

How many draw calls should I target for PC

Discussion in 'General Discussion' started by jimmikaelkael, May 30, 2015.

  1. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I imagine he would be. :) He could also be using a whole heap of primitives, but that would be insane... :D
    And I find combining meshes on mobile can sometimes prove a large performance hit, whereas having separate objects means Unity's frustum culling doesn't render objects out of view.
     
  2. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    What kind of hardware do you have and what kind of framerate do you have without the drawcall reduction?

    I can do a fair amount to reduce drawcalls and combine meshes, but it's a lot of work :(
     
  3. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I believe MeshBaker works pretty well to automatize texture/materials atlasing and mesh combinations.

    I guess mesh combination might be used taking in account the design of your level: I think it's a non sense to merge all into a big massive mesh if you're already using Umbra Occlusion properly.

    In my game, that's the case: Occlusion Culling is already working in a very efficient manner, however I still get peaks at 1500 drawcalls and I'd like to stay below 1000 like a few suggested (I'm baking only reflection probes and using only precomputed realtime GI, the rest is all realtime).
    However my buildings are splitted into very sensible pieces: buttresses, walls, doors, floors, roofs, windows, glasses, stairs, porches, bars, etc... So I guess I can have some benefit in combining them to share material and mesh by building, which should still make a good use of Umbra Occlusion in that case.
     
    frosted likes this.
  4. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Well, It seems we found an agreement that a good limit when targetting PC is 1000 drawcalls :)

    EDIT: @billups Have you tried to quote @ShadowK ? It's fun because you had the exact same sentence.
     
    Last edited: Jun 8, 2015
  5. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    At the moment I don't combine the colliders. I may have to in the future. The vast majority of my colliders are box colliders which are pretty cheap I think. For my natural stuff, I pretty much only put collision on trunks and larger rocks/boulders. I can get away with some pretty rough collision since my game is first person and you can never see foot floating/limb clipping. I also stream my world in a grid of scenes so I only have 180 meters of colliders in any direction.

    I'm on a radeon HD 7870 which is about whats in a PS4. I'm running at about 50 fps atm (almost there!), and if I decombine everything I get 5000 "batches" and 20 fps. I should note that I built my game from the ground up with combining in mind, so my grass clumps and rock cluster can be pretty small knowing the combiner will consolidate them. Combining isn't something I did when my frame rate started to get bad. I built my batch combiner in tandem with my assets.
     
    Ryiah and frosted like this.
  6. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @djweinbaum So you have a script that does combine meshes at runtime ?
    If yes I guess you disable the splitted gameobject renderers in that script but keep their colliders right ?
     
  7. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    Oh whoops sorry I forgot to answer that. No I combine them in the editor and use mesh compression. I'd love to find a way to combine them at runtime because it would make my build really small, but I don't know how since my world streams in asynchronously and I don't know of any way to combine thousands of meshes asynchronously without causing some serious stuttering for a while. Currently my build is under 500 mb and I have over 1/3rd of my game arted so I think I'll be okay.
     
    NomadKing and jimmikaelkael like this.
  8. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    For anyone interested, and since I love to blabber, it works like this:

    "Combine at Runtime" only has a bool in the inspector, but doesn't work lol. I was a bit wishful when I added that to the gui. I have a "chunk member info" component that I put on children of the combine grid that stores references to their lods and colliders and such, just to make things easy for the script rather than doing a bunch of getcomponents. I have some commands in the menu bar like "Decombine All" that will run through every combiner in the scene and decombine so I can get back to arting the map, then when I'm ready to test I run combine all. Takes about 15 seconds. I had to do some clever stuff in the combining operation to make it run that fast. Notice I gave it the fancy name "Elegant Combine": That's because I like to use marketing and product name hype on myself I guess.
     

    Attached Files:

    Last edited: Jun 8, 2015
  9. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    KNEW IT!!! You were using a heap of primitives! :D

    Nice script BTW. And yea, makes sense that it would be pre-baked first... :D
     
  10. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @djweinbaum Thank you very for sharing informations! I think this is really appreciated.
    I appreciate it :)

    I'm just questionning myself on how to combine...

    Say I have a bunch of slabs along my road, it's using only one material, is there any benefit to combine it together (I'm thinking here that the static batching should do its job properly) ?

    Another problem I'm facing is for my roads and slabs for example: they use each a different material and the textures are tiled for both. Is there any way to combine such type of materials ?

    Another question: Say I have 2 differents objects (not same mesh) but use the same material, this time there's a real benefit to combine it over Unity's builtin static batching right ?
     
    Last edited: Jun 9, 2015
  11. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    Before I wrote my combiner when I was first doing tests, I did a lot of static batching tests. This was back with Unity 4.3 I think, but I made a big forest and everything used the same material (super vegetable material!) and enabled static batching and kicked a build. My draw calls definitely went down, and my build size multiplied (as expected) but it didn't help my frame rate much. Then I tried combining them all and my fps halved. I can't tell you why (maybe someone else who knows more than me can tell us), but according to my tests combining is better than static batching by A LOT. This is especially true because all my lods combine as well and lod groups can eat up frame if there are tons of them.

    For your road, it depends how many pieces you have and how big they are. If you have hundreds of them, I'd combine them into bigger chunks, but that's just me. The thing I don't like about static batching is I never know what its doing, and it only works in builds so its even harder to figure out. It feels like a black box to me. Maybe someone who has better mastery of it can use it to better effect.

    As far as combining things with different textures, you'd have to find a way to combine the texture. This is not possible if its tiling in both directions*, but you can consolidate your textures if they are tiling only horizontally or vertically. I have textures I call "trim sheets" which are a bunch of horizontally tiling strips like railings, moldings, frames, borders etc. You will, of course, need to adjust your uvs after you consolidate the textures. You could also use a shader that can lerp between textures, but I don't recommend it in that case (then your trading draw calls for shader complexity).

    *it is possible to consolidate tiling textures if your willing fold your UVs over themselves like an accordion (I call this the wiffle waffle). This is an ancient trick my ancestors did to save draw calls during the long winters when cpu resources were scarce. I do this sometimes if I have just a little bit of something on a texture sheet that needs to go across something with a lot of surface area.
     
    jimmikaelkael likes this.
  12. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I'm wondering how any game could need more than a few hundred drawcalls? After all, each drawcall is basically a completely separate material, or issues with transparency etc.. if you're doing some combining of textures etc how can you even get to 2000 drawcalls?
     
  13. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I am guessing a lot of... lights. :D Plus, he seems to be using a terrain, of which does take a mountain of calls to draw. (This is due to the terrain being drawn in tiles, rather than as one big mesh)

    EDIT: Just realised the VERY BAD pun I just made... :D
     
  14. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @imaginaryhuman
    In my scene I'm now at 1000-1500 drawcalls in peaks without anything combined.
    I have a lot of street lights yeah, but at the end I'll cut off 1/3 of them.

    The terrain itself account for more than 600 drawcalls when I reach those peaks. Currently it seems Unity hate to batch the speedtrees. So it seems @FuzzyQuills is right.

    @djweinbaum What type of trees aree you using ? Do you place them manually of with terrain brushes ?
     
  15. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    ANY game? The OP is targeting PC. Getting to a few hundred is easy for a game with stuff in it! Its a lot of work and planning to avoid high draw calls counts. Its not just a separate material. Rigidbodys, NPCs, interactive objects like doors, things that change states like harvestables, particle systems, critters, dynamic lights, things that cull separately, things that LOD separately are all things that can't easily be combined. 2000 isn't hard to reach if you're not extremely mindful. If you're using the Unity terrain system for vegetation, place two trees and a grass clump and you're at 5 million.

    I hand author all my vegetation old school in a 3d app. I don't use the terrain system for placing objects. I use a tool for painting the prefabs. I used to use the Unity terrain for my ground only but a month ago I dropped even that in favor of big meshes.
     
  16. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Thank you once again for sharing your workflow with Unity. It's very useful to me.


    On another note: I just tested to upgrade to Unity 5.1, it updated my project but I can't no longer bake Occlusion Culling. It's now crashing Unity at the end of the bake process. I tried to manually delete the Library folder in my project but didn't changed anything...
    Fortunately I made a backup of my project just before so I'm reverting back to 5.0.2.
     
  17. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I started to manually combine materials and I'm sure I'll save a bunch of drawcalls.
    My textures were 2048x2048 so I combined by 4 materials on a texture atlas of 4096x4096. I import the atlas texture with a resolution of 2048.

    Is it safe to make a texture atlas goes up to 8192x8192 ?
    Of course I could have an import resolution lower than that but I don't know if there's a practical limit concerning texture atlases size...

    EDIT:
    Another couple of questions concerning materials:
    - I have materials using standard shader in opaque render mode and some glasses using the standard shader too but in transparent mode. Is there any benefit combining these into 1 material ?

    - If I modify the normal value like on the screenshot below for one object, will it be batched with other object sharing the same material but with another normal value ?

    Inspector-MaterialSimple.png
     
    Last edited: Jun 12, 2015
  18. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I often wonder wat goes on in Unity HQ for these sorts of bugs to just crop up out of the blue... ;) Poor unity 5.x, such a bumpy ride for most! :)

    Sure will save you some drawcalls! :) And although some platforms may have issues with textures that big, (Just drop the tex size on those ones... :D) it should be fine to use an 8192x8192 atlas for your stuff.
     
  19. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Yeah, should be far more efficient: I've been able to combine 26 materials into 3 and I still get some place on some atlases for new materials. I even used to properly combine materials using tiled textures.
    Now I'm fixing UVs on my prefabs, this is quite long as I'm doing it all manually.
     
    NomadKing likes this.
  20. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    ...And manual is the way to do it when all else fails. ;) Keep at it, you're on the right track. :)
     
  21. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Yeah, this has been a long work to get materials combined without loosing quality: It took me 1 week to fix UVs for hundreds of objects. Now I still need to replace the objects from my scene with their optimized object conterpart.

    I've tested the optimized objects in a seperate scene and it already sounds very promising with a lot of objects even without combining their meshes, the setpass calls is very low.

    After I will have replaced objects in my main scene I will need to combine their meshes for more efficiency.

    Does anyone knows if there's a good asset on the store to combine meshes by materials ?
    I don't want to atlas textures/materials at all as this is already done properly I just want to combine meshes in the editor (not at runtime). Let's say I have a house using 2 materials, I want to select that house entirely and combine it in 2 big meshes seperated by materials in once: would be cool if there's an asset able to do this thing.
     
  22. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Ok then. Let's say that you have something like 200 houses. You want to combine all the wooden parts into one mesh and all the glass, etc. bits into another big mesh? Or do you want to join each house up individually?

    I don't use mesh combining myself, but I ams ure there's some good free assets on the store for mesh combining.
     
  23. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @FuzzyQuills My houses are made of small modular parts, I'd prefer to combine my town house by house for example (to continue to take advantage of Umbra).

    I'm ready to pay for an asset if necessary, free or paid is fine to me. I've already tested "Draw Call Optimizer" and the limited version of "Mad Mesh Combiner" but none of them made the job. They combine things in a gameobject but they do not really combine meshes properly.

    Maybe the best is to write a script for my needs like @djweinbaum does...
     
  24. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    So, combine your houses modular parts into a single mesh, then combine the lot? :D

    There was actually a mesh combining utility a while back, but it was removed in 4.3 I think. Pitty it doesn't still exist. I actually tried to write my own at some stage, but some of the results came out REALLY WEIRD. (I am obviously not good enough in that department then... :D)
     
  25. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I ended up writing my own editor script using Mesh.CombineMeshes. This is the perfect solution as I can combine things into giant meshes but keep the smaller compound colliders active from uncombined objects.

    Now I need to apply this to my scene to see the result :)
     
  26. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Cool. :) let us know how it goes. :)
     
  27. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Well, I'm finally very happy! After many optimizations, I'm always under 1000 setpass calls. The WaitForTargetFps in the profiler is around 50% and I get around 120fps (when I disable VSync).

    Now I feel Unity rocks! :)

    perf.JPG
    In the worst spots like above, it's terrain SpeedTrees that is eating up the setpass calls. I just have to wait that Unity improves the SpeedTrees batching.

    perf2.JPG

    The whole scene (if I don't account the SpeedTrees) is using 5 materials and the meshes are combined into something more consistent (buildings by buildings, fences group, etc...).

    The Umbra occlusion is now less efficient than it was with smaller parts but it was a good trade off.

    Thank you so much @djweinbaum for sharing your workflow, and many thanks to @FuzzyQuills for giving so much time!
     
    Last edited: Jul 6, 2015
    chelnok and djweinbaum like this.
  28. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,825
    It is funny because I also had about 2,500 batches in the game i was working on.
    Someone thought that was way too much and I got heat for it from a moderator:

    http://forum.unity3d.com/threads/is...-get-excellent-performance-without-it.338142/.

    So anyways i decided to see what was going on, and at 2500 batches, the FPS is great. But the CPU is going insane due to so many draw calls. Even on a high-end PC.
    So, i decided to look into MeshBaker, and after spending a couple of days one one scene doing mesh combines, I was able to reduce the batches to just about 500 for PC. There is a slight sacrifice in quality, but the CPU is now doing 1/5 the work that it was doing before.
    Im very new to this, only about 4 months creating games in my life. I took his advice when he said that 2500 is way too much.
     
    Last edited: Jul 7, 2015
    -chris likes this.
  29. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
  30. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @TTTTTa
    On my side that was even worst: I had 2000-2500 setpass calls, and 3000-4000 batches not to mention the number of shadow casters.
    I didn't have used any combination tool for my texture atlasses so I made everything manually and that was quite long to fix model UVs, however I didn't loose any quality.

    To combine/decombine objects (my buildings were made of a lot of modular parts) I use my own script in editor that keep primitive colliders from splitted object active (it just disable their renderers).

    I still slightly above 1000 batches in some spots, but I'll investigate to see if I can go below that (but from what I've tested my speedtree trees and grasses are the culprit).

    @darkhog
    I guess @djweinbaum is already using this as he's using an editor script to combine meshes.
     
  31. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,825
    I would think 1000 batches should be fine for a PC game.
    But yet I am still learning everything, so i am not 100% on anything yet.
    But definately for me 2500 was too much, even for a most-modern PC and graphics card.
    Getting it down to 500 was such of a massive improvement I would keep on doing it in every scene. The CPU was just way too loaded down.
    im glad you are working on this too.
    You should look into MeshBaker. Im not advertising anything, but it is a huge help for me in doing combines, unless you can figure out how to do it yourself. I just couldnt get the any of my own scripts to work (using the Unity Mesh.combineMeshes API routines).

    EDIT: what i did for my colliders, is just kept the original gameObjects which had the colliders, but deleted all of the original meshfilters and renderers. that allowed me to keep the colliders
     
    Last edited: Jul 7, 2015
  32. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @TTTTTa yeah that's what my combine/decombine script is doing, but instead of deleting renderers it disable them so I can decombine at any time and make changes.
    MeshBaker sounds great however I don't need it as I'm very happy with my own script: it can match my workflow exactly.

    @djweinbaum
    - I'd like to know which mesh painter tool you found is the best ? I know you were satisfied with none of them but I'm currently thinking about to drop unity's builtin terrain completely and replace it with meshes...
    - Which size did you used for your terrain meshes ? I mean looking at your grid screenshot for example, how many grid cells a terrain mesh is covering ?
    It seems the last wall I'm currently hitting to decrease the batches/setpass calls count is unity's builtin terrain and SpeedTrees painted on it.

    EDIT: Just watched a video about Unity's builtin terrain + SpeedTrees + RTP:

    The batches/setpass calls numbers are crazy. Sure looks AAA but whith such numbers I doubt you can add anything more...
     
    Last edited: Jul 7, 2015
  33. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Well I had another: this time it's clear that terrain trees have a very bad impact on my performances.
    I made 2 screenshots in one of the worst spot of the scene.

    trees_enabled.JPG
    With trees enabled I get 1600 batches and near 1000 setpass calls.

    trees_disabled.JPG
    With trees disabled I get 900 batches and less than 300 setpass calls.

    What the hell is going on with trees ? I mean that's not like I'm using thousands... In the frustum caught by screenshot there's around 1 hundred (yeah my grass clumps are SpeedTrees).

    EDIT:
    I've done more tests in the same area on the screenshots, the terrain itself (without trees) is adding 400 batches and 70 setpass calls. So to sum up my buildings/props and streets/street lights are eating up around 500 batches and 200 setpass calls, which is not so bad I guess.
     
    Last edited: Jul 8, 2015
  34. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    @jimmikaelkael
    I'm curious.

    Are the "leaves," of the individual trees, made up of many, many separate leaf meshes?

    If so, that could explain the rise in calls. :D

    Possibly the same, for the grass too.
     
    Last edited: Jul 7, 2015
  35. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I didn't have authored them so I'm not sure but looking at their meshes it seems to me the branches are flat meshes holding the groups of leaves.
     
  36. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Ok then.
    Thanks for replying, with that info. :D
     
  37. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    Sorry I can't give a good answer because I'm abroad atm with no proper keyboard. Im really glad you got you got your perf up btw! I ended up writing my own painter. Its simple and just dabs one prefab at a time and I just peck peck. You can arm a prefab for painting from the right click menu. Its got a little menu for aligning to normals, filtering layer collision, and randomizing transforms. Took a day to write i think (turned out to be easier than I thought). My terrain patches are varying in size. But 5-10 across cells might be a reasonable estimate. My whole world is under 10 terrain meshes I think. I use big set piece meshes like cliffs as well.
     
    -chris and jimmikaelkael like this.
  38. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Just found that I can swap my speedtree grasses with terrain's detail textures (grass I mean, not splat), with this I can save at least 300 draw calls in the scene's bad spots.
     
  39. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Check the colliders on the Speedtrees. Some have a lot of colliders, in places you really don't need them. I needed to remove some to place bird landings and noticed a significant drop in my fps after removing unnecessary colliders from the trees.

    I just removed them from the prefabs and hit apply. Worked like a charm. :)

    Oops, just realized you meant draw calls. Probably won't help.
     
  40. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    I meant he can use it in runtime and putting it into coroutine so it won't hang game.
     
  41. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    It's worth to check that anyway. So my trees have a single capsule collider for trunks, grasses has no colliders (as this is expected).

    True, I've missed that part :)


    @djweinbaum Could I please know which workflow did you used when you switched from unity terrain to meshes ?
    I'm already able to split terrains and splatmaps into smaller parts and convert terrain to meshes, but meshes use material, not splatmap. I guess you may have used your own shader to use those splatmaps on the meshes, is it that ?
    Another question: how do you handle collision with those big terrain meshes ? primitive colliders or mesh colliders, or you may use terrain collider from terrain data before it was converted to mesh ?
     
    Last edited: Jul 9, 2015
  42. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    @jimmikaelkael I initially had my splat map from world machine so I baked that into the vertex color in blender. I use a custom shader for my new terrain that uses the vertex color. It has base, r, g, and then b for ao (I don't use a because its a nightmare to work with in blender). When I converted to meshes I exported my terrain from unity as a mesh with some script and then cut it up in blender. I use a decimation modifier to get the polycount way down and visually it looks the same. For collision I'm 1:1 atm and it hasnt been a problem.
     
    jimmikaelkael likes this.
  43. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    At the start the FPS is pretty good, then when it gets down in the trees it drops. SpeedTrees are horrible for performance in a large open world like that. Just not designed well for that scenario. Plus I can't really tell what he has the detail distance set to, and the terrain resolution has a major impact also. You absolutely can have large worlds with AAA quality at good FPS if you tune it all really well. I'm betting he is also taking a performance hit from all the tree colliders, that's probably why the cpu jumped. With lots of trees you pretty much need to disable the built in tree collider support and manage that yourself (I use a spatial grid to add/remove on demand in a small radius from the player).
     
  44. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    If you are going to use SpeedTrees, get used to learning how they work in detail and making a lot of custom modifications. Out of the box they are a performance killer.
     
  45. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Yeah and he might be using a high end computer, must be the case to keep such FPS with his batches count.

    Yes it seems. I've purchased AFSv4 and converted my grasses to use AFS grass shader, this will give me more flexibility and best performances.
     
  46. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Good news. I've converted my SpeedTree grasses for use with AFS v4 grass shader and I've been able to easily paint it back with the geometry brush tool (and the bonus is that it is now outside of the builtin terrain: it's perfect as I'll switch to standard mesh for the terrain), then I've combined it in patches.
    My triangle count increased but I've reclaimed 400 draw calls !

    dc.JPG

    I'll try to convert all my speedtree trees to normal objects using AFS foliage shader if it's possible.
     
  47. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I've lowered the draw calls count in my reference spot again. At least 120 draw calls are saved thank to the help given by @larsbertram1 on how to optimize a bit my SpeeTree trees. Next step would be to get rid of Unity's builtin terrain and replace it with big meshes. I need some time to find a way on how to automate the process of splitting terrain and convert it to mesh (and so use a custom material) as I'll continue to use Unity to sculpt my terrain.

    dc3.JPG
     
  48. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Any chance you could share that information? I think a lot of us are trying to find ways to further optimize Speedtrees.
     
  49. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I'm betting meshes won't be better then unity terrain performance wise, at least not if you are comparing apples to apples, ie mesh vs heightmap and not confusing the issue by comparing say mesh to terrain with details/shadows enabled.


    Good way to see that is make a terrain and disable everything, every feature so it's just a heightmap. Now make a mesh of the same resolution and size and compare the two. I'll be really surprised if the difference is worth noting.
     
  50. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I've disabled intersection bending to get a single bark material and I manually assigned leaves material to fronds. I use the SpeeTrees now but outside Unity Terrain (a matter of personal choice).

    From what I've been able to test already it can save a lot of batches. (Unity terrain is much tiled)
     
    Teila likes this.