From 6ea5ede531133c4686d352c5af52cf000af6e21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Mon, 12 Jun 2023 17:48:30 +0200 Subject: [PATCH 1/5] Fixed light visual in OGRE (#862) (#864) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- ogre/src/OgreLightVisual.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/ogre/src/OgreLightVisual.cc b/ogre/src/OgreLightVisual.cc index cfc5420c8..e8c96ce1f 100644 --- a/ogre/src/OgreLightVisual.cc +++ b/ogre/src/OgreLightVisual.cc @@ -86,7 +86,6 @@ void OgreLightVisual::CreateVisual() this->dataPtr->line->AddPoint(p.X(), p.Y(), p.Z()); } this->dataPtr->line->Update(); - this->ogreNode->setVisible(true); } ////////////////////////////////////////////////// From c2c5fdfb889f449a0c7665dc492ee6b67591cadd Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 1 Sep 2023 15:43:40 -0500 Subject: [PATCH 2/5] Prepare for 6.6.1 Release (#891) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 +- Changelog.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb9ad0b01..a6b6c445a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(ignition-rendering6 VERSION 6.6.0) +project(ignition-rendering6 VERSION 6.6.1) #============================================================================ # Find ignition-cmake diff --git a/Changelog.md b/Changelog.md index 66ad38d68..1a34984b5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,28 @@ ## Ignition Rendering +### Ignition Rendering 6.6.1 (2023-09-01) + +1. Fixed light visual in OGRE + * [Pull request #864](https://github.com/gazebosim/gz-rendering/pull/864) + +1. Lower severity level for ogre2 visibility mask msgs and unavailable render passes + * [Pull request #830](https://github.com/gazebosim/gz-rendering/pull/830) + +1. Infrastructure + * [Pull request #834](https://github.com/gazebosim/gz-rendering/pull/834) + +1. Rename COPYING to LICENSE + * [Pull request #833](https://github.com/gazebosim/gz-rendering/pull/833) + +1. Add message to see troubleshooting page when render engine fails to create dummy window + * [Pull request #829](https://github.com/gazebosim/gz-rendering/pull/829) + +1. Tweak max camera position limit + * [Pull request #827](https://github.com/gazebosim/gz-rendering/pull/827) + +1. Limit max camera position vector length + * [Pull request #824](https://github.com/gazebosim/gz-rendering/pull/824) + ### Ignition Rendering 6.6.0 (2023-02-02) 1. Backport Composite BaseVisual destroy fix to 6 From 938589795431581ad598a14313d1be3091a7d1a1 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 5 Sep 2023 12:00:57 -0700 Subject: [PATCH 3/5] Revert mesh viewer background color back to gray (#894) Signed-off-by: Ian Chen --- examples/mesh_viewer/Main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mesh_viewer/Main.cc b/examples/mesh_viewer/Main.cc index a496ac1f9..6df706243 100644 --- a/examples/mesh_viewer/Main.cc +++ b/examples/mesh_viewer/Main.cc @@ -45,7 +45,7 @@ void buildScene(ScenePtr _scene) { // initialize _scene _scene->SetAmbientLight(0.3, 0.3, 0.3); - _scene->SetBackgroundColor(0.0, 0.0, 0.3); + _scene->SetBackgroundColor(0.3, 0.3, 0.3); VisualPtr root = _scene->RootVisual(); // create directional light From b6f5d22a88ea520433a0ecaed1c9d0f76a709b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Fri, 22 Sep 2023 19:53:24 +0200 Subject: [PATCH 4/5] [backport fortress] Calculate camera intrinsics : Refactor (#905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Calculate camera intrinsics : Refactor https://github.com/gazebosim/gz-rendering/pull/700 (#755) Signed-off-by: Alejandro Hernández Cordero --------- Signed-off-by: Alejandro Hernández Cordero Co-authored-by: Aditya Pande --- include/gz/rendering/Utils.hh | 14 ++++++ src/Camera_TEST.cc | 86 +++++++++++++++++++++++++++++++++++ src/Utils.cc | 19 ++++++++ 3 files changed, 119 insertions(+) diff --git a/include/gz/rendering/Utils.hh b/include/gz/rendering/Utils.hh index cc552d4d1..82db726fe 100644 --- a/include/gz/rendering/Utils.hh +++ b/include/gz/rendering/Utils.hh @@ -97,6 +97,20 @@ namespace ignition ignition::math::AxisAlignedBox transformAxisAlignedBox( const ignition::math::AxisAlignedBox &_box, const ignition::math::Pose3d &_pose); + + /// \brief Convert a given camera projection matrix + /// to an intrinsics matrix. Intrinsics matrix is different + /// from the matrix returned by Camera::ProjectionMatrix(), + /// which is used by OpenGL internally. + /// The matrix returned contains the camera calibrated values. + /// \param[in] _projectionMatrix Camera's projection matrix. + /// \param[in] _width Camera's image width. + /// \param[in] _height Camera's image height. + /// \return Camera's intrinsic matrix. + IGNITION_RENDERING_VISIBLE + ignition::math::Matrix3d projectionToCameraIntrinsic( + const ignition::math::Matrix4d &_projectionMatrix, + double _width, double _height); } } } diff --git a/src/Camera_TEST.cc b/src/Camera_TEST.cc index ae2190f67..262f41a86 100644 --- a/src/Camera_TEST.cc +++ b/src/Camera_TEST.cc @@ -26,6 +26,7 @@ #include "gz/rendering/RenderingIface.hh" #include "gz/rendering/RenderPassSystem.hh" #include "gz/rendering/Scene.hh" +#include "gz/rendering/Utils.hh" using namespace gz; using namespace rendering; @@ -47,6 +48,9 @@ class CameraTest : public testing::Test, /// \brief Test setting visibility mask public: void VisibilityMask(const std::string &_renderEngine); + + /// \brief Test setting intrinsic matrix + public: void IntrinsicMatrix(const std::string &_renderEngine); }; ///////////////////////////////////////////////// @@ -365,6 +369,82 @@ void CameraTest::VisibilityMask(const std::string &_renderEngine) rendering::unloadEngine(engine->Name()); } +///////////////////////////////////////////////// +void CameraTest::IntrinsicMatrix(const std::string &_renderEngine) +{ + // create and populate scene + RenderEngine *engine = rendering::engine(_renderEngine); + if (!engine) + { + igndbg << "Engine '" << _renderEngine + << "' is not supported" << std::endl; + return; + } + + ScenePtr scene = engine->CreateScene("scene"); + ASSERT_NE(nullptr, scene); + + CameraPtr camera = scene->CreateCamera(); + EXPECT_TRUE(camera != nullptr); + + unsigned int width = 320; + unsigned int height = 240; + double hfov = 1.047; + + camera->SetImageHeight(height); + camera->SetImageWidth(width); + camera->SetHFOV(hfov); + + double error = 1e-1; + EXPECT_EQ(camera->ImageHeight(), height); + EXPECT_EQ(camera->ImageWidth(), width); + EXPECT_NEAR(camera->HFOV().Radian(), hfov, error); + + // Verify focal length and optical center from intrinsics + auto cameraIntrinsics = projectionToCameraIntrinsic( + camera->ProjectionMatrix(), + camera->ImageWidth(), + camera->ImageHeight() + ); + EXPECT_NEAR(cameraIntrinsics(0, 0), 277.1913, error); + EXPECT_NEAR(cameraIntrinsics(1, 1), 277.1913, error); + EXPECT_DOUBLE_EQ(cameraIntrinsics(0, 2), 160); + EXPECT_DOUBLE_EQ(cameraIntrinsics(1, 2), 120); + + // Verify rest of the intrinsics + EXPECT_EQ(cameraIntrinsics(0, 1), 0); + EXPECT_EQ(cameraIntrinsics(1, 0), 0); + EXPECT_EQ(cameraIntrinsics(0, 1), 0); + EXPECT_EQ(cameraIntrinsics(2, 0), 0); + EXPECT_EQ(cameraIntrinsics(2, 1), 0); + EXPECT_EQ(cameraIntrinsics(2, 2), 1); + + // Verify that changing camera size changes intrinsics + height = 1000; + width = 1000; + camera->SetImageHeight(height); + camera->SetImageWidth(width); + camera->SetHFOV(hfov); + + EXPECT_EQ(camera->ImageHeight(), height); + EXPECT_EQ(camera->ImageWidth(), width); + EXPECT_NEAR(camera->HFOV().Radian(), hfov, error); + + // Verify if intrinsics have changed + cameraIntrinsics = projectionToCameraIntrinsic( + camera->ProjectionMatrix(), + camera->ImageWidth(), + camera->ImageHeight() + ); + EXPECT_NEAR(cameraIntrinsics(0, 0), 866.223, error); + EXPECT_NEAR(cameraIntrinsics(1, 1), 866.223, error); + EXPECT_DOUBLE_EQ(cameraIntrinsics(0, 2), 500); + EXPECT_DOUBLE_EQ(cameraIntrinsics(1, 2), 500); + + // Clean up + engine->DestroyScene(scene); +} + ///////////////////////////////////////////////// TEST_P(CameraTest, ViewProjectionMatrix) { @@ -395,6 +475,12 @@ TEST_P(CameraTest, VisibilityMask) VisibilityMask(GetParam()); } +///////////////////////////////////////////////// +TEST_P(CameraTest, IntrinsicMatrix) +{ + IntrinsicMatrix(GetParam()); +} + INSTANTIATE_TEST_CASE_P(Camera, CameraTest, RENDER_ENGINE_VALUES, PrintToStringParam()); diff --git a/src/Utils.cc b/src/Utils.cc index 39154dd29..eabeeb64d 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -163,6 +163,25 @@ float screenScalingFactor() return ratio; } +///////////////////////////////////////////////// +ignition::math::Matrix3d projectionToCameraIntrinsic( + const gz::math::Matrix4d &_projectionMatrix, + double _width, double _height) +{ + // Extracting the intrinsic matrix : + // https://ogrecave.github.io/ogre/api/13/class_ogre_1_1_math.html + double fX = (_projectionMatrix(0, 0) * _width) / 2.0; + double fY = (_projectionMatrix(1, 1) * _height) / 2.0; + double cX = (-1.0 * _width * + (_projectionMatrix(0, 2) - 1.0)) / 2.0; + double cY = _height + (_height * + (_projectionMatrix(1, 2) - 1)) / 2.0; + + return gz::math::Matrix3d(fX, 0, cX, + 0, fY, cY, + 0, 0, 1); +} + ///////////////////////////////////////////////// ignition::math::AxisAlignedBox transformAxisAlignedBox( const ignition::math::AxisAlignedBox &_bbox, From 61bf635a5b6daf4918f37f837d0a5076adc5c879 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 26 Sep 2023 17:09:14 -0500 Subject: [PATCH 5/5] Prepare for 7.4.2 release (#922) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 +- Changelog.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99bbb7820..24b014b70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(gz-rendering7 VERSION 7.4.1) +project(gz-rendering7 VERSION 7.4.2) #============================================================================ # Find gz-cmake diff --git a/Changelog.md b/Changelog.md index d89b95a5a..b78dea8bd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,21 @@ ### Gazebo Rendering 7.X +### Gazebo Rendering 7.4.2 (2023-09-26) + +1. ogre2: use CMAKE_INSTALL_RPATH + * [Pull request #909](https://github.com/gazebosim/gz-rendering/pull/909) + +1. Disable setting color range in particle emitter + * [Pull request #903](https://github.com/gazebosim/gz-rendering/pull/903) + +1. Documentation updates + * [Pull request #892](https://github.com/gazebosim/gz-rendering/pull/892) + * [Pull request #896](https://github.com/gazebosim/gz-rendering/pull/896) + +1. Revert mesh viewer background color back to gray + * [Pull request #894](https://github.com/gazebosim/gz-rendering/pull/894) + ### Gazebo Rendering 7.4.1 (2023-08-17) 1. Infrastructure