Quick Links
Includes Techniques/Shaders for the following lighting states
It is worth noting that techniques using shadow-mapping require HSM (hardware shadow-mapping) to be supported by the GPU. The GPU also needs to support ShaderModel 3 + the client needs to use it aswell (r_rendererPreference / r_rendererInUse).
If one of the above requirements isn’t fulfilled or you find yourself in a lighting situation thats not covered by this repo, stock cod4 techniques / shaders will be used (non-hsm variants, stock hsm variants or stock ShaderModel 2 techsets located in techsets/sm2
).
Engine Background (SM / HSM)
Most, if not all cod4 weapons use the l_sm_r0c0s0 techset (-light, -shadowmap, -reflection-color-specular ). If cod4 detects that your GPU supports HSM, the engine will remap l_sm to l_hsm. Since this repo is about models (weapon models in particular) the engine will also add the mc prefix. That means that the main techset for all techniques is mc_l_hsm_r0c0s0.
Because I don’t want to modify stock techsets, techniques and shaders, I’ve changed r0c0s0 to xo_rcs (note: both are 6 chars long giving you the ability to replace l_sm_r0c0s0 with l_sm_xo_rcs in all kinds of materials using the l_sm_r0c0s0 techset).
Compiling
Grab and drop files into cod4/raw/ and compile shaders with cod4-compileTools or refer to the following tutorial section hlsl-intro/#compiling.
Please note that you need the shader_vars.h header file in shader_bin/shader_src that comes with my compileTools or the shader package v1.1_hlsl_xoxor4d.zip and is therefore not included here.
Modifications / Additions
If you want to change the used techniques or replace stock ones, you only need to do so in mc_l_hsm_xo_rcs.techset.
If you want to add “effects” to your gun, you’ll need to add that effect to each and every technique / shader so its consistent accross different lighting states. You could also use different effects for different lighting states if you wish.
I’ve included a Visual Studio solution as I like using Tim G. Jones HLSL Tools for Visual Studio
Techset Lighting States Explained