fix(lighting): port ACME lighting constants replacing guessed values
Replace guessed sun direction (0.5, 0.4, 0.6) with ACME's verified value (0.5, 0.3, -0.3) from GameScene.cs:238. Replace hardcoded ambient/diffuse (0.25/0.75) with ACME's ambient intensity 0.45 from LandscapeEditorSettings.cs:108. Terrain shaders now match ACME Landscape.vert/frag pattern: - Vertex shader computes Lambert term with xLightDirection uniform - Fragment shader applies: color * (clamp(lambert, 0, 1) + xAmbient) Static object shader matches ACME StaticObject.vert: - LightingFactor = max(dot(N, -L), 0) + ambient - Removed separate uDiffuseIntensity (ACME doesn't have one) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1b3387f991
commit
31d3a4678f
5 changed files with 31 additions and 27 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
in vec2 vBaseUV;
|
||||
in vec3 vWorldNormal;
|
||||
in float vLightingFactor;
|
||||
in vec4 vOverlay0;
|
||||
in vec4 vOverlay1;
|
||||
in vec4 vOverlay2;
|
||||
|
|
@ -17,11 +18,7 @@ out vec4 fragColor;
|
|||
|
||||
uniform sampler2DArray uTerrain; // 33+ layers — TerrainAtlas.GlTexture
|
||||
uniform sampler2DArray uAlpha; // 8+ layers — TerrainAtlas.GlAlphaTexture
|
||||
|
||||
// Phase 3a lighting (in sync with mesh.frag — update both together).
|
||||
const vec3 SUN_DIR = normalize(vec3(0.5, 0.4, 0.6));
|
||||
const float AMBIENT = 0.25;
|
||||
const float DIFFUSE = 0.75;
|
||||
uniform float xAmbient; // ambient intensity (matching ACME Landscape.frag)
|
||||
|
||||
// Per-texture tiling repeat count across a cell. WorldBuilder uses
|
||||
// uTexTiling[36] uploaded from the dats; we default to 1.0 (one tile per
|
||||
|
|
@ -118,10 +115,9 @@ void main() {
|
|||
vec3 roadMasked = roads.rgb * roads.a;
|
||||
vec3 rgb = clamp(baseMasked + ovlMasked + roadMasked, 0.0, 1.0);
|
||||
|
||||
// Phase 3a/3b directional lighting (in sync with mesh.frag constants).
|
||||
vec3 N = normalize(vWorldNormal);
|
||||
float ndotl = max(dot(N, SUN_DIR), 0.0);
|
||||
float lighting = AMBIENT + DIFFUSE * ndotl;
|
||||
// Lighting matching ACME Landscape.frag:
|
||||
// litColor = finalColor * (saturate(vLightingFactor) + xAmbient);
|
||||
vec3 litColor = rgb * (clamp(vLightingFactor, 0.0, 1.0) + xAmbient);
|
||||
|
||||
fragColor = vec4(rgb * lighting, 1.0);
|
||||
fragColor = vec4(litColor, 1.0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue