Rendering the world from the perspective of a remote object

This one’s a doozy but I’m curious nonetheless. I’m looking to have an object and have the interior of that object away, outside the main world. The object (e.g. a plane or a space ship) can move freely as it likes however the interior remains stationary and allows the player to run around inside it. The interior will be larger than the object but it will be proportionately to scale.

I’m trying to get it so that if the player looks out a window, instead of seeing a blank wall he will be looking at the outside world, as though he were standing in the main object and looking outwards. I’ve attached a diagram below.

Has anyone had any experience in simulating the camera like this?

mind= blown. how the fuck would you even do this?

I had a running theory that you could out the interior in a box with the “NoDraw” texture which, if left as-is would do the hall of mirrors. If you rendered the outside first and THEN from the player perspective (inside), the area that would normally show the dreaded “hall of mirrors” would show what was rendered a step before, the outside. Effectivly, it would use the “NoDraw” as a transparency

Pretty simple, really.

First, you need to add the object to the player’s pvs - maybe AddOriginToPVS( pos ) in GM:SetupVisibility( )

Then, in RenderScene, you will need to call render.RenderView with a viewdata struct set up to be originating and facing out from the side.

Since it involves a window ( and thus not rendering to the screen ) you will need to draw the scene to a render target ( or multiple render targets for multiple windows ).

You could look at the code for the RT Scopes in Customizable Weaponry to get an idea of how to do this.

I knew there was something like that, I can’t wait to finish work and try it out.
I was thinking that if I made the object invisible to players inside it and moved the position that the outside is rendered from relative to where the player is inside the interior, that would make an accurate simulation. But hey, I won’t know squat until I try.

Seems like looking at this addon should help you out, seeing as it does exactly as you described.

Hmmmm… I’ve run into a Snag. It renders the first frame but even though I’m giving it a new pos and angles each tick (following the object) the render doesn’t change until I leave the room and come back, but then it just keeps a new from, still not advancing. Any thoughts?

Kinda like this actually;

Instead of seeing the metaphorical cat in constant motion, I have to leave the room and come back before it will update the frame.

My brain may have hit paydirt. Instead of rendering with the 3DCam still with the player, I might have to move the camera to the object and then render the player’s view on top of that. Damnit work, why can’t you be over faster?

Fixed it, that’ll teach me to skip ahead. Needed to AddOriginToPVS on the server to keep the main area constantly loaded. Kogitsune, I could kiss you.