Enjoy this small tutorial showing how to compile Vulkan Shaders on windows 64bit platform.
Requirements
- Make sure your engine is correctly installed*, and is the default for your machine.
- Be sure you have a working game, with all assets etc in the correct stated locations.
Code: Select all
The following short-hands will be used to generalize these instructions:
%ENGINE_ROOT% The root folder of your CRYENGINE installation.
%GAME_ASSETS% The Game Assets folder name, by default 'Assets'.
%REND_DRIVER% One of 'VK' (Vulkan), 'DX11' (DirectX 11), 'DX12' (DirectX 12), 'GL' (OpenGL)
Setup the Remote Shader Compiler
- Open %ENGINE_ROOT%/Tools/RemoteShaderCompiler/config.ini in your favourite text editor.
- Put the following contents into the open file, then save and close:
Code: Select all
port = 31455
PrintErrors = 1
- Remove any value for any CVAR named "sys_user_folder" in either your cryproject file or any .cfg file.
- Put the following contents into %ENGINE_ROOT%/system.cfg, then save and close:
Code: Select all
-- Location under %ENGINE_ROOT% which contains the game assets
sys_game_folder=%GAME_ASSETS%
-- Force the user directory to be in the engine root
sys_user_folder=
-- More robust logging
log_IncludeTime=3
log_FileVerbosity=4
-- Make sure we use source files when spossible
sys_pakpriority=0
sys_PakLogMissingFiles=2
r_fullscreen = 0
r_width = 800
r_height = 600
-- Optimal CVARS for compiling shaders
r_multithreaded=0
sys_no_crash_dialog=1
sys_vr_support = 0
e_profile_level_loading=0
d3d9_NullRefDevice=1
-- Enable Remote Shader Compiler
r_ShadersRemoteCompiler=1
r_ShaderCompilerServer=127.0.0.1
r_ShaderCompilerPort=31455
-- Disable this in-game to stop sending requests to RSC
r_ShadersSubmitRequestline=1
-- Automatically check for shader changes
r_ShadersCompileAutoActivate=1
-- Store compiled shaders in the user folder
r_ShadersUserFolder=1
---- Enable asynchronous shader compiling
r_ShadersAsyncCompiling=3
---- Usage: r_ShadersAsyncCompiling [0/1/2/3]
---- 0 = off, (stalling) shaders compiling
---- 1 = on, shaders are compiled in parallel, missing shaders are rendered in yellow
---- 2 = on, shaders are compiled in parallel, missing shaders are not rendered
---- 3 = on, shaders are compiled in parallel in precache mode
-- Make sure to use your desired renderer
r_driver=%REND_DRIVER%
-- Examples:
-- r_driver=VK
-- r_driver=DX11
-- r_driver=DX12
-- r_driver=GL
-- Consoles
-- r_driver=AUTO
- Delete all .pak type files from the %ENGINE_ROOT%/Engine folder
- Copy RCJobFiles folder from the supplied package to your engine root (post attachment)
- Read the RCJobFiles\README.txt file
- Run RCJobFiles\tools\setup.bat
- Run RCJobFiles\JOB_fresh_start.bat
- Copy contents of RCData\RCOut\engine to the root\engine folder
- Start %ENGINE_ROOT%/Tools/RemoteShaderCompiler
- Launch %ENGINE_ROOT%/bin/win_x64/GameLauncher.exe
- Move around your level, check the console for shader compilation messages, as well as the RSC console window
- Keep moving around etc until you are satisfied the shaders have been compiled. (Generally, you keep adding to the cache through playtests etc)
- Close the game
- Run RCJobFiles/JOB_shadercache.bat NOTE: (This copies generated shaders from the user folder in the engine root. if you user folder is somewhere else, copy them to the user folder in the engine root before executing this batch file).
- Close the RemoteShaderCompiler console window
- Copy the new shadercache/shadersbin and shadercachestartup .pak files from RCData\RCOut\engine to the root\engine folder
- Start the game without compilation support and verify
Special note (correctly installed*).. preferred method for 5.4 previews:
- Clone repo at tag 5.4.0_previewX (where X is the preview number)
- Download release zip for preview X and merge with/overwrite into your cloned repo folder.