Compiling Vulkan Shaders for CryEngine V .4

#1
Disclaimer: These steps were performed on a clean windows 7 64-bit installation after necessary graphics and system drivers and windows updates have been applied, steps may vary between cryengine and crylauncher versions, I take no responsibility or liability for any damages or inconveniences caused by following any information provided. All information provided is of my best knowledge and opinion and is not official in any way, use at your own risk.
Enjoy this small tutorial showing how to compile Vulkan Shaders on windows 64bit platform.

Requirements

  1. Make sure your engine is correctly installed*, and is the default for your machine.
  2. 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)

^ The above short-hands may appear in any part of these instructions (text/code snippets).

Setup the Remote Shader Compiler

  1. Open %ENGINE_ROOT%/Tools/RemoteShaderCompiler/config.ini in your favourite text editor.
  2. Put the following contents into the open file, then save and close:

Code: Select all

port = 31455
PrintErrors = 1


Setup the Game Client
  1. Remove any value for any CVAR named "sys_user_folder" in either your cryproject file or any .cfg file.
  2. 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


Setup and use the RC Package batch scripts
  1. Delete all .pak type files from the %ENGINE_ROOT%/Engine folder
  2. Copy RCJobFiles folder from the supplied package to your engine root (post attachment)
  3. Read the RCJobFiles\README.txt file
  4. Run RCJobFiles\tools\setup.bat
  5. Run RCJobFiles\JOB_fresh_start.bat
  6. Copy contents of RCData\RCOut\engine to the root\engine folder

Start compiling shaders
  1. Start %ENGINE_ROOT%/Tools/RemoteShaderCompiler
  2. Launch %ENGINE_ROOT%/bin/win_x64/GameLauncher.exe
  3. Move around your level, check the console for shader compilation messages, as well as the RSC console window
  4. Keep moving around etc until you are satisfied the shaders have been compiled. (Generally, you keep adding to the cache through playtests etc)
  5. Close the game

Build PAK cache archives
  1. Run RCJobFiles/JOB_shadercache.bat
  2. Close the RemoteShaderCompiler console window
  3. Copy the new shadercache/shadersbin and shadercachestartup .pak files from RCData\RCOut\engine to the root\engine folder
  4. Start the game without compilation support and verify

=== Attachment zip contains windows BATCH source code, take note of the disclaimer at top of this post ===
RCJobFiles.zip
RC Package
(19.64 KiB) Downloaded 26 times


Enjoy


Special note (correctly installed*).. preferred method for 5.4 previews:
  1. Clone repo at tag 5.4.0_previewX (where X is the preview number)
  2. Download release zip for preview X and merge with/overwrite into your cloned repo folder.
Uniflare
CRYENGINE Community Coordinator
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Re: Compiling Vulkan Shaders for CryEngine V .4

#3
or, probably a lot simpler version if you just need to get Vulkan running in GameLauncher:

put this into system.cfg (in project or engine folder):

Code: Select all

r_shadersallowcompilation = 1
r_shadersremotecompiler = 1
r_shadercompilerserver = 127.0.0.1
r_shadercompilerport = 31455
r_driver = vk


start CrySCompileServer.exe from <CE engine dir>/Tools/RemoteShaderCompiler,
run game via GameLauncher.

you don't actually need to change the config.ini for remote shader compiler unless you really want to change the port etc.

Re: Compiling Vulkan Shaders for CryEngine V .4

#4
0lento wrote:or, probably a lot simpler version if you just need to get Vulkan running in GameLauncher:

put this into system.cfg (in project or engine folder):

Code: Select all

r_shadersallowcompilation = 1
r_shadersremotecompiler = 1
r_shadercompilerserver = 127.0.0.1
r_shadercompilerport = 31455
r_driver = vk


start CrySCompileServer.exe from <CE engine dir>/Tools/RemoteShaderCompiler,
run game via GameLauncher.

you don't actually need to change the config.ini for remote shader compiler unless you really want to change the port etc.


Doesnt Work for me!
Vulkan Renderer, doesnt show up in the Viewport in the Editor!!

I dont know if cryengine needs some time to work properly, becuase of changing the renderer, but it takes a huge time at all. I used the Engine folder!
Well, hoestly it would give us a better and easier control if we had an option in the main menu bar, where u can also change the quality of the graphics, just like a dropdoen menu, where i can choose if i want the Vulkan renderer, OpenGL renderer or DirectX renderer!!!
Just for people who had know acknowledge or he she is a beginner, and dont want to code or scripting!
Image


My Hardware Spec:

AMD FX 6300+
2*8 GB RAM DDR 3 2400
2* Radeon R9 270x Crossfired
128, 256 & 512 GB SSD's

Re: Compiling Vulkan Shaders for CryEngine V .4

#5
fightergx wrote:
0lento wrote:or, probably a lot simpler version if you just need to get Vulkan running in GameLauncher:

put this into system.cfg (in project or engine folder):

Code: Select all

r_shadersallowcompilation = 1
r_shadersremotecompiler = 1
r_shadercompilerserver = 127.0.0.1
r_shadercompilerport = 31455
r_driver = vk


start CrySCompileServer.exe from <CE engine dir>/Tools/RemoteShaderCompiler,
run game via GameLauncher.

you don't actually need to change the config.ini for remote shader compiler unless you really want to change the port etc.


Doesnt Work for me!
Vulkan Renderer, doesnt show up in the Viewport in the Editor!!

I dont know if cryengine needs some time to work properly, becuase of changing the renderer, but it takes a huge time at all. I used the Engine folder!
Well, hoestly it would give us a better and easier control if we had an option in the main menu bar, where u can also change the quality of the graphics, just like a dropdoen menu, where i can choose if i want the Vulkan renderer, OpenGL renderer or DirectX renderer!!!
Just for people who had know acknowledge or he she is a beginner, and dont want to code or scripting!

It works for the game launcher not the Sandbox Editor. That will come later.

Only DX11 works in the Editor for now.

Re: Compiling Vulkan Shaders for CryEngine V .4

#8
Try both :). Feedback for vk would be great since imo it is the way forward. At the end it is just a cvar and shader compilation between the two. vk requires the rsc to compile atm afaik so if you are missing some shaders in the end user psckage the user wont be auto compiling missing shaders, whereas dx11 can be compiled directly in game launcher so it is preferred atm.
Uniflare
CRYENGINE Community Coordinator
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron