screenToWorld3D

Please provide the following info:
Hardware Platform: DRIVE AGX Pegasus™ Developer Kit
Software Version: DRIVE Software 10
Host Machine Version: native Ubuntu 18.04
SDK Manager Version: 1.4.0.7363

In render_engine sample, clicking on tiles shows an {x, y, z} coordinate that is generated based on the clicked screen position using dwRenderEngine_screenToWorld3D.

It seems that the world coordinate always has z=0.

What I need to do is click on a point after rendering a point cloud with DW_RENDER_ENGINE_PRIMITIVE_TYPE_POINTS_3D and get the 3D coordinates of a point close to where the mouse is clicked.

Is screenToWorld3D the correct approach, or is there a different way?

Hello. Any tips on this? Thanks!

Bumping this again. Does the question even make sense? Thanks.

Hi @gpu_power,

Below are the steps of finding the closest point. FYI.

  1. click on screen and pass pixel coords to dwRenderEngine_screenToWorld API
  2. Using the 3D point obtained from the above API, search through the lidar points and find the point that is closest to that 3D point.

Thanks @VickNV

Not sure what I’m doing wrong, but dwRenderEngine_screenToWorld always results in world position of {-1, 1, 0}.

I’ll check with the team and get back to you. Thanks!

To make it clear, the problem is the 3D point returned by dwRenderEngine_screenToWorld3D always results in z=0. This is the same as in the render_engine example as well as my own code. The values of x and y seem correct.

What I am trying to do is commonly done in opengl by first calling glReadPixels to get the GL_DEPTH_COMPONENT (depth value) of the pixel coords. Then calling gluUnProject, with the pixel coords and depth value. This gets the 3D point {x, y, z} in opengl.

However, I can’t do the same in Driveworks. I think gluUnProject is equivalent to dwRenderEngine_screenToWorld3D, but as I described in my original post, z always results in 0.

Thank you for helping to find the issue! We are fixing it and will update you here.

@VickNV can you please help with a workaround?

If I can use glReadPixels to get the GL_DEPTH_COMPONENT, then I can do the matrix operations myself.

However, although glReadPixels works on the host Ubuntu PC (i.e. it returns sensible values of depth: 0.0 < depth < 1.0), it always returns 0.0 on the target Pegasus platform.

How do I get glReadPixels working on the target?

Could you create another topic for it and upload the sample for our reproducing? Thanks!

The fix will be available in DriveWorks 4.0 release. Thanks.