Browse Source

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.
TEST-x
xuzhijie 2 months ago
parent
commit
d4f8e4f128
  1. 2
      src/utils/__tests__/lighting.test.ts
  2. 8
      src/utils/lighting.ts

2
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");

8
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")
);
}

Loading…
Cancel
Save