Camera world rendering issues

Hey guys. So I added a simple barebones hook to “CalcView” in attempt to move the player’s camera temporarily on my gamemode. All it’s doing is writing the cam.origin and returning that new table. Nothing fancy. However, I’m running into an issue where the world doesn’t load unless my player is near the area in the map that the camera is focusing on. This is understandable because I’m sure the engine is supposed to function like that; drawing the world only when the player can see it. Here are a couple screenshots of the event just for better representation.

The first screenshot is the camera angle with my player in the area. World rendering is just as it should be:

The second screenshot is the exact same camera angle, except with my player across the map. You can see that the textures are invisible and you can see straight through the wall of the building. Looks terrible from the player’s perspective:

Like I said, I know this is happening for a reason, and a good reason. My main question is, is there any LUA fix I can do that will allow me to tell the engine that the player can see this area so that it renders? Or force the world to render as a whole temporarily? If not, what kind of workaround can I do to achieve the image I’m looking for?

Possible Solutions:
Teleport Player To Area - One idea I had was to freeze the player’s controls, make him invisible, and teleport him in the area that the camera would be looking at. My issues with that are a bit extensive… this sounds like a terrible way for performance to achieve this. Also communicating serverside from clientside to change the user would be hellish and may lead to lag on the server I would think. Also, I would like the player to be able to look around freely, so there is no way of telling what he would be looking at at any given time. Teleporting the player continuously wherever he looks sounds like a terrible idea… just a thought.

Serverside Player Lock - Another alternative I thought of would be to avoid the clientside implementation of this completely. Strip the player of weapons, disable his gravity, make him invisible, hide the HUD, and simply place the player where the camera angle should go. This way, the player could look around just as if it was his camera and the world would render just fine because, to the engine, it would be no different than the player walking up to the building or looking from a distance. A reason I don’t like this is just because it’s serverside. I like to keep these kinds of features clientside only… it just seems better for the server and cleaner on the gamemode’s end. Also I plan on animating the camera eventually, and animating the player from the server doesn’t sound like a very good idea with prediction and all.

Obviously, the ultimate solution would be what I mentioned above. This would be to just call some kind of clientside function (not sure if it exists or not, I’ve done my research but with no avail) that would tell the engine that the player can actually see the area and load it. Or something that would tell the engine what the player can see from the new origin.

Also, I noticed that this same behavior happens if I load into Sandbox and use the Camera STool.

Thank you for your help.

You could probably try this http://wiki.garrysmod.com/page/Global/AddOriginToPVS

Hey Matt. Thanks for the response. I didnt know that function existed so thats good news! So can this be called whenever? Or just on the SetupPlayerVisibility? Also, if the camera is animated to where it moves, would I add multiple points to this function?

You can only do it in that function and you just add the current position of the camera.