Application.CaptureScreenshot has the awesome feature of supersampling the image. Sadly supersampling does create an artifact with cube maps, like you can see here:
The topmost sphere show the artifact the strongest. Is there any way to prevent this effect? I also attached a sample project to test the effect. The effect shows up in Unity 5.4.2f2 as well as 5.5 Beta 10.
To create the effect take a screenshot with supersampling 16 while having a very small game view.
I don’t have a useful answer for you, besides that it is broken. We encountered the same issue when trying to capture super sampled screenshots from our game. There is some magic going on behind the scenes (Documentation for magic superSize parameter in Application.CaptureScreenshot missing - Web Resources - Unity Discussions) of this function that resulted in what looked like weird resampling artifacts in our case. Geometry outlines are generally fine, but shading is all over the place.
It seems that whatever it is, that the function is doing, is not rendering the frame at x times the resolution.
Thanks for the response. I did see your first thread, but didn’t want to post in there because the problem seems slightly different. I didn’t notice the geometry outline in out project as well, I guess this problem gets only apparent once the supersampling has more extreme values. The screenshot above is taken with the smallest possible game view and then supersampled x16.
I didn’t see your other approach to create an own supersampler, pretty interesting! Let me know if you got any progress on that, otherwise I hope that unity tries to fix their tool, I already filed a bug report, but I guess it will take some more time until they will work on it.
We use our own MRT to render the scene, which means that we already control the size of the buffer we render to. Since we don’t really ship it as a feature, we just increase the buffer size for one frame, let unity render the usual way with our MRT and then set it back again. Rendering at 4k and above takes some time, and thus the framerate drops significantly during that single frame.
If you are using the standard unity rendering path, you could try to set the cameras target texture for one frame. That might work, albeit not showing the GUI since it it somehow weirdly drawn with another camera. With our approach, we also cannot capture the GUI, not even when we capture the buffer at the end of the frame.
Sounds like it is worth a shot to try to render to a target texture for one frame. We don’t need the feature in the near future so I’m still hoping that unity itself will fix their functionality. After a few mails I got this response today:
So I guess there is hope that they will fix the problem
As for the UI: Even though Capture Screenshot does include the GUI layer you probably don’t want to use it, because it just gets scaled up and pixelated anyways, so I guess you’re missing not too much there