2
\$\begingroup\$

I'm doing some graphics optimizing tests, especially on PowerVR transparency. Now I made a scene where there are two groups of simple objects. One group has the shape in geometry using diffuse shader and the other with quads using transparency shader. The camera looks through a plane towards a group.

The scene setup

The test was about the "lateness" of PowerVR's Z-tests. And whether or not use better geometry instead of transparencies for e.g leaves or flowers.

The results were not wholly what I expected. The transparency group benefitted from changing the plane from transparent to diffuse by increasing the FPS by 20(expected).

Diffuse vs Transparency

But why is the group without the plane infront so much faster than when the plane is in front?(Not expected) FPS was 38, screenshotting lowered it.

enter image description here

Tests on the geometry group were opposite of what I had learnt in the past few days. There was only 2FPS difference between transparent and diffuse planes. (Not expected). Shouldn't the transparent plane infront cause the whole scene to render as the Z-test is at the bottom of the pipeline?

\$\endgroup\$
1
\$\begingroup\$

Because the plane in front is alpha-blended over the entire screen, after all the alpha leaves behind it have been drawn as objects they are depth-sorted by Unity to render properly with alpha-blending.

In your test without the front plane the cost of blending is minimal as all of the leaves use the same shader and texture which are in the cache and only cover a small part of the screen.

If you were to render each row with a different texture and different shader, performance would suffer much more.

Alpha blending tiny parts of the screen using the same texture does not affect performance much until you are not bound by the memory bottleneck.

The PowerVR gpu has some free time to wait while deferred tiles are being written to memory: it can't send another tile to memory while the first one hasn't been written. And since the texture is already in the cache it does not need to access memory for texture fetches letting it do the blending in parallel on the next tile while the memory is busy receiving the previously finished tile.

\$\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.