Image checksumming and visual regression

These helpers exist for autotesting. They compare or persist perceptual hashes of the rendered scene.

Function Returns Description
GetVisibleInputChecksumString(ignoreLivePreview) string Computes an MD5 checksum (as upper-case hex) over the concatenated GUIDs of all inputs that are currently being rendered. When ignoreLivePreview is true, internal live-preview scenes are excluded from the set. Returns an empty string if there are no visible inputs.
CompareImageReference() float Compares the current rendered frame against the reference image for this project. Returns the percentage of differing pixels (0-100), or -1 if no reference image exists or an error occurred. Designed for polling from OnRenderFrame in test scripts.
GetImageChecksum() string Computes a perceptual hash (checksum) of the current rendered frame from the topmost scene. Returns a 16-character hex string representing a 64-bit hash that is tolerant of minor pixel-level differences — visually similar frames produce the same hash. Returns an empty string if no frame is available or an error occurs.
GetImageChecksum(sceneName) string Computes a perceptual hash (checksum) of the current rendered frame from the specified scene. Returns a 16-character hex string representing a 64-bit hash that is tolerant of minor pixel-level differences — visually similar frames produce the same hash. Returns an empty string if no frame is available or an error occurs.
CompareOrStoreImageChecksum(sceneName, stepName) bool Compares or stores a perceptual image checksum for a named step. The checksums are persisted in a JSON file alongside the project file, named -step-img-checksum.json. The file contains a flat object mapping step names to checksum hex strings. - If the step does not exist in the file, the current checksum is stored and the method returns true. - If the step already exists, the current checksum is compared with the stored value. Returns true on match, false on mismatch.
function OnRenderFrame() {
    if (frameCount == 30 && !Project.CompareOrStoreImageChecksum(null, "after-intro"))
        Logger.Error("Visual regression at after-intro");
}