Discussion:
[osg-users] [Help] OSG + ArKit: Problem converting coordinate system
Rodrigo Brayner Lyra
2018-10-08 19:08:04 UTC
Permalink
Hi,

I'm working on a project that will render a scene using openscenegraph, and the user will have the option to work with this scene in AR. The integration of ArKit in the application is almost complete, except in the conversion of ArKit's view matrix to the coordinate system used by OSG.

I uploaded the render of the OSG axis helper and the ArKit axis helper. As you can see, the y in OSG is x in ArKit, the x in OSG is z in ArKit and the z in OSG is y in ArKit. With that, I thought that if I switched the axes directly into the view matrix it would be correct. What I have tried can be seen in the two attachments with the code fragment that converts the ArKit view matrix into an OSG view matrix (ar_conv_vector_change and ar_conv_values_change).
None of them worked completely except that one of them was correct in the rotations and translations of the camera, but the position and initial rotation of the scene was completely wrong (The wall should be in the same position and point of view as before at the time that the AR mode is started, but was positioned as shown in the switched_values_view image).

In the end, the camera view matrix is:
m_camera_matrix = m_camera_view * ar_view_matrix;

I apologize for the long text, and I ask the support of the people of this forum, and if there is, who has already gone through this situation (with ArKit or other APIs)

Thank you!

Cheers,
Rodrigo

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75048#75048




Attachments:
Loading Image...
Loading Image...
Loading Image...
Loading Image...
Loading Image...
Raymond de Vries
2018-10-09 07:06:04 UTC
Permalink
Hi Rodrigo,

Without having read your mail in detail I have a suggestion. Do you know
artoolkit and the integration with osg? It sounds to me that you can
learn from that project.

https://github.com/artoolkit/artoolkit5
https://github.com/artoolkit/artoolkit5/tree/master/examples/simpleOSG

Please keep us/me posted. Sounds like a nice project, have fun!

