Skip to main content

Fixing Framerate Issues

After adding in the grass barriers to the game last week we immediately ran into performance issues and saw our framerate drop from consistently over 80 fps to roughly 3 fps. This is obviously a huge issue that we needed to resolve otherwise the game would be unplayable. I spent part of the weekend looking into various ways to help deal with this issue, such as occlusion and draw distances. Unity automatically does some occlusion so I focused more on the draw distances.

Mitch and I fired up the build today to try and work through the current issues. While implementing the new draw distances we ran into some issues which I will get into in a moment. To do draw distances we used unity's built in layer culling distances. By doing this we could set the grass to a much lower draw distance while still allowing the play set and other set pieces to be very visible even from a distance. This worked quite well and helped bump the framerate back above 60 fps.

As for the issues we encountered, there were issues both with the grass models and how the grass maze was built out. When looking at the 3d model for the grass we realized the poly count on it was way too high. Each set of 50 blades of grass wound up at roughly 19000 polys! Considering that there are 1000's of blades of grass it is no wonder that unity had issues rendering all of them. Then when we looked at the way the maze was built in unity, aside from the grass maze not having any colliders on it (and thus not a great maze) none of it was built from prefabs. This means that when we need to actually make changes to it we would have to individually change each piece of the maze (of which there are 100's). Hopefully we can somewhat mitigate those issues tomorrow and wrap the project up well.

Unfortunately we were unable to get the grass working due to numerous problem. Without the grass the yard is a bit empty, but the playset still works as a great set piece

Comments