Skip to content

Commit

Permalink
fix(renderer,important): fix all known rendering issues with starfiel…
Browse files Browse the repository at this point in the history
…d by @sa2urami
  • Loading branch information
zardoy committed Sep 2, 2024
1 parent 66d26ad commit 574dbaf
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions prismarine-viewer/viewer/lib/worldrendererThree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ class StarField {
this.points?.position.copy?.(camera.position)
material.uniforms.time.value = clock.getElapsedTime() * speed
}
this.points.renderOrder = -1
}

remove () {
Expand All @@ -439,7 +440,7 @@ class StarfieldMaterial extends THREE.ShaderMaterial {
void main() {
vColor = color;
vec4 mvPosition = modelViewMatrix * vec4(position, 0.5);
gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
gl_PointSize = 0.7 * size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
gl_Position = projectionMatrix * mvPosition;
}`,
fragmentShader: /* glsl */ `
Expand All @@ -448,11 +449,7 @@ class StarfieldMaterial extends THREE.ShaderMaterial {
varying vec3 vColor;
void main() {
float opacity = 1.0;
if (fade == 1.0) {
float d = distance(gl_PointCoord, vec2(0.5, 0.5));
opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25)));
}
gl_FragColor = vec4(vColor, opacity);
gl_FragColor = vec4(vColor, 1.0);
#include <tonemapping_fragment>
#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
Expand Down

0 comments on commit 574dbaf

Please sign in to comment.