Cheers,
Raymond
Post by Rodrigo Brayner Lyra
Hi,
I'm working on a project that will render a scene using openscenegraph, and the user will have the option to work with this scene in AR. The integration of ArKit in the application is almost complete, except in the conversion of ArKit's view matrix to the coordinate system used by OSG.
I uploaded the render of the OSG axis helper and the ArKit axis helper. As you can see, the y in OSG is x in ArKit, the x in OSG is z in ArKit and the z in OSG is y in ArKit. With that, I thought that if I switched the axes directly into the view matrix it would be correct. What I have tried can be seen in the two attachments with the code fragment that converts the ArKit view matrix into an OSG view matrix (ar_conv_vector_change and ar_conv_values_change).
None of them worked completely except that one of them was correct in the rotations and translations of the camera, but the position and initial rotation of the scene was completely wrong (The wall should be in the same position and point of view as before at the time that the AR mode is started, but was positioned as shown in the switched_values_view image).
m_camera_matrix = m_camera_view * ar_view_matrix;
I apologize for the long text, and I ask the support of the people of this forum, and if there is, who has already gone through this situation (with ArKit or other APIs)
Thank you!
Cheers,
Rodrigo
------------------
http://forum.openscenegraph.org/viewtopic.php?p=75048#75048
http://forum.openscenegraph.org//files/switched_values_view_100.jpg
http://forum.openscenegraph.org//files/ar_conv_values_change_120.jpeg
http://forum.openscenegraph.org//files/ar_conv_vector_change_297.jpeg
http://forum.openscenegraph.org//files/osg_axis_731.png
http://forum.openscenegraph.org//files/arkit_axis_176.jpg
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
---
This email has been checked for viruses by AVG.
https://www.avg.com
Voerman, L.
2018-10-09 07:58:35 UTC
Permalink
Hi Rodrigo,
I don't fully grasp your question, but i noticed that you say you want to
swap axis while the matrix in ar_conv_values_change_120.jpeg
<http://forum.openscenegraph.org//files/ar_conv_values_change_120.jpeg> has
a last column in a different order than the first three.
Laurens.
Post by Raymond de Vries
Hi Rodrigo,
Without having read your mail in detail I have a suggestion. Do you know
artoolkit and the integration with osg? It sounds to me that you can
learn from that project.
https://github.com/artoolkit/artoolkit5
https://github.com/artoolkit/artoolkit5/tree/master/examples/simpleOSG
Please keep us/me posted. Sounds like a nice project, have fun!
Cheers,
Raymond
Post by Rodrigo Brayner Lyra
Hi,
I'm working on a project that will render a scene using openscenegraph,
and the user will have the option to work with this scene in AR. The
integration of ArKit in the application is almost complete, except in the
conversion of ArKit's view matrix to the coordinate system used by OSG.
Post by Rodrigo Brayner Lyra
I uploaded the render of the OSG axis helper and the ArKit axis helper.
As you can see, the y in OSG is x in ArKit, the x in OSG is z in ArKit and
the z in OSG is y in ArKit. With that, I thought that if I switched the
axes directly into the view matrix it would be correct. What I have tried
can be seen in the two attachments with the code fragment that converts the
ArKit view matrix into an OSG view matrix (ar_conv_vector_change and
ar_conv_values_change).
Post by Rodrigo Brayner Lyra
None of them worked completely except that one of them was correct in
the rotations and translations of the camera, but the position and initial
rotation of the scene was completely wrong (The wall should be in the same
position and point of view as before at the time that the AR mode is
started, but was positioned as shown in the switched_values_view image).
Post by Rodrigo Brayner Lyra
m_camera_matrix = m_camera_view * ar_view_matrix;
I apologize for the long text, and I ask the support of the people of
this forum, and if there is, who has already gone through this situation
(with ArKit or other APIs)
Post by Rodrigo Brayner Lyra
Thank you!
Cheers,
Rodrigo
------------------
http://forum.openscenegraph.org/viewtopic.php?p=75048#75048
http://forum.openscenegraph.org//files/switched_values_view_100.jpg
http://forum.openscenegraph.org//files/ar_conv_values_change_120.jpeg
http://forum.openscenegraph.org//files/ar_conv_vector_change_297.jpeg
http://forum.openscenegraph.org//files/osg_axis_731.png
http://forum.openscenegraph.org//files/arkit_axis_176.jpg
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Post by Rodrigo Brayner Lyra
---
This email has been checked for viruses by AVG.
https://www.avg.com
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Rodrigo Brayner Lyra
2018-10-09 13:57:37 UTC
Permalink
Hi Raymond,

I took a look at the submitted sample, and from what I've noticed, unfortunately it is unfeasible to migrate now to ArToolkit because of the project structure, which was all based on OSG, and as I could understand, ArToolkit + OSG uses pure OpenGL calls. Unfortunately the deadline is very near.

Hi Laurens,
The last column is unchanged because it is always 0 (except the value in the last row, which is 1). so the order of the last column doesn't matter.

Thank you!

Cheers,
Rodrigo

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75054#75054
michael kapelko
2018-10-10 07:59:18 UTC
Permalink
Hi.
I would recommend to create a small example depicting the problem and
host it on GitHub. That way others may actually try to run it and play
with it instead of guessing.
Post by Rodrigo Brayner Lyra
Hi Raymond,
I took a look at the submitted sample, and from what I've noticed, unfortunately it is unfeasible to migrate now to ArToolkit because of the project structure, which was all based on OSG, and as I could understand, ArToolkit + OSG uses pure OpenGL calls. Unfortunately the deadline is very near.
Hi Laurens,
The last column is unchanged because it is always 0 (except the value in the last row, which is 1). so the order of the last column doesn't matter.
Thank you!
Cheers,
Rodrigo
------------------
http://forum.openscenegraph.org/viewtopic.php?p=75054#75054
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Loading...