Skip to content

gz-rotary-rendering: drop freeimage - #3394

Merged
scpeters merged 9 commits into
masterfrom
scpeters/rotary_no_freeimage
Apr 15, 2026
Merged

gz-rotary-rendering: drop freeimage#3394
scpeters merged 9 commits into
masterfrom
scpeters/rotary_no_freeimage

Conversation

@scpeters

@scpeters scpeters commented Mar 20, 2026

Copy link
Copy Markdown
Member
  • Switch from ogre2.3 to gz-rotary-ogre2.3-vendor
  • Drop ogre1.9

Part of #3298.

scpeters and others added 5 commits March 20, 2026 10:22
Adds a new formula for use in rotary based on the 2.3.3 tag
and three patches for stb support so that the freeimage
dependency can be removed.

Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
* Switch from ogre2.3 to gz-rotary-ogre2.3-vendor
* Drop ogre1.9

Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
@scpeters
scpeters force-pushed the scpeters/rotary_no_freeimage branch from c55b132 to 0ea1b70 Compare March 20, 2026 23:30
@scpeters

Copy link
Copy Markdown
Member Author

I see some differences when loading the fuel_textured_mesh.sdf example world in Jetty vs Rotary:

Jetty

Screenshot 2026-03-20 at 5 00 27 PM

Rotary

Screenshot 2026-03-20 at 4 34 21 PM

Base automatically changed from scpeters/rotary_ogre2.3 to master March 26, 2026 22:08
@wentasah

wentasah commented Apr 8, 2026

Copy link
Copy Markdown

I confirm that I see the same color swap in our Nix environment with the same patches as in gz-rotary-ogre2.3-vendor. I think the fix will be trivial, but I'll not find time for it before this weekend.

taylorhoward92 added a commit to taylorhoward92/ogre-next that referenced this pull request Apr 9, 2026
stb_image always returns pixel data in RGB byte order, but the
variable names in the 3-component conversion loop (b, g, r) assume
BGR order. The code then writes r, g, b — which actually outputs
B, G, R — into a buffer declared as PFG_RGBA8_UNORM (R first),
swapping the red and blue channels.

Fix by writing b, g, r (preserving stb's native RGB order), which
matches the correct behaviour already present on master (v3-0).

The visual effect of this bug is that all 3-channel RGB textures
rendered through the STB codec have red and blue swapped (e.g. brown
skin appears blue, lime-green appears teal). See the screenshots in
osrf/homebrew-simulation#3394 (comment 4101535199) for an example.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@taylorhoward92

Copy link
Copy Markdown

There is an issue with RGB-to-RGBA conversion in ogre-next v2.3 when using STB. I've created OGRECave/ogre-next#567 to fix the issue and have tested locally.

Without the fix:
Without RGB Patch

With the fix:
With RGB Patch

@scpeters

scpeters commented Apr 9, 2026

Copy link
Copy Markdown
Member Author

There is an issue with RGB-to-RGBA conversion in ogre-next v2.3 when using STB. I've created OGRECave/ogre-next#567 to fix the issue and have tested locally.

thanks! I've approved the upstream PR and am adding the patch to gz-rotary-ogre2.3-vendor in #3408

@scpeters
scpeters marked this pull request as ready for review April 10, 2026 01:18
@scpeters

Copy link
Copy Markdown
Member Author

thanks! I've approved the upstream PR and am adding the patch to gz-rotary-ogre2.3-vendor in #3408

I added the patch to gz-rotary-ogre2.3-vendor in #3408 and marked this ready for review

@taylorhoward92 taylorhoward92 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.

LGTM

@scpeters

Copy link
Copy Markdown
Member Author

we agreed at Monday's Gazebo meeting to fully drop freeimage on macOS on the main branch by dropping support for ogre 1.9

so I think we are ready to merge this. I will wait a few hours in case any Gazebo maintainers want to officially mark their approval

@azeey azeey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

However, I noticed that gz-rotary-ogre2.3-vendor depends on gz-jetty-plugin

depends_on "gz-jetty-plugin" => :test

Is that intentional?

Also, if freeimage is going to be dropped altogether, shouldn't we be patching the ogre2.3 formula itself instead of creating gz-rotary-ogre2.3?

@scpeters

Copy link
Copy Markdown
Member Author

I'll answer these in reverse order

Also, if freeimage is going to be dropped altogether, shouldn't we be patching the ogre2.3 formula itself instead of creating gz-rotary-ogre2.3?

I created the gz-rotary-ogre2.3-vendor formula so that we could experiment with an alternative ogre build without affecting existing stable releases like Jetty. Hopefully we can backport support for STB to Jetty and update the ogre2.3 formula and drop gz-rotary-ogre2.3-vendor (at least until we want to test updates to the ogre formula)

However, I noticed that gz-rotary-ogre2.3-vendor depends on gz-jetty-plugin

depends_on "gz-jetty-plugin" => :test

Is that intentional?

yes it does currently declare a test dependency on gz-jetty-plugin, and it is intentional because I want gz-rotary-ogre2.3-vendor to be bottled, which requires all dependencies (even test dependencies) to be bottled

more context:

  • I especially want gz-rotary-ogre2.3-vendor to be vendored because ogre will opportunistically find freeimage if you have it installed on your system, which I experienced with local testing. Bottles are built in a controlled environment, which ensures that it is truly built without freeimage
  • We started using gz-plugin in the ogre2.3 in formula test to confirm that rpath was properly configured (see 9fb0d08). When adding gz-rotary-ogre2.3-vendor in gz-rotary-ogre2.3-vendor: 2.3.3 with stb patches #3391, I initially built the bottles while depending on gz-plugin2 and then switched to gz-rotary-plugin in f21fe4d after the bottles were built. When adding another patch to ogre2.3 in gz-rotary-ogre2.3-vendor: patch RGB channel swap #3408 to fix the color swapping, my initial attempt to rebuild the bottles failed since gz-rotary-plugin is not bottled, so I switched back to gz-jetty-plugin and just left it in place. As a test dependency it doesn't get installed unless you explicitly brew install --include-test gz-rotary-ogre2.3-vendor. If we really don't like it, we can switch it back to gz-rotary-plugin, but I think it doesn't hurt anything so I left it in place

@azeey

azeey commented Apr 15, 2026

Copy link
Copy Markdown
Member

Makes sense. Thanks for the explanation!

@scpeters
scpeters merged commit 0d74d00 into master Apr 15, 2026
1 check passed
@scpeters
scpeters deleted the scpeters/rotary_no_freeimage branch April 15, 2026 21:39
darksylinc pushed a commit to OGRECave/ogre-next that referenced this pull request May 6, 2026
stb_image always returns pixel data in RGB byte order, but the
variable names in the 3-component conversion loop (b, g, r) assume
BGR order. The code then writes r, g, b — which actually outputs
B, G, R — into a buffer declared as PFG_RGBA8_UNORM (R first),
swapping the red and blue channels.

Fix by writing b, g, r (preserving stb's native RGB order), which
matches the correct behaviour already present on master (v3-0).

The visual effect of this bug is that all 3-channel RGB textures
rendered through the STB codec have red and blue swapped (e.g. brown
skin appears blue, lime-green appears teal). See the screenshots in
osrf/homebrew-simulation#3394 (comment 4101535199) for an example.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

5 participants