1
\$\begingroup\$

I am helping to optimize performance in a mobile game. The artists who built a particular scene added a wall around the scene. The wall is a single mesh with 100k triangles. Because it goes around the entire scene, at least some of the wall is visible from all angles and is always being rendered.

While running the game in the Editor with the Statistics panel enabled, I can see that hiding the GameObject containing the wall always reduces the current number of tris by 100k regardless of how much of the wall is actually visible. Does this mean that the entire wall is always getting rendered, rather than only the triangles that are actually in front of the camera?

Obviously the artists need to reduce the overall polygon count of the wall, but I'm wondering if they should also break it into several separate pieces so that the entire wall doesn't need to be rendered at once.

\$\endgroup\$
2
\$\begingroup\$

The entire mesh is indeed being sent to the GPU for rendering. It’s up to OpenGL (or whatever graphics library) to determine what to do with it. Frustum culling only works by disabling whole meshes that are entirely outside of the camera’s view. However, the actual rendering is only done for the fragments (pixels) that are onscreen and not obscured by something in front of it in the depth buffer (assuming the shader is set up to work with the depth buffer).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.