Author Topic: Default Day Cycle But on a Different Scale?  (Read 1592 times)

Oh I see. You just need to calculate all the required variables. It won't be fun but should work as intended.

Yes, but how do I go about calculating them?

Code: [Select]
FRACTION 0.201462
DIRECTCOLOR 0.918310 0.920561 0.860337 1.000000
AMBIENTCOLOR 0.733295 0.901869 0.878237 1.000000
SKYCOLOR 0.602760 0.821364 0.962617 1.000000
FOGCOLOR 0.931623 0.953271 0.775089 1.000000
SHADOWCOLOR 0.474059 0.763197 0.780374 1.000000
SUNFLARECOLOR 0.917279 0.948598 0.469866 1.000000

is to

Code: [Select]
FRACTION 0.201462
DIRECTCOLOR 0.6 0.6 0.6 1.000000
AMBIENTCOLOR 0.5 0.5 0.5 1.000000
SKYCOLOR 0.602760 0.821364 0.962617 1.000000
FOGCOLOR 0.900000 0.900000 1.000000 1.000000
SHADOWCOLOR 0.3 0.3 0.4 1.000000
SUNFLARECOLOR 0.2 0.2 0.2 1.000000

as

Code: [Select]
FRACTION 0.337133
DIRECTCOLOR 0.677570 0.596580 0.300790 1.000000
AMBIENTCOLOR 0.606444 0.668224 0.577670 1.000000
SKYCOLOR 0.687047 0.739429 0.967290 1.000000
FOGCOLOR 0.879475 0.883178 0.784130 1.000000
SHADOWCOLOR 0.231461 0.440841 0.467290 1.000000
SUNFLARECOLOR 0.560748 0.554772 0.241069 1.000000

is to what?

I can't seem to find a way to figure this out. It would take a while but would ratios work?

It's a simple math problem that I'm too tired to explain in detail right now. Quick example:

0.5 is where you start and the value is 0.6.
0.8 where you want to go, unknown value.
1.0 is the end and the value is 0.95.

1.0 - 0.5 = 0.5

0.95 - 0.6 = 0.35

0.8 - 0.5 = 0.2

0.2 / 0.5 = 0.40

0.35 * 0.40 = 0.14

0.6 + 0.14 = 0.74

Value at location 0.8 is 0.74.
« Last Edit: August 17, 2012, 06:35:37 AM by Demian »

Yeah, I'm sorry I'm just not getting this. I have no idea where the start, end and values are coming from or what relation they have to each other.

It's a simple math problem that I'm too tired to explain in detail right now. Quick example:

0.5 is where you start and the value is 0.6.
0.8 where you want to go, unknown value.
1.0 is the end and the value is 0.95.

1.0 - 0.5 = 0.5

0.95 - 0.6 = 0.35

0.8 - 0.5 = 0.2

0.2 / 0.5 = 0.40

0.35 * 0.40 = 0.14

0.6 + 0.14 = 0.74

Value at location 0.5 is 0.74. What. I already know the var for 0.5 and it's 0.66.
???

???
Typo.

Okay then, I'll try to explain this in detail.

We have 2 values.
Variable 1: at location 0.3 and value of 0.25
Variable 2: at location 0.8 and value of 0.7

We want to figure out the value Y for Variable 3 at location 0.5.

Since the game is using linear interpolation (not sure if this is the correct term) we are using this as well. The only thing we know about this unknown value is that it is between the values of Var1 and Var2. (Because linear interpolation)

First we need to find out slope m, we do this by calculating the difference between x (time) and y (value).

m = (0.7 - 0.25) / (0.8 - 0.3)
m = 0.45 / 0.5
m = 0.9

The value goes up 0.9 for every 1.0 unit of time. (Notice! Not every 0.1!) Now we just need the difference between the starting point and the point of time at which we want the value.

0.5 - 0.3 = 0.2

0.2 * 0.9 = 0.18

Now we know that the value goes up by 0.18 units between Var1 and Var3.

0.3 + 0.18 = 0.48

TL;DR http://www.mathsisfun.com/straight-line-graph-calculate.html
You still need to find the unknown value yourself but it's a lot faster since you get the slope right away.


Professor Demian signing off, the class is over.
« Last Edit: August 17, 2012, 10:56:24 AM by Demian »

x, linear, slope m
Quote from: Link you gave
y=mx+b

Wow holy stuff I wish you would've told me this before. Haha, now I know exactly what you're talking about. Thanks!


And I thought I'd never use it.  :cookieMonster:

Default day cycle's increments are not linear. I'm going to assume whichever developer made it just chose different points and then changed the settings to whatever looked right for that time of day.

Though I can still use y=mx+b to figure out what the increments will be when FRACTION 0.201462 (x) = DIRECTLIGHT 0.6 (y). Just thought I should mention that the entire day cycle from start to end is not linear.
« Last Edit: August 18, 2012, 09:06:53 PM by Awdax »

Just thought I should mention that the entire day cycle from start to end is not linear.
Of course it isn't but since the fractions are so close to each other using linear interpolation between two fractions points works well enough. I should also mention that changing  the lighting values ate once fraction point is quite useless. The effects won't last very long.


Of course it isn't but since the fractions are so close to each other using linear interpolation between two fractions points works well enough. I should also mention that changing  the lighting values ate once fraction point is quite useless. The effects won't last very long.

Yeah there's too much to do and it's probably not worth it. I'm just going to use the Fractions 0, .25, .5 and .75. The increments are a little bit off from the default ones, but it shouldn't be too noticeable.

Actually the fractions in between - like the ones in between .25 and .5 are vital or else the transition is weird. For example if I only use four fractions (0, .25, .5 and .75) the sky will be unusually dark at fraction .4. So the ones in between are needed so the lighting makes sense.