WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Using <window>.screenToWorld within vizcave powerwall (

VizMars 07-19-2018 05:25 AM

Using <window>.screenToWorld within vizcave powerwall
How can one use the .screenToWorld command within a vizcave powerwall?
Specifically, how can one get the length of the line passing through the given screen coordinates (in pixel units) with the begin point of the line being the users head position (center of the eyes)?

Unfortunately, the following code seems to be incorrect:

line = viz.MainWindow.screenToWorld([pixel_x,pixel_y], eye = viz.BOTH_EYE, mode = viz.WINDOW_PIXELS)
print line.length

Jeff 07-25-2018 10:04 PM

Is the line length you want to calculate the distance from the user's head to a specific point on the physical wall?

VizMars 08-05-2018 04:22 AM

I want to calculate depth information for each screen pixel in a way that for given 2d screen coordinates (x,y) I get the distance from the user's head to the point in the 3d scene that corresponds to the given 2d screen coordinates. Ultimately, the goal is to construct a "depth map" for a scene given the user's head position and gaze direction.

Rennschu 08-17-2018 08:12 AM

I would like to use this function, too. Is it possible to create a depth map in Vizard this way?

Jeff 08-18-2018 06:24 AM

You can render the scene to a depth map or use viz.window.screenCapture with a depth texture to capture the current scene depth info.

VizMars 08-19-2018 12:16 PM

Thank you for providing this link. Afaiu d and z (in the example you linked) are two variables that hold standardized depth values, and z is used to construct the color for the depth texture.
I have a two questions regarding this example:
1. Can you explain what exactly d and z correspond to? And if they are standardized, is it also possible to get the unstandardized distance/depth information?
2. How can I get these values (d and z) for each pixel?
viz.window.screenCapture() allows me to save the screen image to a file where I can extract the r, g and b values from (not sure how they correspond to d and z) - but I think it would be better to get the depth information within Vizard. Is this possible?

All times are GMT -7. The time now is 02:49 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC