ravidavi / OpenFrames

Realtime interactive scientific visualization API
Apache License 2.0
31 stars 14 forks source link

osgearth .earth file integration with htcvive #1

Open jaigsingla opened 6 years ago

jaigsingla commented 6 years ago

Hi Ravi,

I have built openframes with openvr and osgearth successfully.

I ran ofviewer --vr .earth file . it runs successfully but vive controllers are not working ?? any manual towards that?

thanks Jai

wsljt19940218 commented 5 years ago

Hi jaigsingla,

Can you share your built experience with me?

I built openframes with osgearth too. I ran ofviewer .osg file,it runs successfully. I ran ofviewer .earth file,it crashed. I ran ofviewer --vr .osg file,the vive show nothing.

Can you share me your buile experience and the version of osg and vs you used? Thanks very much!

Regards, Lucy

jaigsingla commented 5 years ago

Hi Lucy,

I Have used osg 3.6 and Vs 2017 . Of viewer is working for me but ofviewer with. Earth file is not working in desired way.

On Tue, 6 Nov 2018, 20:34 wsljt19940218 <notifications@github.com wrote:

Hi jaigsingla,

Can you share your built experience with me?

I built openframes with osgearth too.ofviewer . I ran ofviewer .osg file,it runs successfully. I ran ofviewer .earth file,it crashed. I ran ofviewer --vr .osg file,the vive show nothing.

Can you share me your buile rxperience and the version of osg and vs you used? Thanks very much!

Regards, Lucy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ravidavi/OpenFrames/issues/1#issuecomment-436284088, or mute the thread https://github.com/notifications/unsubscribe-auth/AYt7mDQitWF05u2mbvk6sW3FV6qSloTPks5usaT_gaJpZM4XtVaF .

jaigsingla commented 5 years ago

Hi , ofviewer --vr with earth file works but using controllers m not able to zoom in/out, pan, rotate , grab etc? Please shed some light on this?

ravidavi commented 5 years ago

Hello Jai and Lucy,

Sorry for the late reply, GitHub wasn't notifying me of posts so I didn't notice until now.

To use VR you first have to build with OpenVR: in CMake set OF_VR_TYPE to OpenVR (not OpenVR Stub), then it will prompt you to specify the location of your OpenVR directory.

When you launch "ofviewer --vr file", it displays the loaded model in VR using whatever distance units the model is defined in. Since osgEarth works in meters, in VR the Earth is life-sized! The viewer (you) is placed at several thousand kilometers away so you can see the whole planet, and therefore when you use the controllers to translate it doesn't seem to have any effect.

When you load a huge model, you usually first need to shrink it down. One way is to use the "--vrScale" flag to ofviewer. Doing "ofviewer --vr --vrScale 6000000 earthfile.earth" will load the osgEarth model and show it such that 6 million meters in the scene is 1 meter in real life. The Earth will then appear ~1 meter in radius.

The second method is to shrink/expand the Earth with your controllers. Refer to https://forums.unrealengine.com/filedata/fetch?id=1111783&d=1460020388 for reference on what the buttons are named.

Here are the transformations you can do with the VR controllers:

