From d4f8e4f12897fab4e9abdc544385c2039ac8b6fe Mon Sep 17 00:00:00 2001 From: xuzhijie Date: Tue, 12 May 2026 10:14:02 +0800 Subject: [PATCH] Improve rim light prompt with specific position and color Replace vague "visible rim light around the subject" with explicit position description based on rimLightPosition (behind/beside/front, left/right/center, above/below) and include the main light color. --- src/utils/__tests__/lighting.test.ts | 2 +- src/utils/lighting.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/__tests__/lighting.test.ts b/src/utils/__tests__/lighting.test.ts index 28ec177c..0a922db5 100644 --- a/src/utils/__tests__/lighting.test.ts +++ b/src/utils/__tests__/lighting.test.ts @@ -26,7 +26,7 @@ describe("lighting utilities", () => { expect(prompt).toContain("#ffcc88"); expect(prompt).toContain("x=-0.58"); expect(prompt).toContain("-45 degree beam angle"); - expect(prompt).toContain("visible rim light"); + expect(prompt).toContain("add a second rim light source directly behind the subject"); expect(prompt).toContain("rim light source vector x=0.00"); expect(prompt).toContain("z=-1.00"); expect(prompt).toContain("soft cinematic glow"); diff --git a/src/utils/lighting.ts b/src/utils/lighting.ts index 95bcc05e..3a4c15ac 100644 --- a/src/utils/lighting.ts +++ b/src/utils/lighting.ts @@ -283,9 +283,13 @@ export function buildLightingPrompt(settings?: LightingSettings | null): string ]; if (lighting.rimLight) { + const rimPos = lighting.rimLightPosition ?? DEFAULT_LIGHTING_SETTINGS.rimLightPosition; + const rimHoriz = rimPos.x <= -0.25 ? "camera-left" : rimPos.x >= 0.25 ? "camera-right" : "centered"; + const rimVert = rimPos.y <= -0.25 ? "above" : rimPos.y >= 0.25 ? "below" : "at subject level"; + const rimDepth = rimPos.z <= -0.25 ? "directly behind" : rimPos.z >= 0.25 ? "in front of" : "beside"; parts.push( - "visible rim light around the subject", - positionInstruction(lighting.rimLightPosition ?? DEFAULT_LIGHTING_SETTINGS.rimLightPosition, "rim light source") + `add a second rim light source ${rimDepth} the subject, ${rimHoriz}, ${rimVert}, same color as the main light (${lighting.color})`, + positionInstruction(rimPos, "rim light source") ); }