I’m working on a game that uses water 4 and I was thinking of swapping it to a lower quality water if the user is running on low spec hardware or a laptop as it seems quite a few of my customers are using or trying to use laptops.
I’d prefer to try and do this automatically was wondering what would be the most reliable way to detect their hardware?
I guess that these laptops have capable shader level, but not actually enough horsepower to justify Water 4 then, since its not automatically being downgraded? Actually does Water 4 have a downgrade path?
Your best bet might be to based you assumptions on the systemInfo.
SystemInfo.graphicsPixelFillrate - gives an estimate for fillerate, but can be -1 if unknown.
There are others such as graphicsShaderLevel, memory, maxtexturesize, which used in conjunction might give you some form of equation to decided whether to turn it on/off. However its going to be quite hit or miss.
Perhaps the simplist and most reliable way is simply to have a function that periodically checks when water 4 is in view and whether the framerate is acceptable. If it isn’t then disable Water 4 and replace it. The old Unity Island demo had this approach to various features, maybe worth digging that up and checking it out.
For years and years, long before I heard of Unity, I’ve developed games with a simple mechanism to swap things out like this.
Once a frame, figure out the overall frame-rate. Unity makes this pretty simple to measure; the simplest is just compute fps = 1/(dt/timescale) in any Update() method anywhere [assuming dt and timescale aren’t somehow zero]. Then figure out how this compares to your target fps. I call this the “stress level.” If fps/targetfps is above 1.0, you’re doing great (and can enable prettier shaders or adjust your LOD thresholds outward). If fps/targetfps is below 1.0, you’re doing great (and should enable simpler shaders or adjust your LOD thresholds inward). You should decide a target fps threshold for each feature in the game that can be upgraded or downgraded; pull in LODs at 85% or allow realtime reflections at 115% targetfps.
Unity actually has some concept of “target fps,” but I haven’t studied what it does to attempt to achieve it. I am guessing it shifts gears down to lower quality levels but not sure. You can set a lot of things like shadow resolution for each quality level. It would be nice to set different shader choices for different quality levels, especially per mesh (e.g., bathtubs vs ponds vs rivers vs ocean each have different importance to the gameplay experience). If it supports that, then you could just make it go from “Enkidu’s Amazing Water of Life for Studly Machines” shader to “Solid #224455 is Good Enough for Water on your Wristwatch” shader whenever the fps lags.
Run some kind of hidden graphics rendering test at startup to measure performance and adjust accordingly? You could render the main scene, maybe at a smaller camera size for less fill rate so that if it majorly slows down it doesn’t affect the normal framerate, and then use a second camera with clearscreen on it on top of it with a menu or splash screen showing. Provided the splash/menu isn’t too heavy on performance or is predictable, then you can figure out how the test scene is performing.
I’m pretty sure that Bootcamp, the old 3.x demo, did some analysis of the target PC and changed quality/etc on the fly. Might be worth checking that out.