Unity, terrain details.

Started by
4 comments, last by Scouting Ninja 7 years, 1 month ago

Recently I am working on learning Unity because so many of my clients, insist on attempting to make open world games with it. Excuse the bad grass texture, it was made for this test and is a very quickly made asset; I used very little grass on the textures because I wanted to test the alpha sorting.

So my goal is to achieve the same kind of grass density as Unreal, 10500 Meshes, more than 672000 triangles:

[spoiler] 74Szci1.png [/spoiler]

So first I used the Add Detail Mesh option, I used Lod3 for this because Unity doesn't Lod for it's detail meshes 5000 Meshes, 320000 triangles:

[spoiler] SOuseV2.png [/spoiler]

The fact that it doesn't align the grass to the terrain normal is irritating.

From this image you can see that it covers very well in the distance, because that was what Lod3 was made for. Even with no shadows it hit 62FPS on my mid range PC. I find that Unity developers often aim to get as many players as they can, so mid range is what I am aiming for.

There is lot wrong with this kind of grass, however with some baked shading and proper textures this could work. The problem is that there is bold spots, the worst being near the camera. Culling had to be set higher to gain back some frames. The worst about this is the lack of real control.

I must be doing something wrong, because if I had to think of the worst tool for distributing grass, then Unity's detail mesh is a very strong contender. Does anyone know how this tool is intended to work, because the wiki and tutorials use it the same way I did here?

I knew I could get better coverage by just having a Lod so I turned to the Unity tree details as it does have Lod, 3800 Meshes more than 243200 triangles:

[spoiler] iedA917.png [/spoiler]

This is almost 25% less meshes and covers the level much better. The Lod0, Lod1, Lod2 mesh is 256, 128, 64 triangles. The Frames is 65 FPS, I added real time shadows and used a much more complex shader (although I only made the Albedo for it.).

At first I thought this was a way to fix my grass problem, except some profiling revealed a lot of downsides, because Unity thinks each of these are a threes and creates collisions, reflection spheres and a billboard for each. The funny part is that the grass is culled before the billboard is used.

The Reflections can be set to bake, although it still kills the editor, at least the game is smooth. Collisions is easy to turn off once I realize they existed I can't find where to turn off the billboard.

The billboard should in theory have saved some frames when used, except that at this point the amount of batches where slowing the performance not the vertex count, so culling the grass is a better option.

I apologize if this was a bit long, I can't believe that Unity's terrain tools is this bad. I am hopping that some of the Unity users can shed some light as google has been unable to.

Something I have been considering is abandoning the terrain tools, it appears that the only performance gain is from batching and using static meshes will give me more control and still have batching; although there could maybe be some performance gain from using grass that I am not aware of.

Advertisement

Have you tried the Unity forums? For very specific queries that's probably the best place to go. It's widely accepted among Unity users that it's typical to use a selection of assets from the store for terrain, anyway. Sticking to the built-in tools is pretty much unheard of.

Sticking to the built-in tools is pretty much unheard of.

This is the problem with Unity and it's community, it's like it's designed to sell editor tools. If you ask the Unity community any thing they provide you with links to tools that you need to buy.

The problem is that if a client paid me to make a foliage set it will cost them $250 -$400 for a single draw call set, then telling them that this pricey grass doesn't even work in Unity and attempting to convince them that it's the engine and not my skill, telling them that they need to buy a $20-$101 before they can use it, feels like ransomware.

Most people will see that, think it's a scam, go to Unity store buy foliage from the store and convince them self that you can't make good foliage for a game unless you have a full AAA team to do it.

I will be doing my static mesh test today, if it works I will be able to create a small code to distribute grass that should fully cover the level with very little foliage.

The thing is finding the normals from the mesh, took only a few lines of code; it's almost as if the developers decided to make a substandard terrain tool, to allow other developers to make better tools and sell them.

The prefab test revealed something really interesting, Unity prefabs work better than any of the terrain detail tools. This image 6250 meshes more than 400 000 triangles. Running at 72 FPS

[spoiler] 4DxxnjX.png[/spoiler]

As can be clearly seen in the image, I used a very simple transparent material for the last Lod because alpha errors will go unnoticed here; I was also able to set shadows per Lod. The better control of the assets combined with Lods and better batching resulted in much better coverage than expected.

The grass isn't marked as static, and applying rotation to each only dropped the frame rate to 66-68FPS.

Increasing the amount of grass by 250 reduced the frames to 40FPS, indicating I hit the geom limit of the graphics card.

I know I need only 3800 - 4000 meshes to get the cover I need, I can go up to 6250 - 6300. I was expecting a number just above 50% of Unreal this is 60%.

On a high-end PC, there is no point to a test like this as both Unreal and Unity allow for more grass than you need, although I would never have known just how badly the terrain tools perform against the normal prefabs.

This is the problem with Unity and it's community, it's like it's designed to sell editor tools. If you ask the Unity community any thing they provide you with links to tools that you need to buy.

It's true, but it's not a problem with the community, it's a problem with Unity's business model. Buying assets from the store is almost always cheaper than it would cost to contract someone to make them yourself, so the community is totally right in directing people there; but obviously if you're a contractor, you don't look good if you take people's money to just spend on the asset store and pocket the difference.

it's almost as if the developers decided to make a substandard terrain tool, to allow other developers to make better tools and sell them

I don't think they ever did that deliberately, but I do think their business model is basically to get features to a 'good enough' state and then let 3rd party developers build on that. UE4 is different but Epic are in the business of supplying finished engines to AAA teams so it's quite a different dynamic.

I would never have known just how badly the terrain tools perform against the normal prefabs.

I think the issue is that the regular terrain tools are pretty old now, and possibly optimised for a time when the benefits of billboarding were larger than they are today. I'm no graphics expert but my understanding is that geometry throughput capacity has gone up massively whereas the costs of overdraw have stayed broadly the same or even dropped.

I don't think they ever did that deliberately, but I do think their business model is basically to get features to a 'good enough' state and then let 3rd party developers build on that.

This is probably true, there is some high quality 3D games made with Unity so the developers probably informed Unity that the terrain tools are out of date; however with so many terrain tools in the store Unity has no motivation to update. It's not like I can say there is no good terrain tools for Unity.

The most concerning part is that lot's of people use these tools thinking that they are gaining in performance when they are losing.

I think the issue is that the regular terrain tools are pretty old now, and possibly optimised for a time when the benefits of billboarding were larger than they are today.

It's not like billboarding is fully out of date yet, it's still wildly used in RTS games. It's the lack of any direct control that is frustrating, with code I can fix the tools. I will just have to provide the script and a tutorial with my models.

This topic is closed to new replies.

Advertisement