NOTE: I assume you have already learned shader basics, if you haven't maybe check out the getting started section of this wiki.

Structure Overview:

You can think of a Shader in Cryengine as a three part system, you have:

.ext files located in Engine/Shaders/
.cfi files located in Engine/Shaders/HWScripts/CryFX
.cfx files located in Engine/Shaders/HWScripts/CryFX

Now for a brief explanation of these file types:

.ext files contains the "Material Flags", these are definitions of the features that the shader has and can be enabled (These are called flags) for example in the Illum shader, "Offset Bump Mapping" is a shader feature(flag).

.cfi files mostly contain utility code, although of course there are exceptions to that. An example of that is CommonZPass.cfi which is included at the end of most of the actual shaders. See breakdown of each shader file HERE

.cfx files most of which are full shader files that you would recognize, such as; "Illum", "HumanSkin", "Vegetation" need I go on? These files are full of #includes which you need to keep your eye on. Once again there are some exceptions, one of which is the common.cfx file, which I have no idea what its for other than what you can read into it.

These three types of files put together make up a given shader. Though there may be multiple shaders in one shader path, for instance the Illum() shader compiles and runs, and then CommonZPass() compiles with the output of Illum. Or perhaps over top of it.


There are many utility files that contain functions for specific purposes that are used across many shaders. Though some contain other code as well that runs when the file is #included in a shader, so keep an eye out for that as well. Examples of utility files are: common.cfi, shadelib.cfi, debug.cfx


Vertex Shader

Pixel/Fragment Shader