mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-22 09:38:52 +08:00
more indirect light for clouds
and other minor tweaks
This commit is contained in:
parent
a082f263bd
commit
52466e8e35
@ -863,6 +863,8 @@ void main() {
|
||||
vec3 DirectLightColor = (lightCol.rgb/80.0);
|
||||
DirectLightColor *= clamp(abs(WsunVec.y)*2,0.,1.);
|
||||
|
||||
vec3 AmbientLightColor = avgAmbient;
|
||||
|
||||
float cloudShadow = 1.0;
|
||||
|
||||
if ( z >= 1.) { //sky
|
||||
@ -1019,8 +1021,22 @@ void main() {
|
||||
// float thething = pow(clamp(2.0 + dot(viewToWorld(FlatNormals),np3),0.0,2.0),3.0);
|
||||
// // LavaGlow *= thething*0.25+0.75;
|
||||
// LavaGlow *= mix((2.0-thething)*0.5+0.5, thething*0.25+0.75, sqrt(lightmap.x));
|
||||
|
||||
// #ifdef altostratus
|
||||
// AmbientLightColor += (lightCol.rgb/5) * clamp(Alto_coverage * (1-Alto_density),0,1) * clamp(abs(ambientCoefs.y+1.0),0.0,1.0);
|
||||
// #endif
|
||||
|
||||
// float SkylightShadow = 1;
|
||||
// #ifdef VOLUMETRIC_CLOUDS
|
||||
// #ifdef CLOUDS_SHADOWS
|
||||
// SkylightShadow = GetAltoOcclusion(p3);
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
// AmbientLightColor *= SkylightShadow;
|
||||
|
||||
Indirect_lighting = DoAmbientLighting(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), newLightmap.xy, skylight);
|
||||
|
||||
Indirect_lighting = DoAmbientLighting(avgAmbient, vec3(TORCH_R,TORCH_G,TORCH_B), newLightmap.xy, skylight);
|
||||
|
||||
|
||||
|
||||
|
@ -45,15 +45,6 @@ void main() {
|
||||
#ifndef TAA
|
||||
TAA_Offset = vec2(0.0);
|
||||
#endif
|
||||
|
||||
// vec3 sc = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||
// ambientUp = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
// ambientDown = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
||||
// ambientLeft = texelFetch2D(colortex4,ivec2(2,37),0).rgb;
|
||||
// ambientRight = texelFetch2D(colortex4,ivec2(3,37),0).rgb;
|
||||
// ambientB = texelFetch2D(colortex4,ivec2(4,37),0).rgb;
|
||||
// ambientF = texelFetch2D(colortex4,ivec2(5,37),0).rgb;
|
||||
|
||||
avgAmbient = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
|
||||
|
||||
|
@ -72,42 +72,24 @@ void main() {
|
||||
sunColor = texelFetch2D(colortex4,ivec2(12,37),0).rgb;
|
||||
moonColor = texelFetch2D(colortex4,ivec2(13,37),0).rgb;
|
||||
avgAmbient = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
||||
// avgAmbient = texelFetch2D(colortex4,ivec2(11,37),0).rgb;
|
||||
|
||||
|
||||
// ambientUp = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
// ambientDown = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
||||
// ambientLeft = texelFetch2D(colortex4,ivec2(2,37),0).rgb;
|
||||
// ambientRight = texelFetch2D(colortex4,ivec2(3,37),0).rgb;
|
||||
// ambientB = texelFetch2D(colortex4,ivec2(4,37),0).rgb;
|
||||
// ambientF = texelFetch2D(colortex4,ivec2(5,37),0).rgb;
|
||||
|
||||
|
||||
lightCol.a = float(sunElevation > 1e-5)*2-1.;
|
||||
lightCol.rgb = sc;
|
||||
|
||||
// #ifdef VOLUMETRIC_CLOUDS
|
||||
// #ifndef VL_Clouds_Shadows
|
||||
// lightCol.rgb *= (1.0-rainStrength*0.9);
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
TAA_Offset = offsets[frameCounter%8];
|
||||
#ifndef TAA
|
||||
TAA_Offset = vec2(0.0);
|
||||
TAA_Offset = vec2(0.0);
|
||||
#endif
|
||||
|
||||
#ifndef VL_Clouds_Shadows
|
||||
lightCol.rgb *= (1.0-rainStrength*0.9);
|
||||
#endif
|
||||
// float Time = worldTime%24000;
|
||||
|
||||
// FogSchedule = clamp( (Time - 9000)/9000 ,0,1);
|
||||
// // float fogAmount0 = 1/3000.+FOG_TOD_MULTIPLIER*(1/100.*(clamp(modWT-11000.,0.,2000.0)/2000.+(1.0-clamp(modWT,0.,3000.0)/3000.))*(clamp(modWT-11000.,0.,2000.0)/2000.+(1.0-clamp(modWT,0.,3000.0)/3000.)) + 1/120.*clamp(modWT-13000.,0.,1000.0)/1000.*(1.0-clamp(modWT-23000.,0.,1000.0)/1000.));
|
||||
|
||||
// float fogAmount0 = TimeOfDayFog;
|
||||
|
||||
// // VFAmount = CLOUDY_FOG_AMOUNT*(fogAmount0*fogAmount0+FOG_RAIN_MULTIPLIER*1.0/20000.*rainStrength);
|
||||
// VFAmount = fogAmount0;
|
||||
// fogAmount = BASE_FOG_AMOUNT*(fogAmount0+max(FOG_RAIN_MULTIPLIER*1/10.*rainStrength , FOG_TOD_MULTIPLIER*1/50.*clamp(modWT-13000.,0.,1000.0)/1000.*(1.0-clamp(modWT-23000.,0.,1000.0)/1000.)));
|
||||
|
||||
|
||||
|
||||
|
||||
WsunVec = lightCol.a*normalize(mat3(gbufferModelViewInverse) *sunPosition);
|
||||
refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333);
|
||||
}
|
||||
|
@ -175,10 +175,10 @@ void main() {
|
||||
moonColorCloud = calculateAtmosphere(vec3(0.0), modSunVec, vec3(0.0,1.0,0.0), sunVec, -sunVec, planetSphere, skyAbsorb, 25,0.5);
|
||||
|
||||
moonColorCloud = moonColorBase/4000.0*0.55;
|
||||
#ifndef CLOUDS_SHADOWS
|
||||
sunColor *= (1.0-rainStrength*vec3(0.96,0.95,0.94));
|
||||
moonColor *= (1.0-rainStrength*vec3(0.96,0.95,0.94));
|
||||
#endif
|
||||
// #ifndef CLOUDS_SHADOWS
|
||||
// sunColor *= (1.0-rainStrength*vec3(0.96,0.95,0.94));
|
||||
// moonColor *= (1.0-rainStrength*vec3(0.96,0.95,0.94));
|
||||
// #endif
|
||||
lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
|
||||
|
||||
float lightDir = float( sunVis >= 1e-5)*2.0-1.0;
|
||||
|
@ -8,6 +8,8 @@ entity.1100 = slime giant ender_dragon ghast
|
||||
#weak sss (same as weak sss for blocks)
|
||||
entity.1200 = player frog sheep chicken snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin blaze creeper drowned elder_gaurdian endermite evoker guardian hoglin husk magma_cube phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager wither trader_llama
|
||||
|
||||
# entity.5000 = minecraft:lightning_bolt
|
||||
entity.5000 = lightning_bolt
|
||||
|
||||
|
||||
# entity.9001 = minecraft:boat
|
||||
# layer.translucent=slime
|
||||
# layer.translucent = slime
|
@ -97,14 +97,14 @@ void main() {
|
||||
|
||||
vec4 TEXTURE = texture2D(texture, lmtexcoord.xy)*color;
|
||||
|
||||
#ifdef WEATHER
|
||||
gl_FragData[1].a = TEXTURE.a; // for bloomy rain
|
||||
#endif
|
||||
gl_FragData[1].a = TEXTURE.a; // for bloomy rain and stuff
|
||||
|
||||
|
||||
#ifndef WEATHER
|
||||
gl_FragData[1].a = 0.0; // for bloomy rain
|
||||
gl_FragData[0] = TEXTURE;
|
||||
vec3 Albedo = toLinear(gl_FragData[0].rgb);
|
||||
|
||||
gl_FragData[1].a = 1.0 - TEXTURE.a; // for bloomy rain and stuff
|
||||
|
||||
vec3 Albedo = toLinear(TEXTURE.rgb);
|
||||
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
|
||||
@ -139,6 +139,7 @@ void main() {
|
||||
|
||||
vec3 Indirect_lighting = DoAmbientLighting(avgAmbient, vec3(TORCH_R,TORCH_G,TORCH_B), lmtexcoord.zw, 5.0);
|
||||
|
||||
gl_FragData[0].a = TEXTURE.a;
|
||||
gl_FragData[0].rgb = (Direct_lighting + Indirect_lighting) * Albedo;
|
||||
#endif
|
||||
}
|
@ -56,6 +56,7 @@ void main() {
|
||||
color = gl_Color;
|
||||
|
||||
avgAmbient = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||
|
||||
vec3 sc = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
|
||||
lightCol.a = float(sunElevation > 1e-5)*2-1.;
|
||||
lightCol.rgb = sc;
|
||||
|
@ -59,7 +59,6 @@ uniform sampler2D specular;
|
||||
vec2 dcdy = dFdy(vtexcoord.st*vtexcoordam.pq)*exp2(Texture_MipMap_Bias);
|
||||
#endif
|
||||
|
||||
flat varying int lightningBolt;
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D colortex1;//albedo(rgb),material(alpha) RGBA16
|
||||
uniform float frameTimeCounter;
|
||||
@ -77,6 +76,7 @@ in vec3 velocity;
|
||||
|
||||
flat varying float blockID;
|
||||
flat varying int EMISSIVE;
|
||||
flat varying int LIGHTNING;
|
||||
|
||||
#ifdef ENTITIES
|
||||
#define ENTITY_PHYSICSMOD_SNOW 829925
|
||||
@ -437,9 +437,9 @@ void main() {
|
||||
if(NameTags == 1) normal = vec3(1);
|
||||
#endif
|
||||
|
||||
#ifdef ENTITY_PHYSICSMOD_SNOW
|
||||
normal = FlatNormals;
|
||||
#endif
|
||||
// #ifdef ENTITY_PHYSICSMOD_SNOW
|
||||
// normal = FlatNormals;
|
||||
// #endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -459,14 +459,15 @@ void main() {
|
||||
if(NameTags == 1) SpecularTex = vec4(0.0);
|
||||
#endif
|
||||
|
||||
#ifdef ENTITY_PHYSICSMOD_SNOW
|
||||
SpecularTex.rg = vec2(0.0);
|
||||
#endif
|
||||
// #ifdef ENTITY_PHYSICSMOD_SNOW
|
||||
// SpecularTex.rg = vec2(0.0);
|
||||
// #endif
|
||||
|
||||
gl_FragData[2] = SpecularTex;
|
||||
#endif
|
||||
|
||||
if(EMISSIVE > 0) gl_FragData[2].a = 0.9;
|
||||
if(LIGHTNING > 0.0) gl_FragData[2].a = 0.9;
|
||||
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ uniform int entityId;
|
||||
flat varying int EMISSIVE;
|
||||
|
||||
flat varying float blockID;
|
||||
flat varying int lightningBolt;
|
||||
flat varying int LIGHTNING;
|
||||
|
||||
flat varying int NameTags;
|
||||
|
||||
@ -143,13 +143,20 @@ void main() {
|
||||
|
||||
gl_Position = ftransform();
|
||||
|
||||
NameTags = 0;
|
||||
EMISSIVE = 0;
|
||||
|
||||
#ifdef ENTITIES
|
||||
LIGHTNING = 0;
|
||||
if(entityId == 12345){
|
||||
LIGHTNING = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
blockID = mc_Entity.x;
|
||||
velocity = at_velocity;
|
||||
|
||||
// emission and shit...
|
||||
EMISSIVE = 0;
|
||||
// #ifndef LabPBR_Emissives
|
||||
// if(mc_Entity.x == 10005) EMISSIVE = 1;
|
||||
// #endif
|
||||
@ -199,10 +206,11 @@ void main() {
|
||||
|
||||
|
||||
|
||||
NameTags = 0;
|
||||
// try and single out nametag text and then discard nametag background
|
||||
if( dot(gl_Color.rgb, vec3(0.35)) < 1.0) NameTags = 1;
|
||||
|
||||
if(gl_Color.a >= 0.24 && gl_Color.a <= 0.25 ) gl_Position = vec4(10,10,10,1);
|
||||
// if(gl_Color.a >= 0.24 && gl_Color.a <= 0.25 ) gl_Position = vec4(10,10,10,1);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -145,7 +145,7 @@
|
||||
|
||||
// --- WEATHER/SKY ---
|
||||
|
||||
#define Puddles // yes
|
||||
|
||||
#define sky_mieg 0.80 //[0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 ]
|
||||
#define sky_coefficientRayleighR 5.8 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 ]
|
||||
#define sky_coefficientRayleighG 1.35 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 ]
|
||||
@ -218,7 +218,7 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8
|
||||
|
||||
//#define SHADOW_FRUSTRUM_CULLING // BROKEN IN 1.17+. If enabled, removes most of the blocks during shadow rendering that would not cast shadows on the player field of view. Improves performance but can be sometimes incorrect and causes flickering shadows on distant occluders
|
||||
const int shadowMapResolution = 2048; //Will probably crash at 16 384 [512 768 1024 1536 2048 3172 4096 8192 16384]
|
||||
const float shadowDistance = 69.; //[32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 ] Not linear at all when shadowDistanceRenderMul is set to -1.0, 175.0 is enough for 40 render distance
|
||||
const float shadowDistance = 69.; // [32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256.] Not linear at all when shadowDistanceRenderMul is set to -1.0, 175.0 is enough for 40 render distance
|
||||
const float shadowDistanceRenderMul = -1.0; //[-1.0 1.0] Can help to increase shadow draw distance when set to -1.0, at the cost of performance
|
||||
#define Variable_Penumbra_Shadows //Makes the shadows more blurry the more distant they are to objects (costs fps)
|
||||
#define VPS_Search_Samples 4 //The number of samples used to find occluders [4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32]
|
||||
@ -258,18 +258,19 @@ const float shadowDistanceRenderMul = -1.0; //[-1.0 1.0] Can help to increase sh
|
||||
#define SUN_MICROFACET_SPECULAR // If enabled will use realistic rough microfacet model, else will just reflect the sun. No performance impact.
|
||||
#define USE_QUARTER_RES_DEPTH // Uses a quarter resolution depth buffer to raymarch screen space reflections, improves performance but may introduce artifacts
|
||||
|
||||
#ifdef Specular_Reflections
|
||||
#define Puddles // yes
|
||||
#endif
|
||||
|
||||
// --- CLOUDS ---
|
||||
|
||||
#define VOLUMETRIC_CLOUDS // if you don't like the noise on the default cloud settings, turn up the cloud samples. if that hurts performance too much, turn down the clouds quality.
|
||||
|
||||
#define CLOUDS_SHADOWS // Casts shadows from clouds on the world
|
||||
#ifndef VOLUMETRIC_CLOUDS
|
||||
#undef CLOUDS_SHADOWS
|
||||
#endif
|
||||
|
||||
#define VL_CLOUDS_SHADOWS // Casts shadows from clouds on VL
|
||||
#ifndef CLOUDS_SHADOWS
|
||||
#undef VL_CLOUDS_SHADOWS
|
||||
#ifdef VOLUMETRIC_CLOUDS
|
||||
#define CLOUDS_SHADOWS // Casts shadows from clouds on the world
|
||||
#ifdef CLOUDS_SHADOWS
|
||||
#define VL_CLOUDS_SHADOWS // Casts shadows from clouds on VL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Cumulus // a layer of puffy clouds up yonder.
|
||||
|
@ -27,7 +27,7 @@ float MaxCumulusHeight = CumulusHeight + 100;
|
||||
float AltostratusHeight = 2000;
|
||||
|
||||
float rainCloudwetness = rainStrength;
|
||||
float cloud_movement = frameTimeCounter;
|
||||
float cloud_movement = frameTimeCounter * 0;
|
||||
|
||||
//3D noise from 2d texture
|
||||
float densityAtPos(in vec3 pos){
|
||||
@ -133,17 +133,24 @@ vec3 Cloud_lighting(
|
||||
vec3 sunContributionMulti,
|
||||
vec3 moonContribution,
|
||||
float AmbientShadow,
|
||||
int cloudType
|
||||
int cloudType,
|
||||
vec3 pos
|
||||
){
|
||||
float coeeff = -30;
|
||||
// float powder = 1.0 - exp((CloudShape*CloudShape) * -800);
|
||||
float powder = 1.0 - exp(CloudShape * coeeff/3);
|
||||
float lesspowder = powder*0.4+0.6;
|
||||
|
||||
vec3 skyLighting = SkyColors * exp(SkyShadowing * AmbientShadow * coeeff/2 ) * lesspowder ;
|
||||
|
||||
vec3 skyLighting = SkyColors;
|
||||
#ifdef Altostratus
|
||||
skyLighting += sunContributionMulti * 5.0 * exp(SunShadowing * -3) * clamp(Alto_coverage * (1-Alto_density),0,1);
|
||||
#endif
|
||||
skyLighting *= exp(SkyShadowing * AmbientShadow * coeeff/2 ) * lesspowder ;
|
||||
|
||||
|
||||
if(cloudType == 1){
|
||||
coeeff = -10;
|
||||
coeeff = -3;
|
||||
skyLighting = SkyColors * exp(SkyShadowing * coeeff/15) * lesspowder;
|
||||
}
|
||||
|
||||
@ -152,7 +159,8 @@ vec3 Cloud_lighting(
|
||||
|
||||
vec3 moonLighting = exp(MoonShadowing * coeeff / 3) * moonContribution * powder;
|
||||
|
||||
return skyLighting + moonLighting + sunLighting ;
|
||||
return skyLighting + moonLighting + sunLighting ;
|
||||
// return sunLighting;
|
||||
}
|
||||
|
||||
//Mie phase function
|
||||
@ -215,6 +223,7 @@ vec4 renderClouds(
|
||||
////// lighitng stuff
|
||||
float shadowStep = 200.;
|
||||
vec3 dV_Sun = normalize(mat3(gbufferModelViewInverse)*sunVec)*shadowStep;
|
||||
vec3 dV_Sun_small = dV_Sun/shadowStep;
|
||||
|
||||
float SdotV = dot(sunVec,normalize(FragPosition));
|
||||
|
||||
@ -248,13 +257,14 @@ vec4 renderClouds(
|
||||
|
||||
float Sunlight = 0.0;
|
||||
float MoonLight = 0.0;
|
||||
|
||||
for (int j=0; j < self_shadow_samples; j++){
|
||||
|
||||
vec3 shadowSamplePos = progress_view + dV_Sun * (1+j+Dither.y/2)*0.15;
|
||||
for (int j=0; j < 3; j++){
|
||||
|
||||
vec3 shadowSamplePos = progress_view + (dV_Sun * 0.15) * (1 + Dither.y/2 + j);
|
||||
|
||||
float shadow = GetCumulusDensity(shadowSamplePos, 0) * Cumulus_density;
|
||||
|
||||
Sunlight += shadow;
|
||||
Sunlight += shadow / (1 + j);
|
||||
MoonLight += shadow;
|
||||
|
||||
}
|
||||
@ -267,7 +277,7 @@ vec4 renderClouds(
|
||||
#endif
|
||||
|
||||
float ambientlightshadow = 1.0-clamp(exp((progress_view.y - (MaxCumulusHeight + CumulusHeight)*0.5) / 100.0),0.0,1.0);
|
||||
vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0);
|
||||
vec3 S = Cloud_lighting(muE, cumulus*Cumulus_density, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, ambientlightshadow, 0, progress_view);
|
||||
|
||||
vec3 Sint = (S - S * exp(-mult*muE)) / muE;
|
||||
color += max(muE*Sint*total_extinction,0.0);
|
||||
@ -295,7 +305,7 @@ vec4 renderClouds(
|
||||
float shadow = GetAltostratusDensity(shadowSamplePos_high) * Alto_density;
|
||||
Sunlight += shadow;
|
||||
}
|
||||
vec3 S = Cloud_lighting(altostratus, altostratus, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, 1, 1);
|
||||
vec3 S = Cloud_lighting(altostratus, altostratus, Sunlight, MoonLight, SkyColor, sunContribution, sunContributionMulti, moonContribution, 1, 1, progress_view_high);
|
||||
|
||||
vec3 Sint = (S - S * exp(-20*altostratus)) / altostratus;
|
||||
color += max(altostratus*Sint*total_extinction,0.0);
|
||||
@ -360,4 +370,16 @@ float GetCloudShadow_VLFOG(vec3 WorldPos){
|
||||
shadow *= clamp(((MaxCumulusHeight + CumulusHeight)*0.435 - WorldPos.y)/100,0.0,1.0) ;
|
||||
|
||||
return shadow;
|
||||
}
|
||||
float GetAltoOcclusion(vec3 eyePlayerPos){
|
||||
|
||||
vec3 playerPos = eyePlayerPos + cameraPosition;
|
||||
playerPos.y += 0.05;
|
||||
float shadow;
|
||||
vec3 lowShadowStart = playerPos + normalize(vec3(0,1,0)) * max((MaxCumulusHeight + CumulusHeight)*0.433 - playerPos.y,0.0) ;
|
||||
shadow = GetCumulusDensity(lowShadowStart,0) * cloudDensity;
|
||||
|
||||
shadow = clamp(exp(shadow * -1),0.0,1.0);
|
||||
return shadow;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user