From e1f55e88c3e6ea5cf4a0ae70b4318a43d1a6ed22 Mon Sep 17 00:00:00 2001 From: jbritain <50422789+jbritain@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:38:30 +0100 Subject: [PATCH] tweak some tutorial naming scheme stuff --- .../Beginners/Your First Shader/3_composite_lighting.mdx | 8 ++++---- .../docs/guides/Beginners/Your First Shader/5_fog.mdx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/content/docs/guides/Beginners/Your First Shader/3_composite_lighting.mdx b/src/content/docs/guides/Beginners/Your First Shader/3_composite_lighting.mdx index 832033e..977aa6e 100644 --- a/src/content/docs/guides/Beginners/Your First Shader/3_composite_lighting.mdx +++ b/src/content/docs/guides/Beginners/Your First Shader/3_composite_lighting.mdx @@ -70,8 +70,8 @@ So, to apply our lighting, we would then do something like `color.rgb *= ambient First, let's define some colors/brightnesses for each term. I chose the following on a whim. ```glsl -const vec3 torchColor = vec3(1.0, 0.5, 0.08); -const vec3 skyColor = vec3(0.05, 0.15, 0.3); +const vec3 blocklightColor = vec3(1.0, 0.5, 0.08); +const vec3 skylightColor = vec3(0.05, 0.15, 0.3); const vec3 sunlightColor = vec3(1.0); const vec3 ambientColor = vec3(0.1); ``` @@ -81,8 +81,8 @@ I have defined these before `main`, they are `const`s which means they are defin Let's get these values applied. ```glsl -vec3 blocklight = lightmap.r * torchColor; -vec3 skylight = lightmap.g * skyColor; +vec3 blocklight = lightmap.r * blocklightColor; +vec3 skylight = lightmap.g * skylightColor; vec3 ambient = ambientColor; vec3 sunlight = sunlightColor; // we will fix this in a minute diff --git a/src/content/docs/guides/Beginners/Your First Shader/5_fog.mdx b/src/content/docs/guides/Beginners/Your First Shader/5_fog.mdx index a6a9740..6de942a 100644 --- a/src/content/docs/guides/Beginners/Your First Shader/5_fog.mdx +++ b/src/content/docs/guides/Beginners/Your First Shader/5_fog.mdx @@ -99,14 +99,14 @@ Like we did before, let's define a fog density. I have chosen 5. We can then update our fog blending to make use of this value. ```glsl -float distance = length(viewPos) / far; -float fogFactor = exp(-FOG_DENSITY * (1.0 - distance)); +float dist = length(viewPos) / far; +float fogFactor = exp(-FOG_DENSITY * (1.0 - dist)); color.rgb = mix(color.rgb, fogColor, clamp(fogFactor, 0.0, 1.0)); ``` :::caution[Warning] -Note that we clamp the value of `fogFactor` between `0` and `1`. This is because the behaviour of `mix` is undefined if it is outside this range. Since the render distance in blocks is along three axes, blocks can be more than this distance away along the diagonals, so in some cases, `distance` could be more than `1`. +Note that we clamp the value of `fogFactor` between `0` and `1`. This is because the behaviour of `mix` is undefined if it is outside this range. Since the render distance in blocks is along three axes, blocks can be more than this distance away along the diagonals, so in some cases, `dist` could be more than `1`. ::: ![](../../../../../assets/beginner_tutorial/exponentialfog.webp)