Skip to content

[Bug]: Inline screenshot preview is washed out when downscaled (linear values re-encoded as sRGB) #1328

Description

@SunstriderEx

What happened?

When manage_camera(action="screenshot", include_image=true) has to downscale the preview (i.e. max_resolution is lower than the Game View resolution), the returned inline image comes back visibly washed out – dark surfaces are lifted by roughly a gamma step. The PNG written to disk is correct; only the inline copy is affected.

The numbers match a linear→sRGB double-conversion: a UI color of rgb(11,16,21) arrives as ≈rgb(60,72,80), and 1.055 * (11/255)^(1/2.4) - 0.055 ≈ 0.23660. So it looks like the resize path treats already-encoded sRGB bytes as linear (or resizes in linear and never converts back).

This is not cosmetic for agent workflows: an LLM client judging UI colors from the inline preview will "fix" colors that were never broken. In our case the map fog ended up twice as saturated as the design before we caught it.

Reproduction steps

Project: URP, color space = Linear, Game View 1920×1080.

  1. Display any dark UI (ours is a UI Toolkit screen whose background is rgb(11,16,21)).
  2. manage_camera(action="screenshot", include_image=true, max_resolution=1920) – inline preview is correct (no resize needed).
  3. manage_camera(action="screenshot", include_image=true, max_resolution=900) – inline preview is washed out, same frame.
  4. Open either saved PNG and sample the same pixel – both files are correct:
Add-Type -AssemblyName System.Drawing
$bmp = [System.Drawing.Bitmap]::FromFile("Assets/Screenshots/gamma-test-scaled.png")
$bmp.GetPixel([int]($bmp.Width*0.55), [int]($bmp.Height*0.45))   # => R=11 G=16 B=21

Expected

The inline preview should be colorimetrically identical to the saved PNG regardless of max_resolution.

Actual

Downscaled inline previews are lifted by a gamma step; native-resolution previews are fine, and files on disk are always fine.

Notes

Unity version

6000.5.8f1

MCP for Unity package version

10.1.2

Python server version

No response

MCP client

Claude Desktop

Transport

stdio

OS

Windows

Checks

  • I searched existing issues and did not find a duplicate
  • I included logs / steps to reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions