@jdultra/threedtiles 14.0.18 → 14.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1235,6 +1235,7 @@ out float splatDepth;
1235
1235
  out float splatDepthWithBias;
1236
1236
  out float stds;
1237
1237
  out vec2 viewZW;
1238
+ out vec3 adjustedColor;
1238
1239
  uniform highp sampler3D positionColorTexture;
1239
1240
  uniform highp sampler3D covarianceTexture;
1240
1241
  uniform mat3 zUpToYUpMatrix3x3;
@@ -1249,6 +1250,11 @@ uniform float antialiasingFactor;
1249
1250
  uniform float cropRadius;
1250
1251
  uniform float depthBias; // depth bias in meters
1251
1252
 
1253
+ uniform float exposureEV; // stops
1254
+ uniform float saturation; // linear saturation multiplier
1255
+ uniform float contrast; // linear contrast multiplier
1256
+ uniform vec2 tempTint; // temperature, tint (approximation)
1257
+
1252
1258
 
1253
1259
  void getVertexData(out vec3 position, out mat3 covariance) {
1254
1260
 
@@ -1428,7 +1434,27 @@ void main() {
1428
1434
  splatDepth = (splatPositionProjected.z / splatPositionProjected.w)* 0.5 + 0.5;
1429
1435
  #endif
1430
1436
 
1431
-
1437
+ // Work in linear color space
1438
+ adjustedColor = color.xyz;
1439
+
1440
+ // Exposure (stops)
1441
+ float exposureMul = exp2(exposureEV);
1442
+
1443
+ // Temp/Tint -> simple RGB gains approximation
1444
+ float t = clamp(tempTint.x / 100.0, -1.0, 1.0); // temperature -100..100
1445
+ float ti = clamp(tempTint.y / 100.0, -1.0, 1.0); // tint -100..100
1446
+ // approximate mapping: warm -> increase R and B in different amounts, tint adjusts G
1447
+ vec3 wbGain = vec3(1.0 + 0.15 * t, 1.0 + 0.05 * ti, 1.0 - 0.25 * t);
1448
+
1449
+ adjustedColor *= exposureMul * wbGain;
1450
+
1451
+ // Saturation (linear)
1452
+ const vec3 lumaWeights = vec3(0.2126,0.7152,0.0722);
1453
+ float L = dot(adjustedColor, lumaWeights);
1454
+ adjustedColor = mix(vec3(L), adjustedColor, saturation);
1455
+
1456
+ // Contrast (linear, pivot around 0.5)
1457
+ adjustedColor = (adjustedColor - 0.5) * contrast + 0.5;
1432
1458
  }
1433
1459
  `}function ya(){return`
1434
1460
  precision highp float;
@@ -1436,6 +1462,7 @@ precision highp int;
1436
1462
 
1437
1463
  in float stds;
1438
1464
  in vec4 color;
1465
+ in vec3 adjustedColor; // saturation/contrast/exposure/temperature adjusted
1439
1466
  in vec2 vUv;
1440
1467
  in vec3 splatPositionModel;
1441
1468
  in vec3 splatPositionWorld;
@@ -1449,12 +1476,6 @@ uniform float textureSize;
1449
1476
  uniform float k;
1450
1477
  uniform float beta_k; // pow((4.0 * gamma(2.0/k)) /k, k/2)
1451
1478
 
1452
- // Visual tuning uniforms
1453
- uniform float exposureEV; // stops
1454
- uniform float saturation; // linear saturation multiplier
1455
- uniform float contrast; // linear contrast multiplier
1456
- uniform vec2 tempTint; // temperature, tint (approximation)
1457
-
1458
1479
  void main() {
1459
1480
  float l = dot(vUv, vUv);
1460
1481
  if (l > 0.25) discard; // early out unchanged
@@ -1463,30 +1484,7 @@ void main() {
1463
1484
  float rk = pow(r2, 0.5 * k); // r^{k}
1464
1485
  float alpha = color.w * exp(-beta_k * rk);
1465
1486
 
1466
- // Work in linear color space
1467
- vec3 col = color.xyz;
1468
-
1469
- // Exposure (stops)
1470
- float exposureMul = exp2(exposureEV);
1471
-
1472
- // Temp/Tint -> simple RGB gains approximation
1473
- float t = clamp(tempTint.x / 100.0, -1.0, 1.0); // temperature -100..100
1474
- float ti = clamp(tempTint.y / 100.0, -1.0, 1.0); // tint -100..100
1475
- // approximate mapping: warm -> increase R and B in different amounts, tint adjusts G
1476
- vec3 wbGain = vec3(1.0 + 0.15 * t, 1.0 + 0.05 * ti, 1.0 - 0.25 * t);
1477
-
1478
- col *= exposureMul * wbGain;
1479
-
1480
- // Saturation (linear)
1481
- const vec3 lumaWeights = vec3(0.2126,0.7152,0.0722);
1482
- float L = dot(col, lumaWeights);
1483
- col = mix(vec3(L), col, saturation);
1484
-
1485
- // Contrast (linear, pivot around 0.5)
1486
- col = (col - 0.5) * contrast + 0.5;
1487
-
1488
- // Final gamma to display - keep previous behavior (sRGB-ish gamma 2.2)
1489
- vec3 display = pow(clamp(col, 0.0, 1.0), vec3(1.0/2.2));
1487
+ vec3 display = pow(clamp(adjustedColor, 0.0, 1.0), vec3(1.0/2.2));
1490
1488
 
1491
1489
  fragColor = vec4(display, alpha);
1492
1490
  gl_FragDepth = splatDepthWithBias;