Daggerfall Unity VR with the Vive Pro

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Hm, I must be doing something wrong still. What I see is that the RawImage that's a component alongside the User Interface Render Target is updated at runtime to point to "DaggerfallUI RenderTexture 0". However even in the inspector the preview window for that image, it displays nothing but the empty 100% alpha checkered pattern.

If I click the NonDiegeticUIOutput in the inspector it shows a "DaggerfallUI RenderTexture 0" as the RawImage texture. It's been disabled when my scripts inject (as per the pre-requisite) and it shows the HUD overlay image.

Another interesting thing, when I resize the panels in the inspector there are a bunch of new UI RenderTextures created. For example, here's one:

Code: Select all

Created UI RenderTexture with dimensions 1654, 445
UnityEngine.Debug:LogFormat(String, Object[])
DaggerfallWorkshop.Game.UserInterface.UserInterfaceRenderTarget:CheckTargetTexture() (at Assets/Scripts/Game/UserInterface/UserInterfaceRenderTarget.cs:219)
DaggerfallWorkshop.Game.UserInterface.UserInterfaceRenderTarget:Update() (at Assets/Scripts/Game/UserInterface/UserInterfaceRenderTarget.cs:118)
I think I need a bit more information to debug this. How does the UI determine what RenderTexture gets what to target, and is there a list of them somewhere? I suppose that'd be in ui.ParentPanel.Components, which I can view in the debugger. And indeed when I add the instance of the HUDCompass it gets another in the list.

So the flow is something like:

* Create a HUDCompass

* Add it as a component in ParentPanel.Components

Does the ui (the UserInterfaceRenderTarget component in this GameObject) then look for a RawImage component and sets its RawImage to be whatever the last texture created was?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

The output will go to whatever game object has a RawImage attached to it. You just need to fill it in. Alternatively, you can use the TargetTexture property directly and do whatever you like with it. The design is to be as flexible as possible. In this case, you need to link it from editor.

You can either drag the CustomCompass object from the Hierarchy over the empty "Output Image" field in its own Inspector. Or hit the little circle next to "Output Image" and select CustomCompass from the popup.

Double-check that every single field matches the Inspector screen grab I posted above and let me know if you still get stuck. :)

InconsolableCellist wrote: Tue Jun 05, 2018 12:04 am Another interesting thing, when I resize the panels in the inspector there are a bunch of new UI RenderTextures created.
This is intended behaviour. The UI render texture needs to match the screen area for the overlay to be consistent. It is invalidated by resizing screen dimensions and recreated. The other offscreen surfaces don't need to be recreated unless you change their size or they become invalidated some other way (e.g. alt-tab back and forth with exclusive fullscreen).

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Progress! I don't know what was wrong, so I recreated my version of the compass object and it worked.

https://www.youtube.com/watch?v=BhUEMNJjk-A&t=7s

I had a ton of trouble figuring out the proper dimensions for the Vitals though. I ended up having way too big of an image that I just moved into place, and it also changed as I resized the window.

I just noticed that something broke, and the sprites are no longer tracking the right camera for rotation. I'm not sure when that happened, but I feel it was recent. It could've been some of the injection changes I made though.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Oh that is freakin' cool!

One of the sucky bits about the HUD components is they normally sit outside the 320x200 "NativePanel" (typically the pillarbox region on widescreens) and they don't have any native scaling intelligence built in. They are pretty flexible though and you can stick them almost anywhere. I'm pleased to see the progress. :)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Just a quick guess on the sprites not orienting to face player. It might be related to a camera not being tagged as MainCamera.

That is just a quick guess though. Hopefully you can sort it out. :)

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

I'm working on pointer input now. I have a few small problems around this to solve, which I might have to sleep on.

As with the offscreen UI render targets, first priority will be not to break anything in core and build up in small steps. Will hopefully have something for you soon.

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Nice! I can't wait. Though I have things to do in the meantime (first of all, my day job of course), such as getting the sprites to rotate again. (The camera was set to MainCamera; it probably has to do with me adding the new VR camera and disabling the old one. Things got weird with the injection, but the player had a bunch of scripts that I didn't want to duplicate in the new VR camera.) Also I have to figure out a more permanent under-controller UI. The compass and vitals are a neat demo but I'm thinking a more conventional menu that lets you pull up various essentials, like the inventory window, main menu, etc.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Will hopefully have something for you by end of today.

I'm also going to make rendering main UI to offscreen an optional setting. The new setup is fine for VR users and anyone else with a beefy PC, but it excludes folks with less powerful rigs.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

TheLacus wrote: Sun Jun 03, 2018 5:28 pm Transparency now looks much stronger than before, should i manually change colors?
TheLacus - I'm going to revert the main UI back to normal while still allowing InconsolableCellist to disable and use redirected rendering for the VR stuff. This should return to normal shortly.

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Interkarma wrote: Tue Jun 05, 2018 9:57 pm
TheLacus wrote: Sun Jun 03, 2018 5:28 pm Transparency now looks much stronger than before, should i manually change colors?
TheLacus - I'm going to revert the main UI back to normal while still allowing InconsolableCellist to disable and use redirected rendering for the VR stuff. This should return to normal shortly.
That works for me. It'd be fine to require an option for VR in the settings

Post Reply