Today I learned about a technique for forcing uniform resolution in a Unity WebGL build, as described here in the answer by DMGregory. Yay! I'm experimenting with implementing this technique on a large ongoing project and am seeing promising results so far. However, I am a little bit baffled as what color format I should choose for the RenderTexture. It seems to me it would be most efficient to choose something without an Alpha channel, but that's just a hunch. There are seemingly zillions of formats (not all supported on WebGL): RenderText Inpector

partial list of RenderTexture color formats

With the build-test cycle on WebGL being slow as it is, I'm looking for some insight as to how to choose the most efficient color format. And what about the depth buffer setting?

Finally, does it matter if the RenderTexture is NPOT? Again my hunch is to have it be as few pixels as possible, even if NPOT, but ¯\(ツ)/¯ Same goes for MipMaps -- seems like wasted memory space but I'm guessing here.

Edit: I found this, which does explain the nomenclature at least, but I'm still unsure how I should be thinking about this.


1 Answer 1


After a great deal of trial and error I have learned a few things.


For each permutation of the factors described in the original question, I created a build using a RenderTexture and tested it at four points in the game for average fps over 10s. I did not test every permutation! Only those that seemed to offer a glimmer of insight. The control was a build that used a main camera rendering directly, rather than to a RenderTexture. The test platform was WebGL as loaded into Chrome v.94 on a MacBook Pro 2012 Retina with 16GB Ram, runnning MacOS 10.12.6 at full screen which equates to 2360 x 1474 after subtracting the browser's chrome.

Color Format

As near as I can tell, color format made zero difference on frame rate or build size. A great many of the color formats are not valid with WebGL builds, and of those that do, only a few make sense. The default R8G8B8A8_UNORM gave the same performance as all the other options I tried.


I thought maybe there might be a performance penalty for using a NPOT format, but as near I can tell -- for instance, comparing 960 x 600 vs 1024 x 512 performance -- there is little to go on here. 960 x 600 is slightly more pixels but the relative performance was a draw suggesting this is not an issue.


MipMap settings appear to make no difference to RenderTexture visual output, even at lowest quality settings where one might expect 1/2 size textures would be substituted (per default Unity Quality settings). No difference in build size either -- I guess not surprising.

AA settings

Ditto for AA settings -- made no discernible difference to visual quality or fps on their own.


Indeed, the only factor that seemed to have an effect on fps was the size of the RenderTexture (X * Y) and it was fairly profound.

With the resolution set to 960 * 600 (the target for HTML container) I saw a 38% increase in frame rate. With it set to the nearest POT, 1024 * 512, I saw a 35% increase in frame rate over the baseline.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .