{"id":1510,"date":"2025-09-29T23:26:20","date_gmt":"2025-09-29T22:26:20","guid":{"rendered":"https:\/\/grimms3dworlds.ddns.net\/?page_id=1510"},"modified":"2025-09-29T23:26:20","modified_gmt":"2025-09-29T22:26:20","slug":"cod-2-sun-file","status":"publish","type":"page","link":"https:\/\/grimms3dworlds.ddns.net\/index.php\/cod-2-sun-file\/","title":{"rendered":"CoD 2 Sun file"},"content":{"rendered":"\n<div style=\"font-family: 'Segoe UI', Arial, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; background: #ffffff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);\">\n    <script>\n    function copyCode(button) {\n        const pre = button.previousElementSibling;\n        const code = pre.querySelector('code');\n        const text = code.innerText;\n        navigator.clipboard.writeText(text).then(() => {\n            button.textContent = 'Copied!';\n            button.style.background = '#28a745';\n            setTimeout(() => {\n                button.textContent = 'Copy';\n                button.style.background = '#007bff';\n            }, 2000);\n        }).catch(err => {\n            console.error('Failed to copy: ', err);\n        });\n    }\n    <\/script>\n\n    <h1 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Configuring the Sun File in Call of Duty 2<\/h1>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">The sun file enables you to add a sun or moon with a flare effect to your custom map&#8217;s sky in Call of Duty 2. Follow these steps to implement it:<\/p>\n\n    <ol style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Create a folder named <code>sun<\/code> in your game&#8217;s main directory.<\/li>\n        <li style=\"margin-bottom: 8px;\">Inside the <code>sun<\/code> folder, create a file named <code>sun_yourmapname.sun<\/code>, replacing <code>yourmapname<\/code> with your map&#8217;s name.<\/li>\n        <li style=\"margin-bottom: 8px;\">Open the sun file in a text editor and insert the following code:<\/li>\n    <\/ol>\n\n    <div style=\"position: relative;\">\n        <pre style=\"background: #1e1e1e; color: #ffffff; padding: 15px; border-radius: 5px; font-size: 14px; line-height: 1.4; max-height: 400px; overflow-y: auto; overflow-x: auto; white-space: pre;\"><code>r_sunsprite_shader \"sun_toujane\"\nr_sunsprite_size \"28.8433\"\nr_sunflare_shader \"sun_flare_beltot\"\nr_sunflare_min_size \"715.6\"\nr_sunflare_min_angle \"82.3608\"\nr_sunflare_max_size \"1213.5\"\nr_sunflare_max_angle \"0\"\nr_sunflare_max_alpha \"0.63276\"\nr_sunflare_fadein \"0.2604\"\nr_sunflare_fadeout \"0.2992\"\nr_sunblind_min_angle \"62.4258\"\nr_sunblind_max_angle \"14.6015\"\nr_sunblind_max_darken \"0.39834\"\nr_sunblind_fadein \"0.5\"\nr_sunblind_fadeout \"1\"\nr_sunglare_min_angle \"20.7108\"\nr_sunglare_max_angle \"5.7933\"\nr_sunglare_max_lighten \"0.42271\"\nr_sunglare_fadein \"0.7758\"\nr_sunglare_fadeout \"3\"\nr_sun_fx_position \"-45 210 0\"<\/code><\/pre>\n        <button onclick=\"copyCode(this)\" style=\"position: absolute; top: 10px; right: 10px; background: #007bff; color: #ffffff; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;\">Copy<\/button>\n    <\/div>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">These settings are based on the Carentan map and are compatible with its skybox material. Save the file and include the <code>sun<\/code> folder with the sun file in your map&#8217;s IWD file. When the map loads, the sun should appear correctly.<\/p>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Understanding Sun File Parameters<\/h2>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">The following parameters, derived through experimentation, control the sun and flare effects. They are generally accurate:<\/p>\n\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\"><code>r_sunsprite_shader \"sun_toujane\"<\/code>: Defines the shader or texture for the sun&#8217;s visual appearance. For example, <code>sun_toujane<\/code> is a predefined shader.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunsprite_size \"62.2501\"<\/code>: Sets the size of the sun&#8217;s sprite in the sky, determining its apparent size.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_shader \"sun_flare_beltot\"<\/code>: Specifies the shader for the sun&#8217;s flare effect, such as the glowing halo or lens flare.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_min_size \"237.8\"<\/code>: Establishes the minimum size of the flare effect to prevent it from shrinking too much.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_min_angle \"40.869\"<\/code>: Sets the minimum angle (in degrees) between the player&#8217;s view and the sun for the flare to be visible.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_max_size \"669.9\"<\/code>: Defines the maximum size of the flare effect based on viewing conditions.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_max_angle \"2.14669\"<\/code>: Specifies the angle (in degrees) where the flare effect is at its strongest.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_max_alpha \"0.62536\"<\/code>: Controls the maximum opacity of the flare (1.0 is fully opaque, 0.0 is fully transparent).<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_fadein \"0.2604\"<\/code>: Sets the time (in seconds) for the flare to fade in when it becomes visible.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunflare_fadeout \"0.2992\"<\/code>: Sets the time (in seconds) for the flare to fade out when no longer visible.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunblind_min_angle \"33.9543\"<\/code>: Defines the minimum angle (in degrees) for the sunblind effect, which darkens the screen when looking near the sun.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunblind_max_angle \"9.9647\"<\/code>: Sets the angle (in degrees) where the sunblind effect is strongest.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunblind_max_darken \"0.23155\"<\/code>: Controls the maximum darkening intensity of the sunblind effect.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunblind_fadein \"0.5\"<\/code>: Specifies the time (in seconds) for the sunblind effect to fade in.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunblind_fadeout \"1\"<\/code>: Specifies the time (in seconds) for the sunblind effect to fade out.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunglare_min_angle \"10.6101\"<\/code>: Sets the minimum angle (in degrees) for the sunglare effect, which brightens the screen near the sun.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunglare_max_angle \"48.2526\"<\/code>: Sets the angle (in degrees) where the sunglare effect is at its maximum.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunglare_max_lighten \"0\"<\/code>: Controls the maximum brightening intensity of the sunglare effect (0 disables brightening).<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunglare_fadein \"2.263\"<\/code>: Specifies the time (in seconds) for the sunglare effect to fade in.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sunglare_fadeout \"3\"<\/code>: Specifies the time (in seconds) for the sunglare effect to fade out.<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>r_sun_fx_position \"-9.3504 134.122 0\"<\/code>: Defines the sun&#8217;s position in the game world using x, y, z coordinates, determining its location in the sky.<\/li>\n    <\/ul>\n\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Ensure the <code>r_sun_fx_position<\/code> matches the <code>sundirection<\/code> variable in your map&#8217;s worldspawn settings to align the lighting with the sun&#8217;s position.<\/p>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Available Shaders in Call of Duty 2<\/h2>\n\n    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Sun Shaders<\/h3>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">sun<\/li>\n        <li style=\"margin-bottom: 8px;\">sun_beltot<\/li>\n        <li style=\"margin-bottom: 8px;\">sun_trainyard<\/li>\n        <li style=\"margin-bottom: 8px;\">sun_toujane<\/li>\n        <li style=\"margin-bottom: 8px;\">sun_silotown_assault<\/li>\n        <li style=\"margin-bottom: 8px;\">sun_moon<\/li>\n    <\/ul>\n\n    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Sunflare Shaders<\/h3>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">sun_flare_trainyard<\/li>\n        <li style=\"margin-bottom: 8px;\">sun_flare_toujane<\/li>\n    <\/ul>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Creating Custom Shaders in Asset Manager<\/h2>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">You can create custom shaders for your sun file using Asset Manager by following these steps:<\/p>\n\n    <ol style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Prepare an image for your sun with an alpha channel as a mask, saved as a DDS file with the prefix <code>sun<\/code> (e.g., <code>sun_yourmapname.dds<\/code>).<\/li>\n        <li style=\"margin-bottom: 8px;\">In Asset Manager, create a new material named <code>sun_yourmapname<\/code>, replacing <code>yourmapname<\/code> with your map&#8217;s name.<\/li>\n        <li style=\"margin-bottom: 8px;\">Configure the material with the following settings:<\/li>\n    <\/ol>\n\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\"><code>materialType<\/code>: unlit<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>SurfaceType<\/code>: none<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>usage<\/code>: &lt;not in editor&gt;<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>blendfunc<\/code>: blend<\/li>\n        <li style=\"margin-bottom: 8px;\"><code>alphatest<\/code>: adjust to suit your alpha channel<\/li>\n    <\/ul>\n\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">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.<\/p>\n\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Sun files do not require recompiling the map, simplifying the implementation process.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>function copyCode(button) { const pre = button.previousElementSibling; const code = pre.querySelector(&#8216;code&#8217;); const text = code.innerText; navigator.clipboard.writeText(text).then(() => { button.textContent = &#8216;Copied!&#8217;; button.style.background = &#8216;#28a745&#8217;; setTimeout(() => { button.textContent = &#8216;Copy&#8217;; button.style.background = &#8216;#007bff&#8217;; }, 2000); }).catch(err => { console.error(&#8216;Failed to copy: &#8216;, err); }); } Configuring the Sun File in Call of Duty 2 The [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1510","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/comments?post=1510"}],"version-history":[{"count":2,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1510\/revisions"}],"predecessor-version":[{"id":1512,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1510\/revisions\/1512"}],"wp:attachment":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=1510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}