{"id":1540,"date":"2025-10-03T17:01:33","date_gmt":"2025-10-03T16:01:33","guid":{"rendered":"https:\/\/grimms3dworlds.ddns.net\/?page_id=1540"},"modified":"2025-10-03T17:01:33","modified_gmt":"2025-10-03T16:01:33","slug":"world-lighting","status":"publish","type":"page","link":"https:\/\/grimms3dworlds.ddns.net\/index.php\/world-lighting\/","title":{"rendered":"World Lighting"},"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;\">World Lighting<\/h1>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">To configure sunlight and ambient light, we use the worldspawn settings.<\/p>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">With <strong>NOTHING<\/strong> in the map selected, hit <strong>N<\/strong> on your keyboard. This brings up the entity window and should select <strong>worldspawn<\/strong>. Here, you can input the keys\/values required.<\/p>\n\n    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Ambient Lighting<\/h2>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">These settings control the map\u2019s global ambient lighting, which provides baseline illumination to all surfaces, preventing completely dark areas and setting the overall mood.<\/p>\n\n    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">ambient<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Sets the intensity of global ambient light, which uniformly illuminates all surfaces, regardless of specific light sources like the sun or lamps. This acts as a baseline brightness to ensure no area is pitch black.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Values range from <code>0<\/code> (no ambient light, completely dark) to <code>1<\/code> (full brightness) or <code>2<\/code> (overbright, very intense).<\/li>\n        <li style=\"margin-bottom: 8px;\">Must be paired with <code>_color<\/code> to define the light\u2019s hue.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Higher values can wash out shadows, reducing contrast and making the map look flat. Lower values create moodier, darker environments but may obscure details. Always test with <code>_color<\/code> for balanced lighting.<\/p>\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>ambient 0.2<\/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    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">_color<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Defines the RGB color of the ambient light, controlling its hue across the map. Values are specified on a <code>0-1<\/code> scale for red, green, and blue components.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Used with <code>ambient<\/code> to tint the map\u2019s baseline lighting (e.g., blue for a moonlit effect, warm tones for sunset).<\/li>\n        <li style=\"margin-bottom: 8px;\">Example: <code>0.2 0.2 0.8<\/code> creates a cold, moonlit ambiance, while <code>0.8 0.6 0.4<\/code> mimics a warm evening glow.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Choose RGB values that align with the map\u2019s theme (e.g., cool tones for night maps, warm tones for desert maps). Test with <code>ambient<\/code> to avoid unnatural lighting effects. In Call of Duty 2, press <strong>K<\/strong> on the keyboard to open the color picker for selecting RGB values.<\/p>\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>_color 0.7 0.7 0.9<\/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    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Sunlight<\/h2>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">These settings control the map\u2019s sunlight and its diffuse component, simulating natural outdoor lighting from the sun, including direction, intensity, and color.<\/p>\n\n    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">sunlight<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Sets the intensity of direct sunlight, affecting surfaces facing the sun\u2019s direction. It determines how bright and prominent sunlight appears on the map.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Values range from <code>0<\/code> (no sunlight) to <code>1<\/code> (full brightness) or <code>2<\/code> (overbright for intense highlights).<\/li>\n        <li style=\"margin-bottom: 8px;\">Must be used with <code>suncolor<\/code> to define the light\u2019s hue.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: High values create stark contrasts between lit and shadowed areas. Test with <code>suncolor<\/code> and <code>sundirection<\/code> to ensure realistic lighting.<\/p>\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>sunlight 1.5<\/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    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">suncolor<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Defines the RGB color of direct sunlight, controlling its hue on surfaces it directly illuminates. Values are on a <code>0-1<\/code> scale for red, green, and blue.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Used with <code>sunlight<\/code> to set the sun\u2019s color (e.g., golden yellow for sunset, white for midday).<\/li>\n        <li style=\"margin-bottom: 8px;\">Example: <code>0.9 0.7 0.3<\/code> for a warm sunset, <code>1 1 1<\/code> for neutral midday light.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Choose colors that match the map\u2019s time of day or environment. Test with <code>sunlight<\/code> to balance intensity and hue. In Call of Duty 2, press <strong>K<\/strong> on the keyboard to open the color picker for selecting RGB values.<\/p>\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>suncolor 0.9 0.8 0.6<\/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    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">sundirection<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Specifies the direction of the sun\u2019s light rays using a pitch-yaw-roll format (in degrees). Pitch controls the sun\u2019s height, yaw its horizontal angle, and roll is typically set to <code>0<\/code>.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Determines where shadows fall and which surfaces receive direct sunlight.<\/li>\n        <li style=\"margin-bottom: 8px;\">Example: <code>-45 135 0<\/code> places the sun 45 degrees above the horizon, casting light from the southeast.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Pitch is typically <code>0<\/code> (horizon) to <code>-90<\/code> (overhead). Yaw aligns with the map\u2019s coordinates (consider <code>northyaw<\/code> for consistency). Test to ensure shadows enhance map aesthetics.<\/p>\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>sundirection -30 90 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    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">sundiffusecolor<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Defines the RGB color of diffuse sunlight, simulating scattered light in shadowed or indirectly lit areas. Values are on a <code>0-1<\/code> scale for red, green, and blue.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Used with <code>diffusefraction<\/code> to add subtle lighting to non-sunlit areas, mimicking sky-reflected light.<\/li>\n        <li style=\"margin-bottom: 8px;\">Example: <code>0.4 0.5 0.8<\/code> for a cool, sky-like diffuse effect.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Should complement <code>suncolor<\/code> for a cohesive look (e.g., slightly cooler than direct sunlight). Test with <code>diffusefraction<\/code> to balance its impact. In Call of Duty 2, press <strong>K<\/strong> on the keyboard to open the color picker for selecting RGB values.<\/p>\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>sundiffusecolor 0.5 0.6 0.8<\/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    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">diffusefraction<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Sets the proportion of sunlight intensity that comes from diffuse lighting, on a <code>0-1<\/code> scale. Diffuse light affects surfaces not directly facing the sun, simulating scattered light.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">A value of <code>0<\/code> means no diffuse lighting (sharp shadows), while <code>1<\/code> means diffuse light is as strong as direct sunlight (softer shadows).<\/li>\n        <li style=\"margin-bottom: 8px;\">Example: <code>0.5<\/code> balances direct and diffuse light for natural outdoor lighting.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Higher values reduce shadow contrast, brightening the map. Use with <code>sundiffusecolor<\/code> to control the hue of diffuse light.<\/p>\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>diffusefraction 0.4<\/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    <h2 style=\"color: #1a3c5e; border-bottom: 2px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">Advanced Lighting<\/h2>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">These settings fine-tune lighting effects, particularly for radiosity and bump mapping, to enhance the map\u2019s visual quality.<\/p>\n\n    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">bouncefraction<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Controls the amount of light that bounces off surfaces during radiosity calculations, simulating indirect lighting (e.g., light reflecting off a wall onto another surface).<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">Higher values increase brightness in indirectly lit areas, creating softer, more realistic lighting.<\/li>\n        <li style=\"margin-bottom: 8px;\">Lower values result in darker, more defined shadows.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Radiosity is computationally expensive in Call of Duty 2\u2019s engine. Higher values may reduce contrast but improve realism. Test for performance impacts.<\/p>\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>bouncefraction 0.3<\/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    <h3 style=\"color: #1a3c5e; border-bottom: 1px solid #e0e6ed; margin-bottom: 15px; padding-bottom: 8px;\">contrastGain<\/h3>\n    <p style=\"color: #4a4a4a; line-height: 1.6;\">Adjusts the contrast of bump map lighting (normal maps) on a <code>0-1<\/code> scale. Bump maps simulate surface texture lighting without additional geometry.<\/p>\n    <ul style=\"color: #4a4a4a; padding-left: 20px;\">\n        <li style=\"margin-bottom: 8px;\">A value of <code>0<\/code> applies no additional contrast, keeping bump maps subtle, while <code>1<\/code> maximizes contrast, making textures more pronounced.<\/li>\n        <li style=\"margin-bottom: 8px;\">Example: <code>0.5<\/code> balances texture visibility and lighting smoothness.<\/li>\n    <\/ul>\n    <p style=\"background: #e7f3fe; border: 1px solid #b6d4fe; padding: 15px; color: #0c5460; border-radius: 5px; margin-bottom: 20px;\">Note: Requires bump-mapped textures to have an effect. High values may cause visual artifacts (e.g., sharp highlights). Test to avoid unnatural lighting or aliasing.<\/p>\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>contrastGain 0.5<\/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   \n\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); }); } World Lighting To configure sunlight and ambient light, we use [&#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-1540","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1540","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=1540"}],"version-history":[{"count":2,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1540\/revisions"}],"predecessor-version":[{"id":1542,"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/pages\/1540\/revisions\/1542"}],"wp:attachment":[{"href":"https:\/\/grimms3dworlds.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=1540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}