As VR grows in popularity, new techniques for optimizing environments are rolling in all the time. Since I just wrapped on a VR project, I thought I’d share some tricks I use to create dense foliage in scenes while keeping them running at a high framerate.
But first, something to always keep in mind:
Every polygon counts
VR requires a high FPS to run well and maintain player comfort. If your FPS is too low, your game may stutter and even cause your players to become sick. So, your minimum FPS usually ranges from 60-90 FPS. VR also requires two separate cameras to be rendering simultaneously. This cuts your bandwidth budget in half. For every shader or polygon you add, you have to remember that asset will have to be rendered not once, but twice. This includes every artistic choice you make including polycount, overdraw, shader complexity, post-processing, and dynamic lighting.
That said, onto the tips!
Heightmaps and polycounts
An example of a externally generated height map.
Even the most basic ground plane or landscape can become a challenge in VR. You first have to decide how you want to implement your landscape. For large maps, I recommend using an external program where you can generate a large area quickly, then go make small tweaks later. For smaller maps on the other hand, I prefer to hand sculpt the terrain because it offers more control over the end product.
Next, you have to determine how few polygons your terrain can use. If you use too few polys, your terrain will be lumpy and undefined, but using too many could kill performance. I recommend tending towards the low end, though. Even if your performance isn’t suffering, it’s better to have those extra polygons in your budget!
Populate that level
Hand-placing trees in Unreal Engine 4.
When it’s time to bring foliage into the level, an environment artist has to carefully consider the blockout from the designers. Trees and shrubbery can easily interrupt the flow of gameplay if placed in an awkward spot. So it’s up to an environment artist to figure out how best efficiently populate the level.
For large scenes, using a seeding tool like the one in Unreal, which simulates real-world growth patterns and disperses foliage accordingly. These sorts of tools populate large maps quickly, but also lack precision. For smaller maps, using the foliage painting tools in most game engines gives you more precision. You can paint large areas with a number of different trees, bushes, grass, and rocks in one stroke, or paint individual assets with fairly precise positioning. Knowing when and where to use each technique, or even both if necessary, depends on the type of project you’re working on.
Next, I will be going over how to prep your assets before you put plant to polygon. We’ll talk foliage LODs and shader LOD creation and how to best implement them. Check it out!