Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portal 2 compatibility? Need help with port #87

Open
Gistix opened this issue May 13, 2023 · 5 comments
Open

Portal 2 compatibility? Need help with port #87

Gistix opened this issue May 13, 2023 · 5 comments

Comments

@Gistix
Copy link

Gistix commented May 13, 2023

I'm trying to port this over to Portal 2, I'm working on getting the rendering working however I'm getting this:

image
(It renders the game in a very small size inside the window, the entire window is sent to OpenVR)

I have aligned most of the classes based on Portal's VMT tables and disabled all hooks except "dRenderView" (so I can test and get stereo rendering working), I haven't forked yet but I'm planning to once it's in a playable state.

@Sharkgamedev
Copy link

Hey bro! The author as well as many talented people are present in the Flat2VRDiscord server where you might get better answers to your questions! I can shoot you an invite if you'd like!

@Gistix
Copy link
Author

Gistix commented May 13, 2023

Hey bro! The author as well as many talented people are present in the Flat2VRDiscord server where you might get better answers to your questions! I can shoot you an invite if you'd like!

I'm already in the server, but I'll send an message there too just in case, thanks!

@Gistix
Copy link
Author

Gistix commented May 14, 2023

I got it to render to the headset directly (instead of working like a virtual cinema). However its only rendering the UI and it seems to not be clearing the RT since the reticle colors bleed to white with time.
I suppose the rendering order described in "dPushRenderTargetAndViewport" (PopRenderTargetAndViewport -> IsSplitScreen -> PrePushRenderTarget -> PushRenderTargetAndViewport) isn't the same for Portal 2 because of the portal rendering.

Here's how it looks like with the respective value of m_PushHUDStep:

dPopRenderTargetAndViewport: -999
dIsSplitScreen: 0
dIsSplitScreen: 1
dIsSplitScreen: -999
dIsSplitScreen: -999
dIsSplitScreen: -999
dIsSplitScreen: -999
dPushRenderTargetAndViewport: -999
dPopRenderTargetAndViewport: -999
dPushRenderTargetAndViewport: 0
dPopRenderTargetAndViewport: -999
dPopRenderTargetAndViewport: 0
dPopRenderTargetAndViewport: 0
dIsSplitScreen: 0
dPrePushRenderTarget: 1
dPopRenderTargetAndViewport: 2
dPrePushRenderTarget: 0
dPrePushRenderTarget: -999
dPopRenderTargetAndViewport: -999
dPushRenderTargetAndViewport: 0
dPushRenderTargetAndViewport: -999

@sd805
Copy link
Owner

sd805 commented May 16, 2023

Yeah my method for finding the GUI texture is definitely jank, so I wouldn't expect it to work on other Source games. You'll have to find when PushRenderTargetAndViewport gets called with the GUI texture (inside of the RenderView function). A better solution I think would be to either do a mid-function hook at the point PushRenderTargetAndViewport gets called, or maybe you can just call pTexture->GetName() in the hook to find out when the GUI texture gets passed. Can't remember if I tried that.

@Gistix
Copy link
Author

Gistix commented Jun 20, 2023

I have got it working, this video is a almost a month old and I have already fixed portaling angle (while breaking roomscale movement...)

So the UI is rendered to a texture as well? I have hooked DrawSelf to make the crosshair better indicate where portals are being aimed at and I'm having an issue where the UI is not being rendered in the entire screen (its being cut-off in a region the same size as the game's resolution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants