Skip to content

fix(flame_3d): Remove duplicate baseColor multiply in ambient calculation#3814

Merged
spydon merged 1 commit intoflame-engine:mainfrom
agnath18K:fix/flame_3d-ambient-double-basecolor
Feb 15, 2026
Merged

fix(flame_3d): Remove duplicate baseColor multiply in ambient calculation#3814
spydon merged 1 commit intoflame-engine:mainfrom
agnath18K:fix/flame_3d-ambient-double-basecolor

Conversation

@agnath18K
Copy link
Contributor

Description

Fixes #3813

The ambient calculation in spatial_material.frag multiplies baseColor twice:

vec3 baseAmbient = vec3(0.03) * baseColor * ...;  // already has baseColor
vec3 ambient = baseAmbient * baseColor * ao;       // multiplied again

This produces ambient ∝ baseColor² instead of baseColor. Dark surfaces get disproportionately crushed under ambient light — a non-linear distortion that diverges from the LearnOpenGL PBR reference cited in the shader header.

Removed the extra * baseColor on the second line. Recompiled shaderbundle.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Shader math correction — not feasible to unit test without a GPU context.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

@spydon spydon merged commit 080bde7 into flame-engine:main Feb 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flame_3d] Ambient term applies baseColor twice in fragment shader

2 participants

Comments