Many 3D teams face similar requests from clients or teammates: can we make our 3D visualization as realistic as possible? For 3D teams like us, that means finding the balance between accuracy and performance. How much details included in the visualization directly impacts the project’s frame rate.
Remtech systems, a manufacturing robotics compony, reached out to us to develop a VR visualization of their pizza packaging assembly line. They asked for a VR visualization that would showcase the assembly line in full action – with a total of 28 ABB robots moving product and packaging, and new pizza boxes spawning into the assembly line every 2 seconds. The project quickly reached 1,000 meshes in a scene and we needed to choose the most efficient rendering method for the VR visualization.
Render of our assembly line visualization.
Why we chose forward rendering
Deferred rendering is the default type of rendering used in Unreal Engine. Instead of calculating lighting information of a scene while rendering it’s geometry – the software performs the lighting calculations after the scene’s geometry fragments have been culled. While this type of rendering is more efficient for projects with a large number of lights, deferred rendering takes up a lot more memory, since memory is so limited in real-time projects, it’s wasteful to have rendering take up a majority of it.
On the other hand, forward rendering generates faster render passes, which is optimal for VR platforms where quick renders are necessary to keep up with FPS requirements. Forward rendering also lets you enable MSAA (multisample anti-aliasing), where adjacent pixels are sampled together instead of rendering an entire scene in high resolution. Choosing forward rendering for our VR project helped us achieve realistic graphic quality for Oculus Quest without compromising frame rate. Here’s how we implemented forward rendering into our VR project to improve its performance.
Comparison of forward rendering (left) and deferred rendering (right).
Optimizing our scene to use forward rendering
While deferred rendering can work with 5,000 meshes in a scene (depending on your hardware spec), forward rendering is limited to 200-400 meshes. Our project was quite heavy – with over 1,000 meshes in a scene – so we went through a couple of optimization steps to lighten our project as much as possible.
First, we generated LOD’s in the scene to decrease details that weren’t trivial to the visualization. We also combined meshes that were separate in the design to reduce the number of objects in the scene and consequently reduce the number of draw calls. We took advantage of culling methods available in Unreal Engine by using distance to cull geometry that is far away from the camera, and view frustum to cull objects outside the camera view. These steps helped decrease the size of our scene so that we could benefit from the advantages of forward rendering.
Selecting the correct lighting
A problem we ran into when working with forward rendering was the type of lighting we used. Lighting calculations can take up a lot of processing power which is why forward rendering cannot process too many dynamic lights. Because our scene was limited to a certain area – in our case, a warehouse – we were able to use directional lights. Directional lights light up an entire scene by mimicking natural sunlight and work best when using forward rendering. The benefits of using a single directional light over multiple spot or point lights are significant. Single directional lighting uses far less graphic processing and reduces the amount of RAM usage. In turn, this helps improve FPS and real-time rendering quality.
When using forward rendering you need to prepare your materials outside of Unreal Engine – we used Substance Painter for our VR assembly line visualization. For forward rendering, the right texture size is a maximum of 512×512 pixels, whereas with deferred rendering you can go as high as 8,000 pixels. Having a smaller canvas for textures means you’ll lose some details, however, the performance benefits of using forward rendering make it worthwhile.
For example, there were many objects in assembly line scene, such as cardboard boxes that didn’t need as much detail and using a small texture size didn’t compromise visual fidelity. There were also larger objects in our scene like walls and beams that we decided not to use textures for, and instead used solid colors. This saved us a lot of render processing power and allowed us to include more graphic detail to the main part of the visualization, the ABB robots For the robots, we used a larger texture – 1024×1024 pixels – to bring the robot to life and accurately portray its color, shininess and opacity.
Render of our VR project using forward rendering.
Overall, using forward rendering allowed us to render our scene faster in VR, improving our FPS. Our project was able to quickly render all the small details in our scene – like texts, signs, warnings and industrial graphics. Most importantly, our client was really impressed with the graphic quality of the project.