CoD 2 Sun file

Configuring the Sun File in Call of Duty 2

The sun file enables you to add a sun or moon with a flare effect to your custom map’s sky in Call of Duty 2. Follow these steps to implement it:

  1. Create a folder named sun in your game’s main directory.
  2. Inside the sun folder, create a file named sun_yourmapname.sun, replacing yourmapname with your map’s name.
  3. Open the sun file in a text editor and insert the following code:
r_sunsprite_shader "sun_toujane"
r_sunsprite_size "28.8433"
r_sunflare_shader "sun_flare_beltot"
r_sunflare_min_size "715.6"
r_sunflare_min_angle "82.3608"
r_sunflare_max_size "1213.5"
r_sunflare_max_angle "0"
r_sunflare_max_alpha "0.63276"
r_sunflare_fadein "0.2604"
r_sunflare_fadeout "0.2992"
r_sunblind_min_angle "62.4258"
r_sunblind_max_angle "14.6015"
r_sunblind_max_darken "0.39834"
r_sunblind_fadein "0.5"
r_sunblind_fadeout "1"
r_sunglare_min_angle "20.7108"
r_sunglare_max_angle "5.7933"
r_sunglare_max_lighten "0.42271"
r_sunglare_fadein "0.7758"
r_sunglare_fadeout "3"
r_sun_fx_position "-45 210 0"

These settings are based on the Carentan map and are compatible with its skybox material. Save the file and include the sun folder with the sun file in your map’s IWD file. When the map loads, the sun should appear correctly.

Understanding Sun File Parameters

The following parameters, derived through experimentation, control the sun and flare effects. They are generally accurate:

  • r_sunsprite_shader "sun_toujane": Defines the shader or texture for the sun’s visual appearance. For example, sun_toujane is a predefined shader.
  • r_sunsprite_size "62.2501": Sets the size of the sun’s sprite in the sky, determining its apparent size.
  • r_sunflare_shader "sun_flare_beltot": Specifies the shader for the sun’s flare effect, such as the glowing halo or lens flare.
  • r_sunflare_min_size "237.8": Establishes the minimum size of the flare effect to prevent it from shrinking too much.
  • r_sunflare_min_angle "40.869": Sets the minimum angle (in degrees) between the player’s view and the sun for the flare to be visible.
  • r_sunflare_max_size "669.9": Defines the maximum size of the flare effect based on viewing conditions.
  • r_sunflare_max_angle "2.14669": Specifies the angle (in degrees) where the flare effect is at its strongest.
  • r_sunflare_max_alpha "0.62536": Controls the maximum opacity of the flare (1.0 is fully opaque, 0.0 is fully transparent).
  • r_sunflare_fadein "0.2604": Sets the time (in seconds) for the flare to fade in when it becomes visible.
  • r_sunflare_fadeout "0.2992": Sets the time (in seconds) for the flare to fade out when no longer visible.
  • r_sunblind_min_angle "33.9543": Defines the minimum angle (in degrees) for the sunblind effect, which darkens the screen when looking near the sun.
  • r_sunblind_max_angle "9.9647": Sets the angle (in degrees) where the sunblind effect is strongest.
  • r_sunblind_max_darken "0.23155": Controls the maximum darkening intensity of the sunblind effect.
  • r_sunblind_fadein "0.5": Specifies the time (in seconds) for the sunblind effect to fade in.
  • r_sunblind_fadeout "1": Specifies the time (in seconds) for the sunblind effect to fade out.
  • r_sunglare_min_angle "10.6101": Sets the minimum angle (in degrees) for the sunglare effect, which brightens the screen near the sun.
  • r_sunglare_max_angle "48.2526": Sets the angle (in degrees) where the sunglare effect is at its maximum.
  • r_sunglare_max_lighten "0": Controls the maximum brightening intensity of the sunglare effect (0 disables brightening).
  • r_sunglare_fadein "2.263": Specifies the time (in seconds) for the sunglare effect to fade in.
  • r_sunglare_fadeout "3": Specifies the time (in seconds) for the sunglare effect to fade out.
  • r_sun_fx_position "-9.3504 134.122 0": Defines the sun’s position in the game world using x, y, z coordinates, determining its location in the sky.

Note: Ensure the r_sun_fx_position matches the sundirection variable in your map’s worldspawn settings to align the lighting with the sun’s position.

Available Shaders in Call of Duty 2

Sun Shaders

  • sun
  • sun_beltot
  • sun_trainyard
  • sun_toujane
  • sun_silotown_assault
  • sun_moon

Sunflare Shaders

  • sun_flare_trainyard
  • sun_flare_toujane

Creating Custom Shaders in Asset Manager

You can create custom shaders for your sun file using Asset Manager by following these steps:

  1. Prepare an image for your sun with an alpha channel as a mask, saved as a DDS file with the prefix sun (e.g., sun_yourmapname.dds).
  2. In Asset Manager, create a new material named sun_yourmapname, replacing yourmapname with your map’s name.
  3. Configure the material with the following settings:
  • materialType: unlit
  • SurfaceType: none
  • usage: <not in editor>
  • blendfunc: blend
  • alphatest: adjust to suit your alpha channel

Additionally, disable tiling under the color map settings. Use the material name in the shader section of your sun file to apply the custom shader.

Note: Sun files do not require recompiling the map, simplifying the implementation process.

Bottom Left BackgroundBottom Right Background
Grimms 3D worlds
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.