Gaming Life

一日24時間、ゲームは10時間

UE4のコンソール変数の命名規則とsgコマンドの役割

この記事は、ai_9684_dctソロ Advent Calendar 2020 5日目 の記事です。

UE4には r.ScreenPercentage や、 r.Streaming.PoolSize だったり、多くの便利なコンソール変数が用意されている。こういったコンソール変数には、命名規則がある。

ConsoleManager.cpp に、コンソール変数の命名規則が書かれている。

// r.      Renderer / 3D Engine / graphical feature
// RHI.    Low level RHI (rendering platform) specific
// a.     Animation
// s.     Sound / Music
// n.      Network
// ai.     Artificial intelligence
// i.      Input e.g. mouse/keyboard
// p.      Physics
// t.      Timer
// log.       Logging system
// con.       Console (in game  or editor) 
// g.      Game specific
// Compat.
// FX.     Particle effects
// sg.     scalability group (used by scalability system, ini load/save or using SCALABILITY console command)

この中で、 sg. から始まるコマンドは少々他と違う扱いになっている。

sg.コマンドについて

sgとは、Scalability Groupの略で、sgコマンド類は、ある設定ファイルに基づいて、他のパラメータをまとめて制御する役割を持つ。例えば自分の環境だと、 sg.PostProcessQuality を3から1に変更すると、

LogConfig: Applying CVar settings from Section [PostProcessQuality@1] File [C:/Users/detec/Documents/Unreal Projects/ActionRPG/Saved/Config/Windows/Scalability.ini]
LogConfig: Setting CVar [[r.MotionBlurQuality:3]]
LogConfig: Setting CVar [[r.AmbientOcclusionMipLevelFactor:1.0]]
LogConfig: Setting CVar [[r.AmbientOcclusionMaxQuality:60]]
LogConfig: Setting CVar [[r.AmbientOcclusionLevels:-1]]
LogConfig: Setting CVar [[r.AmbientOcclusionRadiusScale:1.5]]
LogConfig: Setting CVar [[r.DepthOfFieldQuality:1]]
LogConfig: Setting CVar [[r.RenderTargetPoolMin:350]]
LogConfig: Setting CVar [[r.LensFlareQuality:0]]
LogConfig: Setting CVar [[r.SceneColorFringeQuality:0]]
LogConfig: Setting CVar [[r.EyeAdaptationQuality:0]]
LogConfig: Setting CVar [[r.BloomQuality:4]]
LogConfig: Setting CVar [[r.FastBlurThreshold:2]]
LogConfig: Setting CVar [[r.Upscale.Quality:2]]
LogConfig: Setting CVar [[r.Tonemapper.GrainQuantization:0]]
LogConfig: Setting CVar [[r.LightShaftQuality:0]]
LogConfig: Setting CVar [[r.Filter.SizeScale:0.7]]
LogConfig: Setting CVar [[r.Tonemapper.Quality:2]]
LogConfig: Setting CVar [[r.DOF.Gather.AccumulatorQuality:0        ; lower gathering accumulator quality]]
LogConfig: Setting CVar [[r.DOF.Gather.PostfilterMethod:2          ; Max3x3 postfilering method]]
LogConfig: Setting CVar [[r.DOF.Gather.EnableBokehSettings:0       ; no bokeh simulation when gathering]]
LogConfig: Setting CVar [[r.DOF.Gather.RingCount:3                 ; low number of samples when gathering]]
LogConfig: Setting CVar [[r.DOF.Scatter.ForegroundCompositing:0    ; no foreground scattering]]
LogConfig: Setting CVar [[r.DOF.Scatter.BackgroundCompositing:0    ; no foreground scattering]]
LogConfig: Setting CVar [[r.DOF.Recombine.Quality:0                ; no slight out of focus]]
LogConfig: Setting CVar [[r.DOF.TemporalAAQuality:0                ; faster temporal accumulation]]
LogConfig: Setting CVar [[r.DOF.Kernel.MaxForegroundRadius:0.006   ; required because low gathering and no scattering and not looking great at 1080p]]
LogConfig: Setting CVar [[r.DOF.Kernel.MaxBackgroundRadius:0.006   ; required because low gathering and no scattering and not looking great at 1080p]]
sg.PostProcessQuality = "1"

この様にポストプロセス関連のコンソール変数がまとめて変更される。

Scalability Groupの設定は、Engine/Configフォルダに格納されている。BaseScalability.iniに記述されている。ここに記載されている値を変更すれば、例えば、 sg.PostProcessQuality を1にさげても、 r.BloomQuality は下げてほしくない……みたいな調整ができる。

参考サイト

docs.unrealengine.com