@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.
@@ -9404,6 +9404,7 @@ out float splatDepth;
9404
9404
  out float splatDepthWithBias;
9405
9405
  out float stds;
9406
9406
  out vec2 viewZW;
9407
+ out vec3 adjustedColor;
9407
9408
  uniform highp sampler3D positionColorTexture;
9408
9409
  uniform highp sampler3D covarianceTexture;
9409
9410
  uniform mat3 zUpToYUpMatrix3x3;
@@ -9418,6 +9419,11 @@ uniform float antialiasingFactor;
9418
9419
  uniform float cropRadius;
9419
9420
  uniform float depthBias; // depth bias in meters
9420
9421
 
9422
+ uniform float exposureEV; // stops
9423
+ uniform float saturation; // linear saturation multiplier
9424
+ uniform float contrast; // linear contrast multiplier
9425
+ uniform vec2 tempTint; // temperature, tint (approximation)
9426
+
9421
9427
 
9422
9428
  void getVertexData(out vec3 position, out mat3 covariance) {
9423
9429
 
@@ -9597,7 +9603,27 @@ void main() {
9597
9603
  splatDepth = (splatPositionProjected.z / splatPositionProjected.w)* 0.5 + 0.5;
9598
9604
  #endif
9599
9605
 
9600
-
9606
+ // Work in linear color space
9607
+ adjustedColor = color.xyz;
9608
+
9609
+ // Exposure (stops)
9610
+ float exposureMul = exp2(exposureEV);
9611
+
9612
+ // Temp/Tint -> simple RGB gains approximation
9613
+ float t = clamp(tempTint.x / 100.0, -1.0, 1.0); // temperature -100..100
9614
+ float ti = clamp(tempTint.y / 100.0, -1.0, 1.0); // tint -100..100
9615
+ // approximate mapping: warm -> increase R and B in different amounts, tint adjusts G
9616
+ vec3 wbGain = vec3(1.0 + 0.15 * t, 1.0 + 0.05 * ti, 1.0 - 0.25 * t);
9617
+
9618
+ adjustedColor *= exposureMul * wbGain;
9619
+
9620
+ // Saturation (linear)
9621
+ const vec3 lumaWeights = vec3(0.2126,0.7152,0.0722);
9622
+ float L = dot(adjustedColor, lumaWeights);
9623
+ adjustedColor = mix(vec3(L), adjustedColor, saturation);
9624
+
9625
+ // Contrast (linear, pivot around 0.5)
9626
+ adjustedColor = (adjustedColor - 0.5) * contrast + 0.5;
9601
9627
  }
9602
9628
  `;
9603
9629
  }
@@ -9608,6 +9634,7 @@ precision highp int;
9608
9634
 
9609
9635
  in float stds;
9610
9636
  in vec4 color;
9637
+ in vec3 adjustedColor; // saturation/contrast/exposure/temperature adjusted
9611
9638
  in vec2 vUv;
9612
9639
  in vec3 splatPositionModel;
9613
9640
  in vec3 splatPositionWorld;
@@ -9621,12 +9648,6 @@ uniform float textureSize;
9621
9648
  uniform float k;
9622
9649
  uniform float beta_k; // pow((4.0 * gamma(2.0/k)) /k, k/2)
9623
9650
 
9624
- // Visual tuning uniforms
9625
- uniform float exposureEV; // stops
9626
- uniform float saturation; // linear saturation multiplier
9627
- uniform float contrast; // linear contrast multiplier
9628
- uniform vec2 tempTint; // temperature, tint (approximation)
9629
-
9630
9651
  void main() {
9631
9652
  float l = dot(vUv, vUv);
9632
9653
  if (l > 0.25) discard; // early out unchanged
@@ -9635,30 +9656,7 @@ void main() {
9635
9656
  float rk = pow(r2, 0.5 * k); // r^{k}
9636
9657
  float alpha = color.w * exp(-beta_k * rk);
9637
9658
 
9638
- // Work in linear color space
9639
- vec3 col = color.xyz;
9640
-
9641
- // Exposure (stops)
9642
- float exposureMul = exp2(exposureEV);
9643
-
9644
- // Temp/Tint -> simple RGB gains approximation
9645
- float t = clamp(tempTint.x / 100.0, -1.0, 1.0); // temperature -100..100
9646
- float ti = clamp(tempTint.y / 100.0, -1.0, 1.0); // tint -100..100
9647
- // approximate mapping: warm -> increase R and B in different amounts, tint adjusts G
9648
- vec3 wbGain = vec3(1.0 + 0.15 * t, 1.0 + 0.05 * ti, 1.0 - 0.25 * t);
9649
-
9650
- col *= exposureMul * wbGain;
9651
-
9652
- // Saturation (linear)
9653
- const vec3 lumaWeights = vec3(0.2126,0.7152,0.0722);
9654
- float L = dot(col, lumaWeights);
9655
- col = mix(vec3(L), col, saturation);
9656
-
9657
- // Contrast (linear, pivot around 0.5)
9658
- col = (col - 0.5) * contrast + 0.5;
9659
-
9660
- // Final gamma to display - keep previous behavior (sRGB-ish gamma 2.2)
9661
- vec3 display = pow(clamp(col, 0.0, 1.0), vec3(1.0/2.2));
9659
+ vec3 display = pow(clamp(adjustedColor, 0.0, 1.0), vec3(1.0/2.2));
9662
9660
 
9663
9661
  fragColor = vec4(display, alpha);
9664
9662
  gl_FragDepth = splatDepthWithBias;