@jdultra/threedtiles 13.2.5 → 13.2.6

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.
@@ -7124,7 +7124,7 @@ class kd extends Un {
7124
7124
  s.texture.type = rt, s.texture.format = it, s.texture.internalFormat = "RGBA32UI", e.initRenderTarget(s);
7125
7125
  const A = new Ba(1024, 1024, 1, { magFilter: He, minFilter: He, anisotropy: 0, type: rt, format: it, depthBuffer: !1, resolveDepthBuffer: !1 });
7126
7126
  A.texture.type = rt, A.texture.format = it, A.texture.internalFormat = "RGBA32UI", e.initRenderTarget(A);
7127
- const u = new sn({ glslVersion: An, uniforms: { textureSize: { value: 1024 }, numSlices: { value: 1 }, covarianceTexture: { value: A.texture }, positionColorTexture: { value: s.texture }, zUpToYUpMatrix3x3: { value: qo }, sizeMultiplier: { value: 1 }, cropRadius: { value: Number.MAX_VALUE }, cameraNear: { value: 0.01 }, cameraFar: { value: 10 }, computeLinearDepth: { value: !0 }, viewportPixelSize: { value: new ii() }, k: { value: 2 }, beta_k: { value: 2 }, minSplatPixelSize: { value: 0 }, minOpacity: { value: 0.01 }, culling: { value: !0 } }, vertexShader: jd(), fragmentShader: a || Md(), transparent: !0, side: Ta, depthTest: !1, depthWrite: !1 }), c = new yi(), d = new Float32Array([-0.5, 0.5, 0, 0.5, 0.5, 0, -0.5, -0.5, 0, 0.5, -0.5, 0]);
7127
+ const u = new sn({ glslVersion: An, uniforms: { textureSize: { value: 1024 }, numSlices: { value: 1 }, covarianceTexture: { value: A.texture }, positionColorTexture: { value: s.texture }, zUpToYUpMatrix3x3: { value: qo }, sizeMultiplier: { value: 1 }, cropRadius: { value: Number.MAX_VALUE }, cameraNear: { value: 0.01 }, cameraFar: { value: 10 }, computeLinearDepth: { value: !0 }, viewportPixelSize: { value: new ii() }, k: { value: 2 }, beta_k: { value: 2 }, minSplatPixelSize: { value: 0 }, minOpacity: { value: 0.01 }, culling: { value: !0 }, antialiasingFactor: { value: 2 } }, vertexShader: jd(), fragmentShader: a || Md(), transparent: !0, side: Ta, depthTest: !1, depthWrite: !1 }), c = new yi(), d = new Float32Array([-0.5, 0.5, 0, 0.5, 0.5, 0, -0.5, -0.5, 0, 0.5, -0.5, 0]);
7128
7128
  c.setIndex([0, 2, 1, 2, 3, 1]), c.setAttribute("position", new Qt(d, 3));
7129
7129
  const l = new Uint32Array(o), h = new Tn(l, 1, !1);
7130
7130
  h.needsUpdate = !0, h.setUsage(wi), c.setAttribute("order", h), c.instanceCount = 0, super(c, u), this.matrixAutoUpdate = !1, this.numBatches = 0, this.numVisibleBatches = 0, this.orderAttribute = h, this.textureSize = 1024, this.numTextures = 1, this.batchSize = r, this.maxSplats = o, this.numSplatsRendered = 0, this.positionColorRenderTarget = s, this.covarianceRenderTarget = A, this.renderer = e, this.sortID = 0, this.freeAddresses = new Ca();
@@ -7171,7 +7171,9 @@ void main() {
7171
7171
  this.splatsCPUCuling = e, this.material.uniforms.culling.value = !e;
7172
7172
  }
7173
7173
  updateShaderParams(e) {
7174
- e.projectionMatrix.elements, this.renderer.getSize(this.material.uniforms.viewportPixelSize.value), this.material.uniforms.viewportPixelSize.value.multiplyScalar(this.renderer.getPixelRatio());
7174
+ e.projectionMatrix.elements, this.renderer.getSize(this.material.uniforms.viewportPixelSize.value);
7175
+ const t = this.renderer.getPixelRatio();
7176
+ this.material.uniforms.viewportPixelSize.value.multiplyScalar(t), this.material.uniforms.antialiasingFactor.value = t < 1 ? 2 / t : 2;
7175
7177
  }
7176
7178
  dispose() {
7177
7179
  this.material.dispose(), this.copyMaterial2D.dispose(), this.copyMaterial3D.dispose(), this.covarianceRenderTarget.dispose(), this.positionColorRenderTarget.dispose(), this.worker.terminate(), this.worker = null, this.orderAttribute.array = void 0, this.geometry.dispose();
@@ -7293,6 +7295,7 @@ uniform float beta_k; // pow((4.0 * gamma(2.0/k)) /k, k/2)
7293
7295
  uniform float minSplatPixelSize;
7294
7296
  uniform float minOpacity;
7295
7297
  uniform bool culling;
7298
+ uniform float antialiasingFactor;
7296
7299
 
7297
7300
 
7298
7301
  void getVertexData(out vec3 position, out mat3 covariance) {
@@ -7370,7 +7373,15 @@ bool modelTransform(in vec3 splatWorld, in mat3 covariance, inout vec3 vertexPos
7370
7373
  float a = dot(j0W, tmp0);
7371
7374
  float b = dot(j0W, tmp1);
7372
7375
  float c = dot(j1W, tmp1);
7373
-
7376
+ float sigmaNDC = (antialiasingFactor / viewportPixelSize.x) * 2.0;
7377
+ float k2 = sigmaNDC * sigmaNDC;
7378
+ float detOrig = a * c - b * b;
7379
+ a += k2;
7380
+ c += k2;
7381
+ float detBlur = a * c - b * b;
7382
+ color.a *= sqrt(detOrig / detBlur);
7383
+ if(color.a < 0.01) return false;
7384
+ //color.a = 1.0;
7374
7385
  float halfTrace = 0.5 * (a + c);
7375
7386
  float rootTerm = sqrt(max(halfTrace * halfTrace - (a * c - b * b), 0.0));
7376
7387
  float lambda1 = halfTrace + rootTerm;
@@ -7444,13 +7455,7 @@ void main() {
7444
7455
 
7445
7456
  vec4 outPosition = projectionMatrix * viewMatrix * vec4(offsetWorld+splatPositionWorld,1.0);
7446
7457
 
7447
- vec3 glPosNDC = outPosition.xyz / outPosition.w;
7448
- vec3 splatPosNDC = splatPositionProjected.xyz / splatPositionProjected.w;
7449
- vec2 pixelOffset = abs((glPosNDC - splatPosNDC).xy)*viewportPixelSize;
7450
-
7451
- if((pixelOffset.x < minSplatPixelSize && pixelOffset.y < minSplatPixelSize)/* || (pixelOffset.x < 2.0 || pixelOffset.y < 2.0) */){
7452
- return;
7453
- }
7458
+
7454
7459
 
7455
7460
  gl_Position = outPosition;
7456
7461
  /* if(computeLinearDepth){