Tweak fps autoscaler
This commit is contained in:
parent
bc7c67368e
commit
2889fd54db
1 changed files with 11 additions and 8 deletions
|
|
@ -20,7 +20,7 @@ export class FpsQualityAutoscaler {
|
||||||
private adjusmentRateInMilliseconds = 500;
|
private adjusmentRateInMilliseconds = 500;
|
||||||
private fps = 0;
|
private fps = 0;
|
||||||
|
|
||||||
public fpsTarget = 50;
|
public static fpsTarget = 30;
|
||||||
public fpsHysteresis = 5;
|
public fpsHysteresis = 5;
|
||||||
|
|
||||||
constructor(private readonly renderer: Renderer) {}
|
constructor(private readonly renderer: Renderer) {}
|
||||||
|
|
@ -59,18 +59,21 @@ export class FpsQualityAutoscaler {
|
||||||
this.fps = 1000 / ninetiethPercentile;
|
this.fps = 1000 / ninetiethPercentile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private distanceScale = 0.5;
|
private distanceScale = 0.33;
|
||||||
private lightsScale = 1;
|
private lightsScale = 1;
|
||||||
|
|
||||||
private adjustQuality() {
|
private adjustQuality() {
|
||||||
if (this.fps >= this.fpsTarget + this.fpsHysteresis) {
|
if (this.fps >= FpsQualityAutoscaler.fpsTarget + this.fpsHysteresis) {
|
||||||
this.distanceScale = clamp(this.distanceScale + 0.1, 0.2, 1);
|
this.distanceScale = this.distanceScale + 0.1;
|
||||||
this.lightsScale = clamp(this.lightsScale + 0.1, 0.2, 1);
|
this.lightsScale = this.lightsScale + 0.1;
|
||||||
} else if (this.fps <= this.fpsTarget + this.fpsHysteresis) {
|
} else if (this.fps <= FpsQualityAutoscaler.fpsTarget + this.fpsHysteresis) {
|
||||||
this.distanceScale = clamp(this.distanceScale / 2, 0.2, 1);
|
this.distanceScale = this.distanceScale / 1.5;
|
||||||
this.lightsScale = clamp(this.lightsScale / 2, 0.2, 1);
|
this.lightsScale = this.lightsScale / 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.distanceScale = clamp(this.distanceScale, 0.1, 1);
|
||||||
|
this.lightsScale = clamp(this.lightsScale, 0.2, 1);
|
||||||
|
|
||||||
this.renderer.setRuntimeSettings({
|
this.renderer.setRuntimeSettings({
|
||||||
distanceRenderScale: this.distanceScale,
|
distanceRenderScale: this.distanceScale,
|
||||||
lightsRenderScale: this.lightsScale,
|
lightsRenderScale: this.lightsScale,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue