Skip to content

Commit 4ae8a51

Browse files
authored
sun size function and removed moon on ad_astra
1 parent 0cd59b7 commit 4ae8a51

File tree

3 files changed

+133
-122
lines changed

3 files changed

+133
-122
lines changed

shaders/ad_astra_config/ad_astra_world_config.glsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@
4646

4747
#ifdef WORLD_MERCURY
4848
#define HAS_NO_MOON
49+
#define SUN_SIZE 2000 //normal is 400
4950
// #define NEBULA_AT_DAY
5051
#define DAYLIGHT_STARS
5152

5253
#endif
5354

5455
#ifdef WORLD_MARS
5556
#define HAS_NO_MOON
57+
#define SUN_SIZE 100 //normal is 400
5658
#undef ATM_FOG_MULT
5759
#define ATM_FOG_MULT 0.0
5860
#undef LIGHTSHAFTS_ACTIVE

shaders/lib/uniforms.glsl

Lines changed: 92 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -234,90 +234,95 @@ uniform float thunderFactor = 0.0;
234234

235235
uniform vec2 viewSize;
236236
uniform vec2 texelSize;
237-
238-
239-
240-
// ___ _ _ _ ___ _ _
241-
// / __|_ _ _ __ _ __| |___ _ __ ___ _ _| |_ __ _| | | _ \__ _| |_ __| |_ ___ ___
242-
// \__ \ || | '_ \ '_ \ / -_) ' \/ -_) ' \ _/ _` | | | _/ _` | _/ _| ' \/ -_|_-<
243-
// |___/\_,_| .__/ .__/_\___|_|_|_\___|_||_\__\__,_|_| |_| \__,_|\__\__|_||_\___/__/
244-
// |_| |_|
245-
// Uniforms added by Supplemental Patches
246-
247-
#if defined MOD_NETHEREXP
248-
uniform float betrayedSmooth;
249-
#endif
250-
uniform sampler2D spiral_clouds;
251-
#if defined MOD_OREGANIZED
252-
uniform float brainDamage;
253-
#endif
254-
#if defined MOD_DOOM_AND_GLOOM
255-
uniform float doomAndGloomFog;
256-
#endif
257-
#if defined MOD_ENDERSCAPE && (MC_VERSION >= 12109)
258-
uniform vec3 enderscapeFlashColor;
259-
#endif
260-
#if defined MOD_ENDERSCAPE
261-
uniform float enderscapeNebulaAlpha;
262-
#endif
263-
#if defined MOD_ENDERSCAPE
264-
uniform vec3 enderscapeNebulaColor;
265-
#endif
266-
#if defined MOD_ENDERSCAPE
267-
uniform float enderscapeStarAlpha;
268-
#endif
269-
#if defined MOD_ENDERSCAPE
270-
uniform vec3 enderscapeStarColor;
271-
#endif
272-
#if defined MOD_SCORCHFUL
273-
uniform float hasRedSandstorm;
274-
#endif
275-
#if defined MOD_SCORCHFUL
276-
uniform float hasRegularSandstorm;
277-
#endif
278-
#if defined MOD_SCORCHFUL
279-
uniform float hasSandstorm;
280-
#endif
281-
uniform float inEnchantedTangle = 0.0;
282-
uniform float inForgottenForest = 0.0;
283-
#if defined MOD_YUNGSCAVEBIOMES
284-
uniform float inFrostedCaves;
285-
#endif
286-
#if defined MOD_YUNGSCAVEBIOMES
287-
uniform float inLostCaves;
288-
#endif
289-
uniform float inMagicBiome;
290-
uniform float inMysticGrove = 0.0;
291-
uniform float inPaleBog = 0.0;
292-
uniform float inSkyriseVale = 0.0;
293-
#if defined MOD_BIOMESOPLENTY
294-
uniform float inVisceralHeap;
295-
#endif
296-
uniform float inWeepingWitchForest = 0.0;
297-
uniform vec3 moonColorSmooth = vec3(1.0);
298-
uniform float moonSizeSmooth = 20.0;
299-
#if defined MOD_ENDERSCAPE
300-
uniform float smoothEnderscapeNebulaAlpha;
301-
#endif
302-
#if defined MOD_ENDERSCAPE
303-
uniform float smoothEnderscapeNebulaBlue;
304-
#endif
305-
#if defined MOD_ENDERSCAPE
306-
uniform float smoothEnderscapeNebulaGreen;
307-
#endif
308-
#if defined MOD_ENDERSCAPE
309-
uniform float smoothEnderscapeNebulaRed;
310-
#endif
311-
#if defined MOD_YUNGSCAVEBIOMES
312-
uniform float yungSandstorm;
313-
#endif
314-
#if defined MOD_YUNGSCAVEBIOMES
315-
uniform float yungSandstormFactor;
316-
#endif
317-
#if defined MOD_YUNGSCAVEBIOMES
318-
uniform vec3 yungSandstormWindDirection;
319-
#endif
320-
uniform sampler2D colortex15;
321-
uniform sampler2D colortex14;
322-
323-
237+
238+
239+
240+
// ___ _ _ _ ___ _ _
241+
// / __|_ _ _ __ _ __| |___ _ __ ___ _ _| |_ __ _| | | _ \__ _| |_ __| |_ ___ ___
242+
// \__ \ || | '_ \ '_ \ / -_) ' \/ -_) ' \ _/ _` | | | _/ _` | _/ _| ' \/ -_|_-<
243+
// |___/\_,_| .__/ .__/_\___|_|_|_\___|_||_\__\__,_|_| |_| \__,_|\__\__|_||_\___/__/
244+
// |_| |_|
245+
// Uniforms added by Supplemental Patches
246+
247+
#if defined MOD_NETHEREXP
248+
uniform float betrayedSmooth;
249+
#endif
250+
uniform sampler2D spiral_clouds;
251+
#if defined MOD_OREGANIZED
252+
uniform float brainDamage;
253+
#endif
254+
#if defined MOD_DOOM_AND_GLOOM
255+
uniform float doomAndGloomFog;
256+
#endif
257+
#if defined MOD_ENDERSCAPE && (MC_VERSION >= 12109)
258+
uniform vec3 enderscapeFlashColor;
259+
#endif
260+
#if defined MOD_ENDERSCAPE
261+
uniform float enderscapeNebulaAlpha;
262+
#endif
263+
#if defined MOD_ENDERSCAPE
264+
uniform vec3 enderscapeNebulaColor;
265+
#endif
266+
#if defined MOD_ENDERSCAPE
267+
uniform float enderscapeStarAlpha;
268+
#endif
269+
#if defined MOD_ENDERSCAPE
270+
uniform vec3 enderscapeStarColor;
271+
#endif
272+
#if defined MOD_SCORCHFUL
273+
uniform float hasRedSandstorm;
274+
#endif
275+
#if defined MOD_SCORCHFUL
276+
uniform float hasRegularSandstorm;
277+
#endif
278+
#if defined MOD_SCORCHFUL
279+
uniform float hasSandstorm;
280+
#endif
281+
uniform float inEnchantedTangle = 0.0;
282+
uniform float inForgottenForest = 0.0;
283+
#if defined MOD_YUNGSCAVEBIOMES
284+
uniform float inFrostedCaves;
285+
#endif
286+
#if defined MOD_YUNGSCAVEBIOMES
287+
uniform float inLostCaves;
288+
#endif
289+
uniform float inMagicBiome;
290+
uniform float inMysticGrove = 0.0;
291+
uniform float inPaleBog = 0.0;
292+
uniform float inSkyriseVale = 0.0;
293+
#if defined MOD_BIOMESOPLENTY
294+
uniform float inVisceralHeap;
295+
#endif
296+
uniform float inWeepingWitchForest = 0.0;
297+
298+
#ifdef AD_ASTRA //would be better if defined with HAS_NO_MOON, but its not yet defined
299+
uniform vec3 moonColorSmooth = vec3(0.0);
300+
#else
301+
uniform vec3 moonColorSmooth = vec3(1.0);
302+
#endif
303+
uniform float moonSizeSmooth = 20.0;
304+
#if defined MOD_ENDERSCAPE
305+
uniform float smoothEnderscapeNebulaAlpha;
306+
#endif
307+
#if defined MOD_ENDERSCAPE
308+
uniform float smoothEnderscapeNebulaBlue;
309+
#endif
310+
#if defined MOD_ENDERSCAPE
311+
uniform float smoothEnderscapeNebulaGreen;
312+
#endif
313+
#if defined MOD_ENDERSCAPE
314+
uniform float smoothEnderscapeNebulaRed;
315+
#endif
316+
#if defined MOD_YUNGSCAVEBIOMES
317+
uniform float yungSandstorm;
318+
#endif
319+
#if defined MOD_YUNGSCAVEBIOMES
320+
uniform float yungSandstormFactor;
321+
#endif
322+
#if defined MOD_YUNGSCAVEBIOMES
323+
uniform vec3 yungSandstormWindDirection;
324+
#endif
325+
uniform sampler2D colortex15;
326+
uniform sampler2D colortex14;
327+
328+

