Skip to content
GraphicsSettings

Settings / GraphicsSettings

GraphicsSettings Class ​

Image graphics quality settings

Example usage: Create a script named "ClassExample", place it in the object bar, open the script, enter the following code to save, run the game, and you will see the corresponding method call information in the server log. The code is as follows:

ts
@Component
export default class ClassExample extends Script {

   protected onStart(): void {
       this.RoomSettings();
   }

   public RoomSettings(){
       //Set the image quality level of CPU and GPU
       let cpu = mw.GraphicsLevel.Low1;
       let gpu = mw.GraphicsLevel.Low2;
       GraphicsSettings.setGraphicsCPULevel(cpu);
       GraphicsSettings.setGraphicsGPULevel(gpu);
       //Enable automatic resolution
       GraphicsSettings.setAutoScreenPercentage(true);
       //Set FSR anti aliasing level
       GraphicsSettings.setFSRLevel(3);
       //Set sharpening level
       GraphicsSettings.setSharpness(1);

       //Get the current CPU image quality level
       let cpulevel = GraphicsSettings.getCPULevel();
       //Get the current GPU graphics quality level
       let gpulevel = GraphicsSettings.getGPULevel();
       //Get default CPU image quality level
       let Defaultcpulevel = GraphicsSettings.getDefaultCPULevel();
       //Get the default GPU graphics quality level
       let Defaultcgpulevel = GraphicsSettings.getDefaultGPULevel();
       //Get the current automatic resolution enabled status
       GraphicsSettings.getAutoScreenPercentage();
       //Get the current FSR anti aliasing level
       GraphicsSettings.getFSRLevel();
       //Get the current sharpening level
       GraphicsSettings.getSharpness();
   }
}
@Component
export default class ClassExample extends Script {

   protected onStart(): void {
       this.RoomSettings();
   }

   public RoomSettings(){
       //Set the image quality level of CPU and GPU
       let cpu = mw.GraphicsLevel.Low1;
       let gpu = mw.GraphicsLevel.Low2;
       GraphicsSettings.setGraphicsCPULevel(cpu);
       GraphicsSettings.setGraphicsGPULevel(gpu);
       //Enable automatic resolution
       GraphicsSettings.setAutoScreenPercentage(true);
       //Set FSR anti aliasing level
       GraphicsSettings.setFSRLevel(3);
       //Set sharpening level
       GraphicsSettings.setSharpness(1);

       //Get the current CPU image quality level
       let cpulevel = GraphicsSettings.getCPULevel();
       //Get the current GPU graphics quality level
       let gpulevel = GraphicsSettings.getGPULevel();
       //Get default CPU image quality level
       let Defaultcpulevel = GraphicsSettings.getDefaultCPULevel();
       //Get the default GPU graphics quality level
       let Defaultcgpulevel = GraphicsSettings.getDefaultGPULevel();
       //Get the current automatic resolution enabled status
       GraphicsSettings.getAutoScreenPercentage();
       //Get the current FSR anti aliasing level
       GraphicsSettings.getFSRLevel();
       //Get the current sharpening level
       GraphicsSettings.getSharpness();
   }
}

Table of contents ​

Accessors ​

occlusionCullingEnabled(): boolean other
Get whether occlusion culling is enabled (when occlusion culling is enabled, DrawCall can be reduced to a certain extent. The specific effect depends on the degree of mutual occlusion of objects in the scene, but it may cause objects to be switched from being culled to not being culled, and rendering will be delayed by 3 frames)

Methods ​

getAutoScreenPercentage(): boolean other
Get the status of the automatic resolution switch
getFSRLevel(): number other
Get FSR graphics quality level
getSharpness(): number other
Obtain sharpening degree
setAutoScreenPercentage(isEnabled: boolean): void other
Set whether to enable automatic resolution
setFSRLevel(FSRLevel: number): void other
Set TSR level
setSharpness(sharpness: number): void other
Set sharpening level

Accessors ​

occlusionCullingEnabled ​

• Static get occlusionCullingEnabled(): boolean other

• Static set occlusionCullingEnabled(isEnabled): void other

Get whether occlusion culling is enabled (when occlusion culling is enabled, DrawCall can be reduced to a certain extent. The specific effect depends on the degree of mutual occlusion of objects in the scene, but it may cause objects to be switched from being culled to not being culled, and rendering will be delayed by 3 frames)

Returns ​

booleanIs occlusion removal currently enabled. If the return value is undefined, please check whether the client call

Set occlusion removal (when occlusion removal is enabled, it can reduce DrawCall to a certain extent. The specific effect depends on the degree of mutual occlusion between objects in the scene, but it may cause a delay of 3 frames in rendering when objects switch from being removed to not being removed)

Parameters ​

isEnabled booleanUsage: Do you want to enable occlusion removal

Methods ​

getAutoScreenPercentage ​

• Static getAutoScreenPercentage(): boolean other

Get the status of the automatic resolution switch

Returns ​

booleanGet the status of the automatic resolution switch. If the return value is undefined, please check if it is called on the client side

getFSRLevel ​

• Static getFSRLevel(): number other

Get FSR graphics quality level

Returns ​

numberGet FSR graphics quality level. If the return value is undefined, please check whether the client call

getSharpness ​

• Static getSharpness(): number other

Obtain sharpening degree

Returns ​

numberObtain the degree of sharpening. If the return value is undefined, please check whether the client call

setAutoScreenPercentage ​

• Static setAutoScreenPercentage(isEnabled): void other

Set whether to enable automatic resolution

Parameters ​

isEnabled booleanUsage: Switch

setFSRLevel ​

• Static setFSRLevel(FSRLevel): void other

Set TSR level

Parameters ​

FSRLevel numberUsage: FSR Level

setSharpness ​

• Static setSharpness(sharpness): void other

Set sharpening level

Parameters ​

sharpness numberUsage: Sharpening degree 0-1