Skip to content
GraphicsSettings

设置 / GraphicsSettings

GraphicsSettings Class

图片画质设置

使用示例:创建一个名为"ClassExample"的脚本,放置在对象栏中,打开脚本,输入以下代码保存,运行游戏,你将在服务器Log中看到对应方法调用信息。代码如下:
ts
@Component
export default class ClassExample extends Script {

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

   public RoomSettings(){
       //设置CPU和GPU的画质等级
       let cpu = mw.GraphicsLevel.Low1;
       let gpu = mw.GraphicsLevel.Low2;
       GraphicsSettings.setGraphicsCPULevel(cpu);
       GraphicsSettings.setGraphicsGPULevel(gpu);
       //开启自动分辨率
       GraphicsSettings.setAutoScreenPercentage(true);
       //设置FSR抗锯齿等级
       GraphicsSettings.setFSRLevel(3);
       //设置锐化程度
       GraphicsSettings.setSharpness(1);

       //获取当前CPU画质等级
       let cpulevel = GraphicsSettings.getCPULevel();
       //获取当前GPU画质等级
       let gpulevel = GraphicsSettings.getGPULevel();
       //获取默认CPU画质等级
       let Defaultcpulevel = GraphicsSettings.getDefaultCPULevel();
       //获取默认GPU画质等级
       let Defaultcgpulevel = GraphicsSettings.getDefaultGPULevel();
       //获取当前自动分辨率开启状态
       GraphicsSettings.getAutoScreenPercentage();
       //获取当前FSR抗锯齿等级
       GraphicsSettings.getFSRLevel();
       //获取当前锐化程度
       GraphicsSettings.getSharpness();
   }
}
@Component
export default class ClassExample extends Script {

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

   public RoomSettings(){
       //设置CPU和GPU的画质等级
       let cpu = mw.GraphicsLevel.Low1;
       let gpu = mw.GraphicsLevel.Low2;
       GraphicsSettings.setGraphicsCPULevel(cpu);
       GraphicsSettings.setGraphicsGPULevel(gpu);
       //开启自动分辨率
       GraphicsSettings.setAutoScreenPercentage(true);
       //设置FSR抗锯齿等级
       GraphicsSettings.setFSRLevel(3);
       //设置锐化程度
       GraphicsSettings.setSharpness(1);

       //获取当前CPU画质等级
       let cpulevel = GraphicsSettings.getCPULevel();
       //获取当前GPU画质等级
       let gpulevel = GraphicsSettings.getGPULevel();
       //获取默认CPU画质等级
       let Defaultcpulevel = GraphicsSettings.getDefaultCPULevel();
       //获取默认GPU画质等级
       let Defaultcgpulevel = GraphicsSettings.getDefaultGPULevel();
       //获取当前自动分辨率开启状态
       GraphicsSettings.getAutoScreenPercentage();
       //获取当前FSR抗锯齿等级
       GraphicsSettings.getFSRLevel();
       //获取当前锐化程度
       GraphicsSettings.getSharpness();
   }
}

Table of contents

Accessors

occlusionCullingEnabled(): boolean client
获取是否开启遮挡剔除(遮挡剔除开启后能一定程度上降低DrawCall,具体效果取决于场景物体相互遮挡的程度, 但是可能会导致物体从被剔除切换到不被剔除时延迟3帧才渲染)

Methods

getAutoScreenPercentage(): boolean client
获取自动分辨率开关状态
getFSRLevel(): number client
获取FSR画质等级
getSharpness(): number client
获取锐化程度
setAutoScreenPercentage(isEnabled: boolean): void client
设置是否开启自动分辨率
setFSRLevel(FSRLevel: number): void client
设置TSR等级
setSharpness(sharpness: number): void client
设置锐化程度

Accessors

occlusionCullingEnabled

Static get occlusionCullingEnabled(): boolean client

Static set occlusionCullingEnabled(isEnabled): void client

获取是否开启遮挡剔除(遮挡剔除开启后能一定程度上降低DrawCall,具体效果取决于场景物体相互遮挡的程度, 但是可能会导致物体从被剔除切换到不被剔除时延迟3帧才渲染)

Returns

boolean当前是否开启遮挡剔除。如果返回值为undefined,请检查是否在客户端调用

设置遮挡剔除(遮挡剔除开启后能一定程度上降低DrawCall,具体效果取决于场景物体相互遮挡的程度, 但是可能会导致物体从被剔除切换到不被剔除时延迟3帧才渲染)

Parameters

isEnabled boolean是否开启遮挡剔除

Methods

getAutoScreenPercentage

Static getAutoScreenPercentage(): boolean client

获取自动分辨率开关状态

Returns

boolean获取自动分辨率开关状态。如果返回值为undefined,请检查是否在客户端调用

getFSRLevel

Static getFSRLevel(): number client

获取FSR画质等级

Returns

number获取FSR画质等级。如果返回值为undefined,请检查是否在客户端调用

getSharpness

Static getSharpness(): number client

获取锐化程度

Returns

number获取锐化程度。如果返回值为undefined,请检查是否在客户端调用

setAutoScreenPercentage

Static setAutoScreenPercentage(isEnabled): void client

设置是否开启自动分辨率

Parameters

isEnabled boolean开关

setFSRLevel

Static setFSRLevel(FSRLevel): void client

设置TSR等级

Parameters

FSRLevel numberFSR等级

setSharpness

Static setSharpness(sharpness): void client

设置锐化程度

Parameters

sharpness number锐化程度 0-1