I suggest first trying this with the cow.osg or cessna.osg models, since they are much smaller and you can effectively shrink them on the first try. Once you figure out the motions (shouldn't take more than a few minutes) you can switch to the osgEarth file.

jaigsingla commented 5 years ago

Hi Ravi,

Will test this out. Pls provide you Skype ID for frequent interaction.

On Thu, 6 Dec 2018, 20:48 Ravi Mathur <notifications@github.com wrote:

Hello Jai and Lucy,

Sorry for the late reply, GitHub wasn't notifying me of posts so I didn't notice until now.

To use VR you first have to build with OpenVR: in CMake set OF_VR_TYPE to OpenVR (not OpenVR Stub), then it will prompt you to specify the location of your OpenVR directory.

When you launch "ofviewer --vr file", it displays the loaded model in VR using whatever distance units the model is defined in. Since osgEarth works in meters, in VR the Earth is life-sized! The viewer (you) is placed at several thousand kilometers away so you can see the whole planet, and therefore when you use the controllers to translate it doesn't seem to have any effect.

When you load a huge model, you usually first need to shrink it down. One way is to use the "--vrScale" flag to ofviewer. Doing "ofviewer --vr --vrScale 6000000 earthfile.earth" will load the osgEarth model and show it such that 6 million meters in the scene is 1 meter in real life. The Earth will then appear ~1 meter in radius.

The second method is to shrink/expand the Earth with your controllers. Refer to https://forums.unrealengine.com/filedata/fetch?id=1111783&d=1460020388 for reference on what the buttons are named.

  • Press and hold the grip buttons on both controllers, and bring your hands together. This will make the scene smaller.
  • Since the Earth is so huge, you might have to do that shrinking motion 3-4 times (release the grip buttons between each motion). It helps to start with your hands far apart. Once you get the Earth down to a manageable size, you can more easily interact with it.

Here are the transformations you can do with the VR controllers:

  • Shink/Expand: Hold both grip buttons and move hands together or apart (similar to pinch-to-zoom on phones). You'll note that there is a small blue marble halfway between your controllers. When expanding, first touch the point on your model where you want to expand to, and then do the expand motion (grip buttons + move hands apart). Your viewpoint will smoothly go to the place you touched as the model expands. This is useful to "zoom in" on a point on the Earth once you have made it small.
  • Rotate: Hold both grip buttons and move your hands around each other. The entire scene will rotate about the blue marble between your controllers. You will figure this out quickly.
  • Translate: Hold just one grip button (either controller) and move your hand around. The entire scene will translate as if you grabbed it and are dragging it around.

I suggest first trying this with the cow.osg or cessna.osg models, since they are much smaller and you can effectively shrink them on the first try. Once you figure out the motions (shouldn't take more than a few minutes) you can switch to the osgEarth file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ravidavi/OpenFrames/issues/1#issuecomment-444906732, or mute the thread https://github.com/notifications/unsubscribe-auth/AYt7mJFsvpFCqZEqStWZFASPhSRB-LJUks5u2TVNgaJpZM4XtVaF .

ravidavi commented 5 years ago

I'm happy to answer questions here, but am not available for live support and will not be giving out personal information. :D

jaigsingla commented 5 years ago

Hi Ravi,

I tried above using hubble.3ds as well .earth. I am having following observations:

  1. As my physical navigation space is very limited in lab currently ; so when i saw in HMD ; .earth or model scene seems to render out of bounding box.
  2. --vrscale 6000000 is not showing any effect on .earth file.
  3. SHrink/ Expand / ROtate / translate nothing seems to work using controller (it may be due to limit of navigation space??)
  4. Using mouse functions are working somehow .

Request your reaction on this .

On Thu, Dec 6, 2018 at 9:03 PM Ravi Mathur notifications@github.com wrote:

I'm happy to answer questions here, but am not available for live support and will not be giving out personal information. :D

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ravidavi/OpenFrames/issues/1#issuecomment-444912447, or mute the thread https://github.com/notifications/unsubscribe-auth/AYt7mDXDrjlcoA3V_vltymov7y9UWUoBks5u2TjOgaJpZM4XtVaF .

-- Regards, Jai Singla

ravidavi commented 5 years ago

"--vrScale", not "--vrscale". Case matters. Also, does SteamVR see your controllers?

What do you mean "renders out of bounding box"? Is the model partially clipped? Whatever you see in the HMD is mirrored on your monitor, so please take a screenshot of that and post if you do see clipping.

jaigsingla commented 5 years ago

I have used --vrScale. Model is not clipped at all. Attached screen shot using --vr or without but --vrScale is always on. StreamVR does see controllers in the scene . I noticed ! sign on HMD device while using ofviewer and its say stream not detected and connected ?? my machine is offline to internet ; is something extra required?

render out of bounding box : Bounding box of my VR walk able area . Model is seen outside this walkble area. Controllers are not effective at all inside this but mouse is working.

desktop screenshot 2018 12 11 - 10 08 37 72 desktop screenshot 2018 12 11 - 10 09 42 15 desktop screenshot 2018 12 11 - 10 11 48 14 desktop screenshot 2018 12 11 - 10 08 07 10

jaigsingla commented 5 years ago

One thing to add.. streamVR is working well with unity and its applications .

wsljt19940218 commented 5 years ago

Dear ravidai, Good job!It works well!

Now I have a question and I hope to get your answer.

void WindowProxy::run() { ...... _viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded); ...... }

Why set it to single thread?

Best wishes for you! Regards, Lucy

jaigsingla notifications@github.com 于2018年12月11日周二 下午2:50写道:

One thing to add.. streamVR is working well with unity and its applications .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ravidavi/OpenFrames/issues/1#issuecomment-446091917, or mute the thread https://github.com/notifications/unsubscribe-auth/Ahz3LsofOfbhT1m0vt6Onr4bErF1ln2Iks5u31XMgaJpZM4XtVaF .

ravidavi commented 5 years ago

Thanks Lucy, and glad it works well for you.

Regarding SingleThreaded mode: Each WindowProxy runs in its own thread when you do winProxy.start() (or startThreading()). I have found that allowing the viewer to also run in multithreaded mode results in an immediate crash. I haven't had time to dig into this yet, but that is the reason behind running the viewer in SingleThreaded mode.

Ravi

ravidavi commented 5 years ago

Hi jaigsingla,

Are the controllers not even displayed in VR? Or are they displayed but don't seem to be responding? One thing to check ... when you press the trigger button a "laser" should shoot out of the controller. It won't do anything at the moment (it's used for selecting Qt widgets in VR), but at least you'll know if the problem lies with the controllers or not.

Additionally, if you look down at the floor there is a number written at the center of the grid. That is the current vr scale, and it should change as you do the shrink/expand action.

Ravi

jaigsingla commented 5 years ago

HI Ravi, Nice to hear from you.

Controllers are very much displayed and laser is seen . but, these are not responding . looking for solution eagerly .

On Fri, Jan 4, 2019 at 8:30 PM Ravi Mathur notifications@github.com wrote:

Hi jaigsingla,

Are the controllers not even displayed in VR? Or are they displayed but don't seem to be responding? One thing to check ... when you press the trigger button a "laser" should shoot out of the controller. It won't do anything at the moment (it's used for selecting Qt widgets in VR), but at least you'll know if the problem lies with the controllers or not.

Additionally, if you look down at the floor there is a number written at the center of the grid. That is the current vr scale, and it should change as you do the shrink/expand action.

Ravi

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ravidavi/OpenFrames/issues/1#issuecomment-451467313, or mute the thread https://github.com/notifications/unsubscribe-auth/AYt7mL6Tqv9BMkA8rFyewPjU1KWBkwZOks5u_2ySgaJpZM4XtVaF .

-- Regards, Jai Singla

wsljt19940218 commented 5 years ago

HI Ravi,

Since the manipulator is derived from TrackballManipulator,the controller works not properly when zooming in/out?

Would you please give me some advice about how to modified your code so that it can work well when viewing .earth in VR mode?

Best Wishes For you! Regards, Lucy

jaigsingla commented 5 years ago

Lucy, did you get stuff working ?

jaigsingla commented 5 years ago

Hi Ravi,

Is there nay update from your side?

jaigsingla commented 4 years ago

Hi, Ravi Zoom in/out , rotation, re-scaling is working but while working with osgearth , program crashes in between ??

ravidavi commented 4 years ago

Glad it works.

Does the crash occur in one of the OpenFrames demo apps (e.g. ofviewer), or in your own application?

jaigsingla commented 4 years ago

It crashes when I pump more data into .earth file and use it with ofviewer --vr. Is there any caching options while working with more datasets?? What are other features with osgearth?? It will be great to know. I want to have your Skype ID Ravi . Mine is jaigsingla

ravidavi commented 4 years ago

OpenFrames just lets OSG load the osgEarth model and doesn't do anything special with it. You can go to the osgEarth doc page to see its features.

If you can attach your .earth file and tell me how to reproduce the crash, I can try testing it when I have time.

jaigsingla commented 4 years ago

ok. I could figure out problem. when text attributes are overlayed with font , program crashes. please see is it happening at your end too? But, normally it is working well .

jaigsingla commented 4 years ago

more specifically in case of the tag .

ravidavi commented 4 years ago

Again, please attach a SIMPLE .earth file for me to test. Something that only has the minimal set of features that trigger the crash.

That is a better use of time than me trying to guess what you have in your .earth file.

jaigsingla commented 4 years ago

<model name="shape" driver="feature_geom">

G:/data/india_adm.shp true ` on enabling this script , program crashes without any error message. I checked makefile again and linked all lib files. but, while building project it does not show any impact . Even rebuilt the entire project by clearing cache, Error is not resolved.
ravidavi commented 4 years ago

That is not a valid .earth file, it doesn't have a map entry. GitHub allows you to attach files to comments. Create a simple .earth file that shows the problem. Then attach the file itself to your reply, plus any other files that I need to run it.

I should be able to run osgearth_viewer yourfile.earth without any other work required of me.

jaigsingla commented 4 years ago

Most of my data is local to my machine. So , e-mailing you earth file with data. request you to replace data with online url for checking.

earthmap1.earth.txt

ravidavi commented 4 years ago

Thanks, I will look at this when I get a chance in the coming weeks.

jaigsingla commented 4 years ago

Hi Ravi, could you go through ?? how to make my computer HMD mirror as full screen ?