Skip to content

How to Install 1 shader

Devvrat Mishra edited this page Jan 3, 2022 · 13 revisions

Let's say you just need 1 of the shader materials named test_1234, this is how you compile and use it:

  • Be sure that you have Modtools properly installed.
  • Copy and Paste deffiles/materials/z_test_1234.template
    ss
  • Copy and Paste 2d-mats.gdt to cod4/source_data/ (recommended)
  • Open cod4/source_data/2d-mats.gdt
  • Select test_1234 from left pane
    ss
  • Hit F10 to compile and create materials
  • Check if raw/materials/test_1234 exists

⚠️ Just having the materials won't work. You need to have required files in folders statemaps, techsets, techsets/sm2, techniques and must compile .hlsl file pair in raw/shader_bin/shader_src

  • Copy and Paste raw/statemaps/default2d_alpha.sm
  • Copy and Paste raw/techsets/hud_test_1234.techset and raw/techsets/sm2/hud_test_1234.techset
  • Copy and Paste raw/techniques/tech_test_1234.tech
  • Copy and Paste raw/shader_bin/shader_src/ps_3_0_2d_test_1234.hlsl and raw/shader_bin/shader_src/vs_3_0_2d_test_1234.hlsl

Now compile .hlsl file pairs

  • Go to raw/shader_bin/
  • Create a folder named backups (or else you'll need to run shader_tool in administrator mode)
  • Click on address bar
  • Type cmd and press Enter
    ss
  • Type shader_tool 2d_test_1234 and hit Enter
  • It should show something like this:
    ss

Now you can compile your mod/map and compilation should be successful. If it's unsuccessful, check if you have pasted files correctly.

Test it in-game:

in .csv: material,test_1234

itemDef
{
    rect			50 0 200 200 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_CENTER
    style			WINDOW_STYLE_SHADER
    forecolor		1 1 1 1
    background		"test_1234"
    border			1
    bordercolor		0.5 0.5 0.5 0.5
    visible			1
}

Should look exactly like this:

test_1234

Don't forget to ⭐ the repo if it helped 😄