feat: reconstruct the chase-view grand tourer
This commit is contained in:
@@ -70,19 +70,27 @@ export function createAtmosphere(
|
||||
uniforms: {
|
||||
uVisibility: { value: night.starVisibility },
|
||||
uDistance: { value: 0 },
|
||||
uPointScale: { value: 18 },
|
||||
uMaxPointSize: { value: 4.5 },
|
||||
uColor: { value: new THREE.Color(0xb9ecf2) },
|
||||
},
|
||||
vertexShader: `
|
||||
attribute float starSize;
|
||||
attribute float brightness;
|
||||
uniform float uDistance;
|
||||
uniform float uPointScale;
|
||||
uniform float uMaxPointSize;
|
||||
varying float vBrightness;
|
||||
void main() {
|
||||
vec3 star = position;
|
||||
star.x += sin(position.z * 0.017 + uDistance * 0.004) * 0.08;
|
||||
vec4 viewPosition = modelViewMatrix * vec4(star, 1.0);
|
||||
vBrightness = brightness;
|
||||
gl_PointSize = starSize * (250.0 / max(1.0, -viewPosition.z));
|
||||
gl_PointSize = clamp(
|
||||
starSize * (uPointScale / max(1.0, -viewPosition.z)),
|
||||
0.75,
|
||||
uMaxPointSize
|
||||
);
|
||||
gl_Position = projectionMatrix * viewPosition;
|
||||
}
|
||||
`,
|
||||
|
||||
Reference in New Issue
Block a user