How To Set or Change Resolution For Game

常用的分辨率标准:

标准 分辨率 / 像素
8K 7680x4320 (16:9,120FPS/s,12位,约每帧3300w像素,8K显示器)
4K

4096×2160(约每帧885万像素,每帧数量量50MB,4K投影、4K显示器、4K电视、4K显卡、4K手机)

2K 2048×1080(1.9:1,约每帧221w像素)
1080P 1920×1080(16:9)
720P 1280x720
480P 720x480
FHD 全高清(1080i及1080P) 1920x1080(16:9,PC、电视机、4.6寸Mobile、平板PC、投影机)

For Unity3d

how to set a Unity Fullscreen Resolution when you build a game(Mac and Windows users)?

 
   
 

Default is Full Screen = CHECKED
Default is Native Resolution = UNCHECKED
Default Screen Width = 1024
Default Screen Height = 427
Display Resolution Dialog = DISABLED
Resizable Window = UNCHECKED

Make sure these settings are selected.

Whenever you build a new game using Unity, it saves a registry key (in windows) or a preference file (On Mac) under the Company Name You selected for the player settings. By default, this is “DefaultCompany”.  Many (including myself) didn’t even know that Unity games did this when you build and run them.If you are like me, you will continually do test builds quickly by deleting the folder you built to, and re-building, then running the exe or app. However, the registry key or preference file will still contain old display settings and other settings that are NOT overwritten when you hit build, if you are building using the same Company Name. This will lead to Unity using the nearest resolution that you have selected as a standard resolution supported by the video card.

To fix this, locate the following registry key in windows:  HKCU\Software\[company name]\[product name] and delete the entire key and rebuild, then run the game.In Mac, delete the corresponding preferences file located in ~/Library/Preferences/unity.Now when you build your game, your CUSTOM standalone resolution will work, either for fullscreen mode, or if you wish, windowed mode.

Unity on Windows does support DPI scaling. but will be scaled up the "bad" way, meaning it's blurry and bad looking. you can turn DPI scaling off for the editor and enjoy your 1mm high text. On my 4k monitor it was completely unusable that way. 4k resolution is practically unusable。

SaldaVonSchwartz
Is it possible to do 4K in Unity?
Kind of, In the sense that you can import 4K videos and reproduce them without any external assets.

Is it really 4K quality?
Probably not. mp4 is lossy and so is ogg, So I assume my video went a second round of lossy compression when it was transcoded to Ogg.

Is it practical?
Not sure. So far, video importing takes an impractical amount of time. Also, 4K in general might be too much for a mobile device rending in stereo, regardless of Unity or doing it straight in OpenGL.

If you want to playback 4K in Unity you are better off finding some plugin (or coding your own) that uses the native API for video playback that the OS you are targeting uses.Then you place the video file in either Streaming Assets or PersistentDataPath.

For Unreal

UE4 默认打包出来的游戏分辨率是 1280x720.

packaged game

1、 create a file called DefaultGameUserSettings.ini in your <ProjectName>\Config folder with the following contents:

[/Script/Engine.GameUserSettings]
bUseVSync=False
ResolutionSizeX=1920
ResolutionSizeY=1080
LastUserConfirmedResolutionSizeX=1920
LastUserConfirmedResolutionSizeY=1080
WindowPosX=-1
WindowPosY=-1
bUseDesktopResolutionForFullscreen=False
FullscreenMode=2
LastConfirmedFullscreenMode=2
Version=5

 change the value: LastUserConfirmedResolutionSizeXLastUserConfirmedResolutionSizeY to your resolution you want.

2、use the console command,both with Shipping and Development built.

//游戏客户端输入“~” 调取控制台将显示所有可输入命令,注意中间的 x 为字母x小写,输入[Enter] 应用该分辨率
//~ r.setRes LastUserConfirmedResolutionSizeX x LastUserConfirmedResolutionSizeY [Enter]
Console: r.setRes 1920x1080

developing in BP

1、Just use "Execute Console Command":

r.setRes HORIZxVERT[f]

   Adding 'f' will make the game go fullscreen.
  
 

 developing in code

the options for changing game settings:whether or not to use fullscreen, the window or fullscreen resolution used, the position of the window, and scalability/graphics settings.

A pointer to the global UGameUserSettings can be found in the global GEngine.

UGameUserSettings* GetGameUserSettings()
{
    if (GEngine != nullptr)
    {
        return GEngine->GameUserSettings;
    }
    return nullptr;
}

 Several of the values used internally by this class are saved to the GameUserSettings.ini config file. If you have external automation needs, this would be the place to start.

 When you use the various mode setting functions, the mode is not immediately applied, much like you would expect from a PC game settings menu. Instead, the value is saved to the Game config. To set up a mode test flow (e.g. user selects mode, clicks apply, and is prompted to confirm if the mode is worked), you should use the following:

//Setting the mode
int32 Width = 1280, Height = 720;
UGameUserSettings* Settings = GetGameUserSettings(); // note we are using the function defined above
if (Settings != nullptr)
{
    Settings->RequestResolutionChange(Width, Height, EWindowMode::Type::Windowed, false); // we can choose to ignore the command line arguments, this is probably best when the game UI sets the mode after startup
}
 
// ...
if (UserConfirmed)
{
    Settings->ConfirmVideoMode();
 
    // Save the requested settings to our local data now
    Settings->SetScreenResolution(Settings->GetLastConfirmedScreenResolution());
    Settings->SetFullscreenMode(Settings->GetLastConfirmedFullscreenMode());
    Settings->SaveSettings();
}
else
{
    Settings->RevertVideoMode();
}

The UGameUserSettings class provides access to a FQualityLevels instance which it refers to when using the ApplySettings(bool) and ApplyNonResolutionSettings() functions.

Note that a GetQualityLevels() function exists in GEngine to obtain the current quality levels, unrelated to the quality levels in the user settings.

Settings->ScalabilityQuality.AntiAliasingQuality = 0; // Use "Low" AA quality
Settings->ScalabilityQuality.ResolutionQuality   = 3; // Use "Epic" resolution quality
 
Settings->ApplyNonResolutionSettings();
Settings->SaveSettings();

The values range from 0 to 3 and correspond to "Low", "Medium", "High" and "Epic" as in the editor quick settings dialog and in the scalability cvars. The actual meaning of these (e.g. the cvar presets to use) can be set in Scalability.ini (some sane defaults are copied to your Saved/CleanSourceConfigs and are a good basis for your own).

猜你喜欢

转载自avi.iteye.com/blog/2391736