Skip to content

Commit 7c3ee40

Browse files
committed
fixed up lighting samples
1 parent 932c418 commit 7c3ee40

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

assets/shaders/sky.frag

+4-4
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ vec4 march(vec3 pos, vec3 dir, int depth) {
198198
float weather_scale = 0.0001;
199199
vec3 weather_sample = texture(weather, p.xz*weather_scale).xyz;
200200
float t = density(p, weather_sample);
201-
float ldt = 0.5;
201+
const float ldt = 0.2;
202202
float dt = exp(-ldt*t*ss);//, exp(-ldt*0.25*t*ss)*0.8);
203203
T *= dt;
204204
vec3 lp = p;
205205
float lT = 1.0;
206206
if (t>0.0) {
207207
//play around with these values
208-
float smpd[6] = float[6](2.0, 2.0, 2.0, 2.0, 8.0, 10.0);
208+
float smpd[6] = float[6](0.01, 0.01, 0.02, 0.1, 0.4, 5.0);
209209
for (int j=0;j<6;j++) {
210-
lp += ldir*smpd[j]+(RANDOM_VECTORS[j]*float(j)*lss);
210+
lp += (ldir*smpd[j]+(RANDOM_VECTORS[j]*float(j)))*lss;
211211
vec3 lweather = texture(weather, lp.xz*weather_scale).xyz;
212212
float lt = density(lp, lweather);
213213
const float ld = 1.0;
@@ -218,7 +218,7 @@ vec4 march(vec3 pos, vec3 dir, int depth) {
218218
float powshug = 1.0-exp(-ldt*t*ss*2.0);
219219
powshug = mix(1.0f, powshug, clamp((-dot(normalize(ldir), normalize(dir)) * 0.5f) + 0.5f, 0.0, 1.0));
220220
vec3 ambient = getSkyColor()*mix(0.5, 1.0, height_fraction);
221-
L += (ambient+getSunColor()*lT*phase*powshug*2.0)*(1.0-dt)*T*ss;
221+
L += (getSunColor()*lT*powshug*2.0*phase)*(1.0-dt)*T*ss;
222222
}
223223
L/=L+1.0;
224224
//L = sqrt(L);

0 commit comments

Comments
 (0)