Facepunch / garrysmod-requests

Feature requests for Garry's Mod
86 stars 24 forks source link

Add feature to draw using render.RenderView or the CalcView hook through area portals #1861

Open mcNuggets1 opened 3 years ago

mcNuggets1 commented 3 years ago

Details

Using render.RenderView or CalcView to alter the player's view position to somewhere entirely different, creates problems with area portals. Those scenes behind area portals are only drawn, when using Spectate or SetViewEntity? and otherwise won't draw properly.

As with FSpectate, it's not possible to use either of those functions, because players would know, they are getting spectated and the free roam mode wouldn't support it.

In my case, I wanted to create an RT camera like addon, but the problem with it is, it can't draw through area portals, despite correctly using AddOriginToPVS.

Here's a screenshot on how render.RenderView draws through an area portal. https://i.imgur.com/whxbsRd.png

Tested on rp_newexton_v3x_v2 All maps with area portals are affected.

thegrb93 commented 3 years ago

So basically the engine modifications done in Portal

robotboy655 commented 3 years ago

Possibly related issue https://github.com/Facepunch/garrysmod-requests/issues/467

robotboy655 commented 3 years ago

I have looked into this and it's not as simple as "add a function". The problem stems mostly from func_areaportal_window. Basically the opened/closed state of area portals is calculated on the server and then sent to the client via a bitflag. This also is used to determine which entities to send updates about (which map areas/rooms to update) for a specific client.

This makes it quite difficult to get a fix on client.

mcNuggets1 commented 3 years ago

There is OriginAddToPVS. Maybe there could be an equivalent which does send angles and direction.

I'm not so into the engine implementation itself, so I might only be guessing