A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(terrain): a planet's ground is one-sided and its fog is the ground's under it
yhhd944a15580c1
diff --git a/sdk/src/postprocess/sources/atmosphere.ts b/sdk/src/postprocess/sources/atmosphere.tsindex e7b45eb55..6b73cf20e 100644--- a/sdk/src/postprocess/sources/atmosphere.ts+++ b/sdk/src/postprocess/sources/atmosphere.ts@@ -689,9 +689,9 @@ float cloudLight(vec3 world, float camY, vec3 sun, vec3 drift) {return 1.0 - u_cloudShade * (1.0 - exp(-tau));}-/// The height of a point above the ground the fog lies on: world Y on a flat world, the distance above the sphere's surface on a planet.+/// The height of a point above the ground the fog lies on: world Y on a flat world, the distance above the sphere's surface on a planet (never below it: inside the planet the fog is the ground's, not an exponential of a depth).float fogAltitude(vec3 p) {- return u_planetRadius > 0.0 ? length(p - vec3(u_planetX, u_planetY, u_planetZ)) - u_planetRadius : p.y;+ return u_planetRadius > 0.0 ? max(length(p - vec3(u_planetX, u_planetY, u_planetZ)) - u_planetRadius, 0.0) : p.y;}/// What the exponential density integrates to along a ray: the eye's density, the length,/// and the term for how fast the ray leaves the fog. Written so a level ray (no climb)@@ -838,7 +838,7 @@ fn cloudLight(world : vec3f, camY : f32, sun : vec3f, drift : vec3f) -> f32 {}fn fogAltitude(p : vec3f) -> f32 {- if (mc.u_planetRadius > 0.0) { return length(p - vec3f(mc.u_planetX, mc.u_planetY, mc.u_planetZ)) - mc.u_planetRadius; }+ if (mc.u_planetRadius > 0.0) { return max(length(p - vec3f(mc.u_planetX, mc.u_planetY, mc.u_planetZ)) - mc.u_planetRadius, 0.0); }return p.y;}fn opticalDepth(eyeY : f32, dirY : f32, len : f32) -> f32 {diff --git a/sdk/src/terrain/planetPlugin.ts b/sdk/src/terrain/planetPlugin.tsindex 9977f1be0..b9ef04ebf 100644--- a/sdk/src/terrain/planetPlugin.ts+++ b/sdk/src/terrain/planetPlugin.ts@@ -20,7 +20,7 @@ import {} from '../ecs/component';import { Assets } from '../asset/AssetPlugin';import type { MaterialShaderSource } from '../asset/loaders/MaterialShaderAssetLoader';-import { Material, MATERIAL_FORMAT_VERSION } from '../render/material';+import { CullMode, Material, MATERIAL_FORMAT_VERSION } from '../render/material';import { BlendMode } from '../render/blend';import { createTextureFromPixels, updateTextureSubregion } from '../runtime/runtimeAssets';import { getResourceManager, provideTextureContent, withdrawTextureContent } from '../wasm/resourceManager';@@ -213,7 +213,7 @@ export class PlanetPlugin implements Plugin {if (this.stock_) return this.stock_;this.stock_ = Material.createFromAsset({version: MATERIAL_FORMAT_VERSION, type: 'material', shader: 'builtin:planet', blendMode: BlendMode.None,- depthTest: true, depthWrite: true, cull: 0, properties: {},+ depthTest: true, depthWrite: true, cull: CullMode.Back, properties: {},}, shader);return this.stock_;}diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex cb1cb53b1..18e51e41f 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -2916,6 +2916,8 @@ export const NOTED = {{"note":"The editor's own eye shows the scene's post-processing."},"feat(terrain): the maths of ground on a cube sphere and the nodes drawn round an eye":{"internal":"The first layer of spherical terrain: pure maths and node selection, not yet drawn."},+ "fix(terrain): a planet's ground is one-sided and its fog is the ground's under it":+ {"internal":"A fix to the Planet and height fog of this release."},"feat(postprocess): height fog by height above a planet's sphere":{"note":"Height Fog by height above a planet."},"feat(terrain): a Planet component draws ground on a sphere from a provider that answers by direction":