diff --git a/modules/ar/include/visp3/ar/vpPanda3DGeometryRenderer.h b/modules/ar/include/visp3/ar/vpPanda3DGeometryRenderer.h index 3bc3471089..358dee8697 100644 --- a/modules/ar/include/visp3/ar/vpPanda3DGeometryRenderer.h +++ b/modules/ar/include/visp3/ar/vpPanda3DGeometryRenderer.h @@ -46,7 +46,7 @@ * * This information may contain, depending on requested render type: * - * - Normals in the world frame or in the camera frame + * - Normals in the world frame or in the camera frame. * - Depth information */ class VISP_EXPORT vpPanda3DGeometryRenderer : public vpPanda3DBaseRenderer @@ -56,7 +56,7 @@ class VISP_EXPORT vpPanda3DGeometryRenderer : public vpPanda3DBaseRenderer enum vpRenderType { WORLD_NORMALS, //! Surface normals in world space. - CAMERA_NORMALS, //! Surface normals in the frame of the camera + CAMERA_NORMALS, //! Surface normals in the frame of the camera. Z points towards the camera and y is up. }; vpPanda3DGeometryRenderer(vpRenderType renderType); diff --git a/modules/ar/src/panda3d-simulator/vpPanda3DGeometryRenderer.cpp b/modules/ar/src/panda3d-simulator/vpPanda3DGeometryRenderer.cpp index 426e120e13..db506c402f 100644 --- a/modules/ar/src/panda3d-simulator/vpPanda3DGeometryRenderer.cpp +++ b/modules/ar/src/panda3d-simulator/vpPanda3DGeometryRenderer.cpp @@ -56,8 +56,8 @@ void main() gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex; // View space is Z-up right handed, flip z and y oNormal = p3d_NormalMatrix * normalize(p3d_Normal); - oNormal.yz = oNormal.zy; - oNormal.y = -oNormal.y; + // oNormal.yz = oNormal.zy; + // oNormal.y = -oNormal.y; vec4 cs_position = p3d_ModelViewMatrix * p3d_Vertex; distToCamera = -cs_position.z; } diff --git a/tutorial/ar/data/deformed_sphere.bam b/tutorial/ar/data/deformed_sphere.bam deleted file mode 100644 index 877858f8b6..0000000000 Binary files a/tutorial/ar/data/deformed_sphere.bam and /dev/null differ diff --git a/tutorial/ar/data/suzanne.bam b/tutorial/ar/data/suzanne.bam new file mode 100644 index 0000000000..79cf35730f Binary files /dev/null and b/tutorial/ar/data/suzanne.bam differ diff --git a/tutorial/ar/tutorial-panda3d-renderer.cpp b/tutorial/ar/tutorial-panda3d-renderer.cpp index e15b7b2ff8..c3469a2dfb 100644 --- a/tutorial/ar/tutorial-panda3d-renderer.cpp +++ b/tutorial/ar/tutorial-panda3d-renderer.cpp @@ -130,7 +130,6 @@ int main(int argc, const char **argv) "Show frames step by step."}, {"-canny", vpParseArgv::ARGV_CONSTANT_BOOL, (char *) nullptr, (char *)&showCanny, "Show frames step by step."}, - {"-debug", vpParseArgv::ARGV_CONSTANT_BOOL, (char *) nullptr, (char *)&debug, "Show Opengl/Panda3D debug message."}, {"-h", vpParseArgv::ARGV_HELP, (char *) nullptr, (char *) nullptr, @@ -150,7 +149,7 @@ int main(int argc, const char **argv) modelPath = modelPathCstr; } else { - modelPath = "data/deformed_sphere.bam"; + modelPath = "data/suzanne.bam"; } vpPanda3DRenderParameters renderParams(vpCameraParameters(300, 300, 160, 120), 240, 320, 0.01, 10.0); vpPanda3DRendererSet renderer(renderParams); @@ -158,13 +157,20 @@ int main(int argc, const char **argv) const std::string objectName = "object"; - std::shared_ptr geometryRenderer = std::make_shared(vpPanda3DGeometryRenderer::vpRenderType::WORLD_NORMALS); - std::shared_ptr cameraRenderer = std::make_shared(vpPanda3DGeometryRenderer::vpRenderType::CAMERA_NORMALS); - std::shared_ptr rgbRenderer = std::make_shared(); - std::shared_ptr rgbDiffuseRenderer = std::make_shared(false); - std::shared_ptr grayscaleFilter = std::make_shared("toGrayscale", rgbRenderer, false); - std::shared_ptr blurFilter = std::make_shared("blur", grayscaleFilter, false); - std::shared_ptr cannyFilter = std::make_shared("canny", blurFilter, true, 10.f); + std::shared_ptr geometryRenderer = + std::make_shared(vpPanda3DGeometryRenderer::vpRenderType::WORLD_NORMALS); + std::shared_ptr cameraRenderer = + std::make_shared(vpPanda3DGeometryRenderer::vpRenderType::CAMERA_NORMALS); + std::shared_ptr rgbRenderer = + std::make_shared(); + std::shared_ptr rgbDiffuseRenderer = + std::make_shared(false); + std::shared_ptr grayscaleFilter = + std::make_shared("toGrayscale", rgbRenderer, false); + std::shared_ptr blurFilter = + std::make_shared("blur", grayscaleFilter, false); + std::shared_ptr cannyFilter = + std::make_shared("canny", blurFilter, true, 10.f); renderer.addSubRenderer(geometryRenderer); @@ -197,11 +203,13 @@ int main(int argc, const char **argv) renderer.addNodeToScene(object); vpPanda3DAmbientLight alight("Ambient", vpRGBf(0.2)); - // renderer.addLight(alight); - vpPanda3DPointLight plight("Point", vpRGBf(1.0), vpColVector({ 0.2, 0.2, -0.2 }), vpColVector({ 0.0, 0.0, 2.0 })); + renderer.addLight(alight); + + vpPanda3DPointLight plight("Point", vpRGBf(1.0), vpColVector({ 0.3, -0.4, -0.2 }), vpColVector({ 0.0, 0.0, 1.0 })); renderer.addLight(plight); - vpPanda3DDirectionalLight dlight("Directional", vpRGBf(2.0), vpColVector({ 0.0, -1.0, 0.0 })); - //renderer.addLight(dlight); + + vpPanda3DDirectionalLight dlight("Directional", vpRGBf(2.0), vpColVector({ 1.0, 1.0, 0.0 })); + renderer.addLight(dlight); rgbRenderer->printStructure(); std::cout << "Setting camera pose" << std::endl;