Skip to content

Commit

Permalink
Merge pull request #6 from BarthPaleologue/WIP
Browse files Browse the repository at this point in the history
Better terrain, better camera movements
  • Loading branch information
BarthPaleologue authored Dec 29, 2023
2 parents 1041631 + df0ac89 commit 3267c8b
Show file tree
Hide file tree
Showing 47 changed files with 627 additions and 536 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"sass-loader": "^13.3.2",
"squirrel-noise": "^1.0.0",
"style-loader": "^3.3.3",
"terrain-generation": "^1.7.12",
"terrain-generation": "^1.8.0",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
Expand Down
93 changes: 70 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified src/asset/character.glb
Binary file not shown.
Binary file added src/asset/rock.glb
Binary file not shown.
4 changes: 2 additions & 2 deletions src/shaders/flatCloudsFragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ float cloudDensityAtPoint(vec3 samplePoint) {
vec2 dfDetail = fwidth(uvDetail);
if(dfDetail.x > 0.5) dfDetail.x = 0.0;

float density = 1.0 - textureLod(clouds_lut, uvWorley, log2(max(dfWorley.x, dfWorley.y) * 1024.0)).r;
float density = textureLod(clouds_lut, uvWorley, log2(max(dfWorley.x, dfWorley.y) * 1024.0)).r;
density *= textureLod(clouds_lut, uvDetail, log2(max(dfDetail.x, dfDetail.y) * 1024.0)).g;

float cloudThickness = 2.0;//TODO: make this a uniform
Expand Down Expand Up @@ -172,7 +172,7 @@ void main() {
}
ndl = saturate(ndl);

vec3 ambiant = mix(finalColor.rgb, ndl * clouds_color, cloudDensity);
vec3 ambiant = mix(finalColor.rgb * (1.0 - cloudDensity), ndl * clouds_color, cloudDensity);

finalColor.rgb = ambiant + specularHighlight * cloudDensity;
}
Expand Down
7 changes: 6 additions & 1 deletion src/shaders/lensflare.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ vec3 anflares(vec2 uv, float intensity, float stretch, float brightness)
}



void main() {
vec4 screenColor = texture(textureSampler, vUV);

Expand Down Expand Up @@ -132,7 +131,13 @@ void main() {
vec3 sun, sunflare, lensflare;
vec3 flare = lensflares(uv*1.5, mouse*1.5, sunflare, lensflare);

#ifdef CHEAP_FLARE
vec3 anflare = pow(anflares(uv-mouse, 400.0, 0.5, 0.6), vec3(4.0));
anflare += smoothstep(0.0025, 1.0, anflare)*10.0;
anflare *= smoothstep(0.0, 1.0, anflare);
#else
vec3 anflare = pow(anflares(uv-mouse, 0.5, 400.0, 0.9, 0.1), vec3(4.0));
#endif

sun += getSun(uv-mouse) + (flare + anflare)*flareColor*2.0;

Expand Down
9 changes: 5 additions & 4 deletions src/shaders/rings/ringsDensity.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ float ringDensityAtPoint(vec3 samplePoint) {
vec3 samplePointPlanetSpace = samplePoint - object_position;

float distanceToPlanet = length(samplePointPlanetSpace);
float normalizedDistance = distanceToPlanet / object_radius;
float relativeDistance = distanceToPlanet / object_radius;

float uvX = remap(normalizedDistance, rings_start, rings_end, 0.0, 1.0);
// out if not intersecting with rings and interpolation area
if (relativeDistance < rings_start || relativeDistance > rings_end) return 0.0;

float uvX = remap(relativeDistance, rings_start, rings_end, 0.0, 1.0);
float lutDensity = texture2D(rings_lut, vec2(uvX, 0.0)).x;

// out if not intersecting with rings and interpolation area
if (normalizedDistance < rings_start || normalizedDistance > rings_end) return 0.0;
return lutDensity;
}
2 changes: 1 addition & 1 deletion src/shaders/ringsFragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void main() {
}
if (nbLightSources == 0) ringShadeColor *= 0.1;

finalColor = vec4(mix(finalColor.rgb, ringShadeColor, ringDensity), 1.0);
finalColor = vec4(mix(finalColor.rgb * (1.0 - ringDensity), ringShadeColor, ringDensity), 1.0);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shaders/telluricPlanetMaterial/utils/lut.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void main() {
moisture01 = smoothSharpener(moisture01, 2.0);
moisture01 = clamp(moisture01, 0.0, 1.0);

vec3 domainWarping = 0.5 * vec3(
vec3 domainWarping = 2.0 * vec3(
completeNoise(sphere + vec3(23.0, 57.0, -18.0), 5, 2.0, 2.0),
completeNoise(sphere + vec3(57.0, -18.0, 23.0), 5, 2.0, 2.0),
completeNoise(sphere + vec3(-18.0, 23.0, 57.0), 5, 2.0, 2.0)
Expand Down
6 changes: 3 additions & 3 deletions src/shaders/textures/flatCloudLUT.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ uniform float detailFrequency;
void main() {
vec3 sphere = toSphere(vUV);

float worley = completeWorley(sphere * worleyFrequency, 1, 2.0, 2.0);
float detailNoise = completeNoise(sphere * detailFrequency, 5, 2.0, 2.0);
float worley = completeWorley(sphere * worleyFrequency, 4, 2.0, 2.0);
float detailNoise = completeNoise(sphere * detailFrequency, 8, 2.0, 2.0);

gl_FragColor = vec4(vec3(worley, detailNoise, 0.0), 1.0);
gl_FragColor = vec4(vec3(1.0 - worley, detailNoise, 0.0), 1.0);
}
7 changes: 0 additions & 7 deletions src/shaders/textures/test.glsl

This file was deleted.

1 change: 1 addition & 0 deletions src/styles/helmetOverlay/helmetOverlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
bottom: 0;
right: 0;
z-index: 2;
pointer-events: none;

#bodyData {
position: absolute;
Expand Down
Loading

0 comments on commit 3267c8b

Please sign in to comment.