You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a marker is successfully tracked, the getMarker event fires with a valid pose (real rotation + translation), but three.js examples still show no 3D object. The object is placed behind the camera and gets frustum-clipped.
Surfaced while implementing #30 (static-image Teblid example): the marker tracks correctly (Marker tracked ! Num. matches : 1000) and a found pose arrives, yet no sphere is visible.
Evidence (runtime)
Sample pose delivered to the scene (three.js column-major elements):
translation = (0.953, -0.384, +5.824)
Projection matrix from the same run (column-major):
So the object is clipped and never rasterized, despite correct tracking.
Root cause
The pose field (from getPoseMatrix() → transMatToGLMat()) is in OpenCV camera convention (object in front ⇒ +Z), which is incompatible with the OpenGL projection used for rendering (object in front ⇒ −Z). The right-handed GL matrix matrixGL_RH (arglCameraViewRHf) — the one that should be fed to three.js — currently throws an exception (see recent dev commits experimenting with the pose matrix).
Suggested direction
Provide a correct GL modelview/pose matrix (apply the full CV→GL handedness flip: negate Y and Z appropriately on both rotation and translation), or fix arglCameraViewRHf / matrixGL_RH so it no longer throws and can be used directly.
Quick verification: negating the translation Z on the pose before setMatrix(root.matrix, ...) should bring the object into view — useful as a confirmation while the proper conversion is sorted out.
Notes
The fix likely lives in the emscripten/WebARKitLib submodule (pose conversion: invertPose/cvToGl/arglCameraViewRHf) and would require rebuilding dist/WebARKit.js.
WebARKitTracker::processFrame calls GetTrackedFeaturesWarped() when a marker is detected on the very first frame (_frameCount == 0), before GetInitialFeatures() has populated the tracked-feature set. perspectiveTransform then runs on an empty point set and throws (CV_Assert(scn + 1 == m.cols)). The #30 static example works around this by feeding one blank warmup frame, but the library should guard the pose block against an empty feature set.
Summary
When a marker is successfully tracked, the
getMarkerevent fires with a valid pose (real rotation + translation), but three.js examples still show no 3D object. The object is placed behind the camera and gets frustum-clipped.Surfaced while implementing #30 (static-image Teblid example): the marker tracks correctly (
Marker tracked ! Num. matches : 1000) and afoundpose arrives, yet no sphere is visible.Evidence (runtime)
Sample
posedelivered to the scene (three.js column-majorelements):Projection matrix from the same run (column-major):
This is a standard OpenGL projection (
proj[11] = -1, camera looks down −Z). Plugging the object origin(0.953, -0.384, 5.824, 1)through it:clip.w = -view.z = -5.824(negative → behind camera)ndc.z ≈ 1.03(> 1 → beyond far plane)So the object is clipped and never rasterized, despite correct tracking.
Root cause
The
posefield (fromgetPoseMatrix()→transMatToGLMat()) is in OpenCV camera convention (object in front ⇒ +Z), which is incompatible with the OpenGL projection used for rendering (object in front ⇒ −Z). The right-handed GL matrixmatrixGL_RH(arglCameraViewRHf) — the one that should be fed to three.js — currently throws an exception (see recentdevcommits experimenting with the pose matrix).Suggested direction
arglCameraViewRHf/matrixGL_RHso it no longer throws and can be used directly.posebeforesetMatrix(root.matrix, ...)should bring the object into view — useful as a confirmation while the proper conversion is sorted out.Notes
emscripten/WebARKitLibsubmodule (pose conversion:invertPose/cvToGl/arglCameraViewRHf) and would require rebuildingdist/WebARKit.js.Related latent bug (already worked around in #30)
WebARKitTracker::processFramecallsGetTrackedFeaturesWarped()when a marker is detected on the very first frame (_frameCount == 0), beforeGetInitialFeatures()has populated the tracked-feature set.perspectiveTransformthen runs on an empty point set and throws (CV_Assert(scn + 1 == m.cols)). The #30 static example works around this by feeding one blank warmup frame, but the library should guard the pose block against an empty feature set.