mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
cloud rendering: gamma change
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
"daylightClut": "clut_daylight.tga",
|
||||
"classification": "generic",
|
||||
"cloudChance": 125,
|
||||
"cloudGamma": [0.45, 2.4],
|
||||
"cloudGammaVariance": [0.1, 0.0],
|
||||
"cloudGamma": [0.7, 2.4],
|
||||
"cloudGammaVariance": [0.143, 0.0],
|
||||
"windSpeed": 0.35,
|
||||
"windSpeedVariance": 0.4,
|
||||
"windSpeedDamping": 0.5,
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"daylightClut": "clut_daylight.tga",
|
||||
"classification": "generic2",
|
||||
"cloudChance": 800,
|
||||
"cloudGamma": [0.6, 2.4],
|
||||
"cloudGammaVariance": [0.1, 0.0],
|
||||
"cloudGamma": [0.8, 2.4],
|
||||
"cloudGammaVariance": [0.125, 0.0],
|
||||
"windSpeed": 0.35,
|
||||
"windSpeedVariance": 0.4,
|
||||
"windSpeedDamping": 0.5,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"daylightClut": "clut_daylight.tga",
|
||||
"classification": "overcast",
|
||||
"cloudChance": 300,
|
||||
"cloudGamma": [3.7, 1.6],
|
||||
"cloudGamma": [2.0, 1.6],
|
||||
"cloudGammaVariance": [0.0, 0.0],
|
||||
"windSpeed": 10.45,
|
||||
"windSpeedVariance": 0.5,
|
||||
|
||||
@@ -180,21 +180,18 @@ class WeatherObjectCloud(
|
||||
0.3f,
|
||||
0.4f,
|
||||
0.5f,
|
||||
|
||||
0.6f,
|
||||
0.7f,
|
||||
0.8f,
|
||||
0.9f,
|
||||
1.1f,
|
||||
1.3f,
|
||||
|
||||
1.7f,
|
||||
2.1f,
|
||||
1.0f,
|
||||
1.25f,
|
||||
1.5f,
|
||||
1.75f,
|
||||
2.0f,
|
||||
2.5f,
|
||||
2.9f,
|
||||
|
||||
3.7f,
|
||||
4.5f,
|
||||
5.3f,
|
||||
6.1f
|
||||
3.0f,
|
||||
3.5f
|
||||
)
|
||||
|
||||
val A_GAMMA_TABLE = floatArrayOf(
|
||||
|
||||
@@ -22,20 +22,20 @@ const float rgbGammas[16] = float[](
|
||||
0.4,
|
||||
0.5,
|
||||
|
||||
0.6,
|
||||
0.7,
|
||||
0.8,
|
||||
0.9,
|
||||
1.1,
|
||||
1.3,
|
||||
|
||||
1.7,
|
||||
2.1,
|
||||
1.0,
|
||||
1.25,
|
||||
1.5,
|
||||
1.75,
|
||||
|
||||
2.0,
|
||||
2.5,
|
||||
2.9,
|
||||
|
||||
3.7,
|
||||
4.5,
|
||||
5.3,
|
||||
6.1
|
||||
3.0,
|
||||
3.5
|
||||
);
|
||||
|
||||
const float aGammas[4] = float[](
|
||||
@@ -64,10 +64,13 @@ void main() {
|
||||
float aGamma = aGammas[int(v_color.b * 255) & 3];
|
||||
vec4 gamma = vec4(rgbGamma, rgbGamma, rgbGamma, aGamma);
|
||||
|
||||
vec4 range = vec4(vec3(min(rgbGamma, 1.0 / rgbGamma)), 1.0);
|
||||
vec4 offset = vec4(vec3(max(0.0, 1.0 - rgbGamma)), 0.0);
|
||||
|
||||
// cloud colour format:
|
||||
// r: bw diffuse map, g: normal, b: normal, a: bw diffuse alpha
|
||||
vec4 inCol = texture(u_texture, v_texCoords);
|
||||
vec4 rawCol = pow(inCol, gamma);
|
||||
vec4 rawCol = range * pow(inCol, gamma) + offset;
|
||||
|
||||
// do gradient mapping here
|
||||
vec4 outCol = fma(mix(shadeCol, cloudCol, rawCol.r), boolean.yyyx, rawCol * boolean.xxxy);
|
||||
|
||||
Reference in New Issue
Block a user