shaders/program/gbuffers_skybasic.glsl

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "/lib/shaderSettings/enhancedCelestials.glsl"
2-
#include "/lib/shaderSettings/doomAndGloomFog.glsl"
1+
#include "/lib/shaderSettings/enhancedCelestials.glsl"
2+
#include "/lib/shaderSettings/doomAndGloomFog.glsl"
33
//////////////////////////////////////////
44
// Complementary Shaders by EminGT //
55
// With Euphoria Patches by SpacEagle17 //
@@ -103,14 +103,14 @@ void main() {
103103
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
104104
viewPos /= viewPos.w;
105105
vec3 nViewPos = normalize(viewPos.xyz);
106-
float SkyColorPlayerPosMult = clamp((cameraPosition.y - 100) / 300, 0.0, 1.0);
107-
vec3 SkyColorPlayerPos = mix(vec3(1.0, 1.0, 1.0), vec3(0.07, 0.0, 0.2), SkyColorPlayerPosMult);
108-
109-
float VdotU = dot(nViewPos, upVec);
110-
float VdotS = dot(nViewPos, sunVec);
111-
float dither = Bayer8(gl_FragCoord.xy);
112-
113-
color.rgb = GetSky(VdotU, VdotS, dither, true, false);
106+
float SkyColorPlayerPosMult = clamp((cameraPosition.y - 100) / 300, 0.0, 1.0);
107+
vec3 SkyColorPlayerPos = mix(vec3(1.0, 1.0, 1.0), vec3(0.07, 0.0, 0.2), SkyColorPlayerPosMult);
108+
109+
float VdotU = dot(nViewPos, upVec);
110+
float VdotS = dot(nViewPos, sunVec);
111+
float dither = Bayer8(gl_FragCoord.xy);
112+
113+
color.rgb = GetSky(VdotU, VdotS, dither, true, false);
114114
color.rgb *= SkyColorPlayerPos;
115115
#ifdef SECRET_CAELUM_SUPPORT_SETTING
116116
if (alphaColor < 1.0 && alphaColor > 0.0) color.rgb = glColor.rgb * alphaColor;
@@ -148,7 +148,11 @@ void main() {
148148
float absVdotS = abs(VdotS);
149149
#if SUN_MOON_STYLE == 2
150150
float sunSizeFactor1 = 0.9975;
151-
float sunSizeFactor2 = 400.0;
151+
#ifdef SUN_SIZE
152+
float sunSizeFactor2 = SUN_SIZE;
153+
#else
154+
float sunSizeFactor2 = 400.0;
155+
#endif
152156
float moonCrescentOffset = 0.0055;
153157
float moonPhaseFactor1 = 2.45;
154158
float moonPhaseFactor2 = 750.0;
@@ -159,12 +163,12 @@ void main() {
159163
float moonPhaseFactor1 = 2.2;
160164
float moonPhaseFactor2 = 1000.0;
161165
#endif
162-
#ifdef MOD_ENHANCEDCELESTIALS
163-
sunSizeFactor1 = cos(sqrt(moonSizeSmooth / 20) * acos(sunSizeFactor1));
164-
sunSizeFactor2 /= sqrt(moonSizeSmooth / 20);
165-
moonPhaseFactor1 *= pow(moonSizeSmooth / 20, 0.2);
166-
moonPhaseFactor2 /= (moonSizeSmooth / 20);
167-
#endif
166+
#ifdef MOD_ENHANCEDCELESTIALS
167+
sunSizeFactor1 = cos(sqrt(moonSizeSmooth / 20) * acos(sunSizeFactor1));
168+
sunSizeFactor2 /= sqrt(moonSizeSmooth / 20);
169+
moonPhaseFactor1 *= pow(moonSizeSmooth / 20, 0.2);
170+
moonPhaseFactor2 /= (moonSizeSmooth / 20);
171+
#endif
168172
if (absVdotS > sunSizeFactor1) {
169173
float sunMoonMixer = sqrt1(sunSizeFactor2 * (absVdotS - sunSizeFactor1));
170174

@@ -183,13 +187,13 @@ void main() {
183187
float sunBrightness = 25.0;
184188
if (tonemap == ACESTonemap) color.rgb = mix(color.rgb, vec3(1.0, 0.698, 0.5451) * sunBrightness, sunMoonMixer);
185189
else
186-
#if DOOM_AND_GLOOM_FOG == 1
187-
sunMoonMixer = pow(sunMoonMixer * 0.3, 0.2);
188-
sunBrightness *= FOG_UNBOUND_SUN_BRIGHTNESS;
189-
#elif defined MOD_DOOM_AND_GLOOM && (DOOM_AND_GLOOM_FOG == 0)
190-
sunMoonMixer = pow(sunMoonMixer * (1.0 - 0.7 * doomAndGloomFog), 0.2);
191-
sunBrightness *= mix(1.0, FOG_UNBOUND_SUN_BRIGHTNESS, doomAndGloomFog);
192-
#endif
190+
#if DOOM_AND_GLOOM_FOG == 1
191+
sunMoonMixer = pow(sunMoonMixer * 0.3, 0.2);
192+
sunBrightness *= FOG_UNBOUND_SUN_BRIGHTNESS;
193+
#elif defined MOD_DOOM_AND_GLOOM && (DOOM_AND_GLOOM_FOG == 0)
194+
sunMoonMixer = pow(sunMoonMixer * (1.0 - 0.7 * doomAndGloomFog), 0.2);
195+
sunBrightness *= mix(1.0, FOG_UNBOUND_SUN_BRIGHTNESS, doomAndGloomFog);
196+
#endif
193197
color.rgb = mix(color.rgb, vec3(0.9, 0.5, 0.3) * sunBrightness, sunMoonMixer);
194198
} else {
195199
float horizonFactor = GetHorizonFactor(-SdotU);
@@ -204,7 +208,7 @@ void main() {
204208
#if BLOOD_MOON > 0
205209
moonColor = mix(moonColor, vec3(0.4588, 0.149, 0.149) * 1.5, getBloodMoon(sunVisibility));
206210
#endif
207-
moonColor *= (1.2 - (0.2 + 0.2 * sqrt1(nightFactor)) * moonNoise);
211+
moonColor *= (1.2 - (0.2 + 0.2 * sqrt1(nightFactor)) * moonNoise);
208212
moonColor *= saturateColors(moonColorSmooth, LUNAR_EVENT_MOON_SATURATION);
209213

210214
if (moonPhase >= 1) {
@@ -231,16 +235,16 @@ void main() {
231235
sunMoonMixer *= 1.0 - 0.5 * GetCaveFactor();
232236
#endif
233237

234-
#if DOOM_AND_GLOOM_FOG == 1
235-
moonColor *= mix(vec3(1.0), vec3(0.15, 0.2, 0.35), 0.3);
236-
#elif defined MOD_DOOM_AND_GLOOM && (DOOM_AND_GLOOM_FOG == 0)
237-
moonColor *= mix(vec3(1.0), vec3(0.15, 0.2, 0.35), 0.3 * doomAndGloomFog);
238-
#endif
239-
color.rgb = mix(color.rgb, moonColor, sunMoonMixer);
240-
#if DOOM_AND_GLOOM_FOG == 1
241-
color.rgb = mix(color.rgb, vec3(0.5), pow2(acos(absVdotS) / acos(sunSizeFactor1)));
242-
#elif defined MOD_DOOM_AND_GLOOM && (DOOM_AND_GLOOM_FOG == 0)
243-
color.rgb = mix(color.rgb, vec3(0.5), doomAndGloomFog * pow2(acos(absVdotS) / acos(sunSizeFactor1)));
238+
#if DOOM_AND_GLOOM_FOG == 1
239+
moonColor *= mix(vec3(1.0), vec3(0.15, 0.2, 0.35), 0.3);
240+
#elif defined MOD_DOOM_AND_GLOOM && (DOOM_AND_GLOOM_FOG == 0)
241+
moonColor *= mix(vec3(1.0), vec3(0.15, 0.2, 0.35), 0.3 * doomAndGloomFog);
242+
#endif
243+
color.rgb = mix(color.rgb, moonColor, sunMoonMixer);
244+
#if DOOM_AND_GLOOM_FOG == 1
245+
color.rgb = mix(color.rgb, vec3(0.5), pow2(acos(absVdotS) / acos(sunSizeFactor1)));
246+
#elif defined MOD_DOOM_AND_GLOOM && (DOOM_AND_GLOOM_FOG == 0)
247+
color.rgb = mix(color.rgb, vec3(0.5), doomAndGloomFog * pow2(acos(absVdotS) / acos(sunSizeFactor1)));
244248
#endif
245249
}
246250
}

0 commit comments

Comments
 (0)