diff --git a/Migration.md b/Migration.md index 701ae444c4..ab87e91c01 100644 --- a/Migration.md +++ b/Migration.md @@ -5,6 +5,13 @@ Deprecated code produces compile-time warnings. These warning serve as notification to users that their code should be upgraded. The next major release will remove the deprecated code. +## Ignition Gazebo 4.0.0 to 4.X.X + +* Ignition Gazebo 4.0.0 enabled double sided material by default but this +caused shadow artifacts to appear on some meshes. Double sided material is +now disabled and made an opt-in feature. Users can configure this property +in SDF by setting the `` SDF element. + ## Ignition Gazebo 3.x to 4.x * The `RenderUtil::SetEnabledSensors` callback in gazebo rendering has a new diff --git a/examples/worlds/tunnel.sdf b/examples/worlds/tunnel.sdf index 484c80ea67..796d77fd7b 100644 --- a/examples/worlds/tunnel.sdf +++ b/examples/worlds/tunnel.sdf @@ -1,6 +1,11 @@ @@ -16,10 +21,149 @@ false + + + + + + 3D View + false + docked + + + ogre2 + scene + 0.4 0.4 0.4 + 0.8 0.8 0.8 + -6 0 6 0 0.5 0 + + + + + + World control + false + false + 72 + 121 + 1 + + floating + + + + + + + true + true + true + + + + + + + World stats + false + false + 110 + 290 + 1 + + floating + + + + + + + true + true + true + true + + + + + + docked_collapsed + + + + + + + docked_collapsed + + + + + + Vehicle camera + docked + + camera + false + + + + + + Transform control + + + + + false + 230 + 50 + floating + false + #666666 + + + + + + + + + + + false + 200 + 50 + floating + false + #666666 + + + + + + + + + + false + 5 + 5 + floating + false + + + + + + ogre2 + @@ -29,21 +173,39 @@ name="ignition::gazebo::systems::SceneBroadcaster"> - true - BaseStation - 0 0 0 0 0 0 + staging_area + 0 0 -0.005 0 0 0 https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/subt_tunnel_staging_area - - artifact_origin - 2 4 0.5 0 0 0 - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Fiducial + 9.23 2.18 0 0 0 -1.226 + + https://fuel.ignitionrobotics.org/1.0/chapulina/models/Extinguisher PBR + + + 0 0 5 0 0 0 + + 6 + 0.2 + 0.1 + 0.0025 + + 0.8 0.8 0.5 1 + 0.8 0.8 0.5 1 + + 1 + 1.1 + 1 + + 0 0 -1 + 1 + + tile_0 @@ -896,16 +1058,593 @@ https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/Tunnel Tile 2 280.000000 -240.000000 -10.000000 0 0 3.141593 - - - x1 - https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/X1 UGV - 0 0 .2 0 0 0 - + + + + 0.002225 0.033355 0.022792 0 -0 0 + 111.0015 + + 4.49753 + 0.00199937 + -0.00152659 + 2.46329 + -0.424901 + 5.57714 + + + + 0.25 0 0.0480 0 0 0 + + + 0.6 0.55 0.428 + + + + + 0.38 0 0.4 0 0 0 + + + 0.28 0.28 0.4 + + + + + 0 0 0 0 1.5707 0 + + + 0.5 + 0.05 + + + + + 0.180 0 .24 0 0 -1.5707963267948966 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/meshes/r2.dae + + BodyFront +
true
+
+
+
+ + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Albedo.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Metalness.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Roughness.png + + + +
+ + 0.49 0 0.45 1.5707963267948966 1.5707963267948966 -1.5707963267948966 + + 50 + 0 + 0.1 + 0.0025 + + 0.8 0.8 0.5 1 + 0.8 0.8 0.5 1 + + 1 + 1.1 + 1 + + 0 -1 0 + 1 + + + 0.55 0 0.33 0 0 0 + + 1.047 + + 320 + 240 + + + 0.1 + 100 + + + 1 + 30 + true + camera + + + + -0.047625 0 -0.0254 1.5707963267948966 0 0 + + -0.191018 -0.006403 -0 0 -0 0 + 42.8393 + + 0.848992 + 0.00301842 + 5.21788e-06 + 1.03049 + 1.2171e-07 + 0.43679 + + + + -0.2 0.072 0 0 0 0 + + + 0.42 0.43 0.56 + + + + + -0.70 0.2855 0 -0.005 0 0 + + + 0.17 0.01 0.5 + + + + + -0.35 0.2855 -0.005 -0.005 0 0 + + + 0.678 0.01 0.69 + + + + + -0.428 0.068 0 -1.5707963267948966 -1.5707963267948966 0 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/meshes/r2.dae + + BodyRear +
true
+
+
+
+ + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Albedo.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Metalness.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Roughness.png + + + +
+ + + Rear_Rocker_Link + base_link + + -1 0 0 + + -0.5236 + 0.5236 + + + 10 + 0.1 + 0.1 + 100 + + 0 + + + + 0.33421 0.363 -0.091538 -0.013747 -0 -1.5707963267948966 + + 0.007124 -1.6e-05 4e-06 0 -0 0 + 11.5398 + + 0.127932 + 6.41777e-06 + 2.40271e-06 + 0.0695645 + 1.35439e-09 + 0.0695643 + + + + 0 0 0 3.1415926535897931 1.5707963267948966 3.1415926535897931 + + + 0.1125 + 0.31 + + + + + + 0.5 + 1 + 0 0 1 + 0.0000235 + 0 + 10 + 0.1 + + + + + 1e+07 + 0.0001 + + + + + + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/meshes/r2.dae + + WheelFL +
true
+
+
+
+ + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Albedo.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Metalness.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Roughness.png + + + +
+ + + left_front_wheel_link + base_link + + -1 0 0 + + -1e+16 + 1e+16 + + + 10 + 0.1 + 0 + 0 + + 0 + + + + -0.334625 0.363 -0.083399 -0.014389 0.000148 -1.5707963267948966 + + 0.007124 -1.6e-05 4e-06 0 -0 0 + 11.5398 + + 0.127932 + 6.41777e-06 + 2.40271e-06 + 0.0695645 + 1.35439e-09 + 0.0695643 + + + + 0 0 0 3.1415926535897931 1.5707963267948966 3.1415926535897931 + + + 0.1125 + 0.31 + + + + + + 0.5 + 1 + 0 0 1 + 0.0000235 + 0 + 10 + 0.1 + + + + + 1e+07 + 0.0001 + + + + + + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/meshes/r2.dae + + WheelBL +
true
+
+
+
+ + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Albedo.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Metalness.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Roughness.png + + + +
+ + + left_rear_wheel_link + Rear_Rocker_Link + + -1 0 0 + + -1e+16 + 1e+16 + + + 10 + 0.1 + 0 + 0 + + 0 + + + + 0.33421 -0.363 -0.091538 -0.013747 -0 1.5707963267948966 + + 0.007124 -1.6e-05 4e-06 0 -0 0 + 11.5398 + + 0.127932 + 6.41777e-06 + 2.40271e-06 + 0.0695645 + 1.35439e-09 + 0.0695643 + + + + 0 0 0 3.1415926535897931 1.5707963267948966 3.1415926535897931 + + + 0.1125 + 0.31 + + + + + + 0.5 + 1 + 0 0 1 + 0.0000235 + 0 + 10 + 0.1 + + + + + 1e+07 + 0.0001 + + + + + + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/meshes/r2.dae + + WheelFR +
true
+
+
+
+ + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Albedo.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Metalness.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Roughness.png + + + +
+ + + right_front_wheel_link + base_link + + 1 0 0 + + -1e+16 + 1e+16 + + + 10 + 0.1 + 0 + 0 + + 0 + + + + -0.334625 -0.363 -0.083401 -0.014389 -0.000148 1.5707963267948966 + + 0.007124 -1.6e-05 4e-06 0 -0 0 + 11.5398 + + 0.127932 + 6.41777e-06 + 2.40271e-06 + 0.0695645 + 1.35439e-09 + 0.0695643 + + + + 0 0 0 3.1415926535897931 1.5707963267948966 3.1415926535897931 + + + 0.1125 + 0.31 + + + + + + 0.5 + 1 + 0 0 1 + 0.0000235 + 0 + 10 + 0.1 + + + + + 1e+07 + 0.0001 + + + + + + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/meshes/r2.dae + + WheelBR +
true
+
+
+
+ + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Albedo.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Metalness.png + https://fuel.ignitionrobotics.org/1.0/OpenRobotics/models/EXPLORER_R2_SENSOR_CONFIG_2/3/files/materials/textures/R2_Roughness.png + + + +
+ + + right_rear_wheel_link + Rear_Rocker_Link + + 1 0 0 + + -1e+16 + 1e+16 + + + 10 + 0.1 + 0 + 0 + + 0 + + + + 0 0 0.38 0 0 0.0 + + + left_rear_wheel + left_front_wheel + right_rear_wheel + right_front_wheel + 1.25 + 0.3 + 1 + cmd_vel + + + + + + 87 + + + linear: {x: 2.0}, angular: {z: 0.0} + + + + + + + 88 + + + linear: {x: -2.0}, angular: {z: 0.0} + + + + + + + 68 + + + linear: {x: 0.0}, angular: {z: -0.5} + + + + + + + 65 + + + linear: {x: 0.0}, angular: {z: 0.5} + + + + + + + 83 + + + linear: {x: 0.0}, angular: {z: 0.0} + + + +
- x1 + vehicle 2 2 2 diff --git a/src/Conversions.cc b/src/Conversions.cc index cc2d685861..edbc024d77 100644 --- a/src/Conversions.cc +++ b/src/Conversions.cc @@ -264,6 +264,12 @@ msgs::Material ignition::gazebo::convert(const sdf::Material &_in) msgs::Set(out.mutable_emissive(), _in.Emissive()); out.set_lighting(_in.Lighting()); + // todo(anyone) add double_sided field to msgs::Material + auto data = out.mutable_header()->add_data(); + data->set_key("double_sided"); + std::string *value = data->add_value(); + *value = std::to_string(_in.DoubleSided()); + sdf::Pbr *pbr = _in.PbrMaterial(); if (pbr) { @@ -317,6 +323,14 @@ sdf::Material ignition::gazebo::convert(const msgs::Material &_in) out.SetEmissive(msgs::Convert(_in.emissive())); out.SetLighting(_in.lighting()); + // todo(anyone) add double_sided field to msgs::Material + for (int i = 0; i < _in.header().data_size(); ++i) + { + const auto &data = _in.header().data(i); + if (data.key() == "double_sided" && data.value_size() > 0) + out.SetDoubleSided(math::parseInt(data.value(0))); + } + if (_in.has_pbr()) { const auto &pbrMsg = _in.pbr(); diff --git a/src/Conversions_TEST.cc b/src/Conversions_TEST.cc index 8ce78db565..fe155e00a5 100644 --- a/src/Conversions_TEST.cc +++ b/src/Conversions_TEST.cc @@ -206,6 +206,9 @@ TEST(Conversions, Material) material.SetEmissive(ignition::math::Color(1.3f, 1.4f, 1.5f, 1.6f)); material.SetLighting(true); + // todo(anyone) add double_sided field to msgs::Material + material.SetDoubleSided(true); + sdf::Pbr pbr; sdf::PbrWorkflow workflow; workflow.SetType(sdf::PbrWorkflowType::METAL); @@ -235,6 +238,11 @@ TEST(Conversions, Material) msgs::Convert(materialMsg.emissive())); EXPECT_TRUE(materialMsg.lighting()); + // todo(anyone) double_sided is temporarily stored in header + // Need to add double_sided field to msgs::Material + bool doubleSided = math::parseInt(materialMsg.header().data(0).value(0)); + EXPECT_TRUE(doubleSided); + EXPECT_TRUE(materialMsg.has_pbr()); const auto &pbrMsg = materialMsg.pbr(); EXPECT_EQ(msgs::Material_PBR_WorkflowType_METAL, pbrMsg.type()); @@ -257,6 +265,7 @@ TEST(Conversions, Material) EXPECT_EQ(math::Color(0.9f, 1.0f, 1.1f, 1.2f), newMaterial.Ambient()); EXPECT_EQ(math::Color(1.3f, 1.4f, 1.5f, 1.6f), newMaterial.Emissive()); EXPECT_TRUE(newMaterial.Lighting()); + EXPECT_TRUE(newMaterial.DoubleSided()); sdf::Pbr *newPbrMaterial = newMaterial.PbrMaterial(); ASSERT_NE(nullptr, newPbrMaterial); diff --git a/src/rendering/SceneManager.cc b/src/rendering/SceneManager.cc index 6bfa86f924..54fb330aa9 100644 --- a/src/rendering/SceneManager.cc +++ b/src/rendering/SceneManager.cc @@ -492,7 +492,7 @@ rendering::MaterialPtr SceneManager::LoadMaterial( { material->SetTexture(fullPath); // Use alpha channel for transparency - material->SetAlphaFromTexture(true); + material->SetAlphaFromTexture(true, 0.5, _material.DoubleSided()); } else ignerr << "Unable to find file [" << albedoMap << "]\n";