Skip to content

feat(texture): multi-view bake consistency — seed lock, color match, seam feather#732

Merged
fernandotonon merged 2 commits into
masterfrom
feat/multiview-texture-consistency
Jun 17, 2026
Merged

feat(texture): multi-view bake consistency — seed lock, color match, seam feather#732
fernandotonon merged 2 commits into
masterfrom
feat/multiview-texture-consistency

Conversation

@fernandotonon

Copy link
Copy Markdown
Owner

Follow-up to the multi-view AI texture bake (#729). Makes the per-view images read as one coherent texture instead of independent diffusion runs, so front/back don't show a style/colour jump at the silhouette seam.

Changes

  • Seed lock: generateMeshTextureMultiView picks ONE positive seed and passes it to every view's generation, so all views share the same denoising trajectory (closest hue/lighting/style). SDManager::generateMeshTexture gains an optional seed arg (>=0 overrides the stored/random seed; -1 = unchanged) — the single-view path is unaffected.
  • Color match: MultiViewTextureBaker shifts each later view's per-channel mean to the FIRST view's mean before baking (Options::colorMatchToFirstView, default on). Mean is computed over non-background, non-near-white pixels; correction is a gentle additive shift (avoids the contrast over-stretch of a full mean+std match). Kills the global hue/brightness mismatch across the seam.
  • Wider seam feather: default Options::facingPower lowered 1.0 → 0.5 so front and back cross-fade over a band near the silhouette rather than switching hard.

Why seed+color+feather (not ref_images yet)

The literal "back uses front as context" is sd.cpp's reference-image path (ref_images[]). The field exists in the build but isn't wired, and its payoff depends on an empirical model test. This trio is the safe, high-leverage fix with zero sd.cpp risk; ref_images is scoped as a follow-up if style drift remains.

Testing

🤖 Generated with Claude Code

fernandotonon and others added 2 commits June 16, 2026 19:33
… seam feather

Makes the front/back (and any N) views of a multi-view bake look like one
coherent texture instead of independent diffusion runs.

- Seed lock: generateMeshTextureMultiView picks ONE positive seed and passes it
  to every view's generateMeshTexture, so all views share the same denoising
  trajectory (closest hue/lighting/style). SDManager::generateMeshTexture gains
  an optional `seed` arg (>=0 overrides the stored/random seed; -1 = unchanged).
- Color match: MultiViewTextureBaker shifts each later view image's per-channel
  mean to the FIRST view's mean before baking (Options::colorMatchToFirstView,
  default on), killing the global hue/brightness jump across the seam. Mean is
  computed over non-background pixels; correction is a gentle additive shift.
- Wider seam feather: default Options::facingPower lowered 1.0 → 0.5 so front
  and back cross-fade over a band near the silhouette rather than switching hard.

Unit test added for the color-match shift. Color-match math validated standalone
(dark back image mean lifted exactly to the front mean). App + UnitTests build
clean; SD-driven generation stays #ifdef-guarded.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fernandotonon, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 29 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19ab7cf5-a059-493b-ba15-4b21a1be5859

📥 Commits

Reviewing files that changed from the base of the PR and between 86678f1 and d74203f.

📒 Files selected for processing (6)
  • src/MaterialEditorQML.cpp
  • src/MultiViewTextureBaker.cpp
  • src/MultiViewTextureBaker.h
  • src/MultiViewTextureBaker_test.cpp
  • src/SDManager.cpp
  • src/SDManager.h
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/multiview-texture-consistency

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d74203f889

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

sr += qRed(c); sg += qGreen(c); sb += qBlue(c); ++count;
}
}
if (count == 0) return Ogre::Vector3(0.5f, 0.5f, 0.5f);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid defaulting valid white references to gray

When the first generated view is a legitimate near-white material (for example snow, white ceramic, or a white-painted mesh), the filter above can skip every sampled pixel as background, so this fallback makes the reference mean mid-gray. Because colorMatchToFirstView is now enabled by default, any later view with slightly darker white surface pixels will be shifted down toward gray, creating the same kind of cross-view brightness jump this feature is meant to remove; consider disabling matching when no foreground mean is found or using a better foreground mask.

Useful? React with 👍 / 👎.

@sonarqubecloud

Copy link
Copy Markdown

@fernandotonon fernandotonon merged commit c1cd80c into master Jun 17, 2026
21 checks passed
@fernandotonon fernandotonon deleted the feat/multiview-texture-consistency branch June 17, 2026 02:45
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.

1 participant