@openglobus/og 0.18.3 → 0.18.4

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.
@@ -30,7 +30,7 @@ export class Atmosphere extends Control {
30
30
  this.planet && this.planet.events.off("draw", this._drawBackground);
31
31
  }
32
32
  _drawAtmosphereTextures() {
33
- let width = 256, height = 128;
33
+ let width = 1024, height = 1024;
34
34
  this._transmittanceBuffer = new Framebuffer(this.renderer.handler, {
35
35
  width: width,
36
36
  height: height,
@@ -142,7 +142,7 @@ function atmosphereBackgroundShader() {
142
142
  gl_Position = vec4(corners, 0.0, 1.0);
143
143
  }`,
144
144
  fragmentShader: `
145
- precision highp float;
145
+ precision lowp float;
146
146
 
147
147
  ${atmos.COMMON}
148
148
 
@@ -242,7 +242,7 @@ function atmosphereBackgroundShader() {
242
242
  if (offset > 0.0) {
243
243
  // intersection of camera ray with atmosphere
244
244
  rayOrigin = cameraPosition + rayDirection * offset;
245
- }
245
+ }
246
246
 
247
247
  float height = length(rayOrigin) - BOTTOM_RADIUS;
248
248
  float rayAngle = dot(rayOrigin, rayDirection) / length(rayOrigin);
@@ -258,12 +258,13 @@ function atmosphereBackgroundShader() {
258
258
 
259
259
  bool hitGround = intersectSphere(cameraPosition, rayDirection, BOTTOM_RADIUS, distanceToGround) && distanceToGround > 0.0;
260
260
 
261
- if(intersectSphere(cameraPosition, rayDirection, BOTTOM_RADIUS - 15000.0, distanceToGround) && hitGround){
261
+ if(intersectSphere(cameraPosition, rayDirection, BOTTOM_RADIUS - 15000.0, distanceToGround) && hitGround)
262
+ {
262
263
  discard;
263
264
  }
264
265
 
265
266
  float segmentLength = ((hitGround ? distanceToGround : distanceToSpace) - max(offset, 0.0)) / float(SAMPLE_COUNT);
266
-
267
+
267
268
  float t = segmentLength * 0.5;
268
269
 
269
270
  vec3 transmittanceCamera;
@@ -276,17 +277,13 @@ function atmosphereBackgroundShader() {
276
277
  vec3 up = position / length(position);
277
278
  float rayAngle = dot(up, rayDirection);
278
279
  float lightAngle = dot(up, lightDirection);
279
- // shadow is ommitted because it can create banding artifacts with low sample counts
280
- // float distanceToGround;
281
- // float shadow = intersectSphere(position, lightDirection, BOTTOM_RADIUS, distanceToGround) && distanceToGround >= 0.0 ? 0.0 : 1.0;
282
- float shadow = 1.0;
283
280
  vec3 transmittanceToSpace = transmittanceFromTexture(height, cameraBelow ? -rayAngle : rayAngle);
284
281
  transmittanceCamera = cameraBelow ? (transmittanceToSpace / transmittanceFromCameraToSpace) : (transmittanceFromCameraToSpace / transmittanceToSpace);
285
282
  transmittanceLight = transmittanceFromTexture(height, lightAngle);
286
283
  vec2 opticalDensity = exp(-height / rayleighMieHeights);
287
284
  vec3 scatteredLight = transmittanceLight * (rayleighScatteringCoefficient * opticalDensity.x * rayleighPhase + mieScatteringCoefficient * opticalDensity.y * miePhase);
288
285
  scatteredLight += multipleScatteringContributionFromTexture(height, lightAngle) * (rayleighScatteringCoefficient * opticalDensity.x + mieScatteringCoefficient * opticalDensity.y);
289
- light += shadow * transmittanceCamera * scatteredLight * segmentLength;
286
+ light += transmittanceCamera * scatteredLight * segmentLength;
290
287
  t += segmentLength;
291
288
  }
292
289
 
@@ -112,7 +112,7 @@ export class Planet extends RenderNode {
112
112
  this._ambient = new Float32Array([a.x, a.y, a.z]);
113
113
  this._diffuse = new Float32Array([d.x, d.y, d.z]);
114
114
  this._specular = new Float32Array([s.x, s.y, s.z, shininess]);
115
- this._maxGridSize = Math.log2(options.maxGridSize || 128);
115
+ this._maxGridSize = Math.log2(options.maxGridSize || 256);
116
116
  this.SLICE_SIZE = 4;
117
117
  this.SLICE_SIZE_4 = this.SLICE_SIZE * 4;
118
118
  this.SLICE_SIZE_3 = this.SLICE_SIZE * 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.18.3",
3
+ "version": "0.18.4",
4
4
  "description": "[openglobus](https://www.openglobus.org/) is a javascript/typescript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers, and 3D objects. It uses the WebGL technology, open source, and completely free.",
5
5
  "directories": {
6
6
  "example": "./sandbox"