cloud rendering: gamma change

This commit is contained in:
minjaesong
2023-09-05 01:04:09 +09:00
parent cf98c13111
commit c4deba14da
5 changed files with 28 additions and 28 deletions

View File

@@ -4,8 +4,8 @@
"daylightClut": "clut_daylight.tga", "daylightClut": "clut_daylight.tga",
"classification": "generic", "classification": "generic",
"cloudChance": 125, "cloudChance": 125,
"cloudGamma": [0.45, 2.4], "cloudGamma": [0.7, 2.4],
"cloudGammaVariance": [0.1, 0.0], "cloudGammaVariance": [0.143, 0.0],
"windSpeed": 0.35, "windSpeed": 0.35,
"windSpeedVariance": 0.4, "windSpeedVariance": 0.4,
"windSpeedDamping": 0.5, "windSpeedDamping": 0.5,

View File

@@ -4,8 +4,8 @@
"daylightClut": "clut_daylight.tga", "daylightClut": "clut_daylight.tga",
"classification": "generic2", "classification": "generic2",
"cloudChance": 800, "cloudChance": 800,
"cloudGamma": [0.6, 2.4], "cloudGamma": [0.8, 2.4],
"cloudGammaVariance": [0.1, 0.0], "cloudGammaVariance": [0.125, 0.0],
"windSpeed": 0.35, "windSpeed": 0.35,
"windSpeedVariance": 0.4, "windSpeedVariance": 0.4,
"windSpeedDamping": 0.5, "windSpeedDamping": 0.5,

View File

@@ -4,7 +4,7 @@
"daylightClut": "clut_daylight.tga", "daylightClut": "clut_daylight.tga",
"classification": "overcast", "classification": "overcast",
"cloudChance": 300, "cloudChance": 300,
"cloudGamma": [3.7, 1.6], "cloudGamma": [2.0, 1.6],
"cloudGammaVariance": [0.0, 0.0], "cloudGammaVariance": [0.0, 0.0],
"windSpeed": 10.45, "windSpeed": 10.45,
"windSpeedVariance": 0.5, "windSpeedVariance": 0.5,

View File

@@ -180,21 +180,18 @@ class WeatherObjectCloud(
0.3f, 0.3f,
0.4f, 0.4f,
0.5f, 0.5f,
0.6f,
0.7f, 0.7f,
0.8f,
0.9f, 0.9f,
1.1f, 1.0f,
1.3f, 1.25f,
1.5f,
1.7f, 1.75f,
2.1f, 2.0f,
2.5f, 2.5f,
2.9f, 3.0f,
3.5f
3.7f,
4.5f,
5.3f,
6.1f
) )
val A_GAMMA_TABLE = floatArrayOf( val A_GAMMA_TABLE = floatArrayOf(

View File

@@ -22,20 +22,20 @@ const float rgbGammas[16] = float[](
0.4, 0.4,
0.5, 0.5,
0.6,
0.7, 0.7,
0.8,
0.9, 0.9,
1.1,
1.3,
1.7, 1.0,
2.1, 1.25,
1.5,
1.75,
2.0,
2.5, 2.5,
2.9, 3.0,
3.5
3.7,
4.5,
5.3,
6.1
); );
const float aGammas[4] = float[]( const float aGammas[4] = float[](
@@ -64,10 +64,13 @@ void main() {
float aGamma = aGammas[int(v_color.b * 255) & 3]; float aGamma = aGammas[int(v_color.b * 255) & 3];
vec4 gamma = vec4(rgbGamma, rgbGamma, rgbGamma, aGamma); 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: // cloud colour format:
// r: bw diffuse map, g: normal, b: normal, a: bw diffuse alpha // r: bw diffuse map, g: normal, b: normal, a: bw diffuse alpha
vec4 inCol = texture(u_texture, v_texCoords); vec4 inCol = texture(u_texture, v_texCoords);
vec4 rawCol = pow(inCol, gamma); vec4 rawCol = range * pow(inCol, gamma) + offset;
// do gradient mapping here // do gradient mapping here
vec4 outCol = fma(mix(shadeCol, cloudCol, rawCol.r), boolean.yyyx, rawCol * boolean.xxxy); vec4 outCol = fma(mix(shadeCol, cloudCol, rawCol.r), boolean.yyyx, rawCol * boolean.xxxy);