Vertex data stored in VRAM?

I’m wondering how the location data for vertices are stored for objects that are not in render view.

If I had a scene with a ton of unique objects, but most of those objects were not in render view, how are they being stored? Are the locations of all of their vertices being stored in memory? Is it only storing the location and rotation data of the object itself, and then quickly accessing the vertex data from its .fbx or prefab as it comes into view?

I’ve been told that vertex buffers and index buffers are stored for all objects in the scene. Is all of that data is VRAM? Or is there something the engine does to only bring it into VRAM when the camera is within a certain distance?

If I’m targeting a card with 128 MB of VRAM, will I have to take the size of all the vertices in the entire scene into account in addition to other things like texture size?

Largely educated guessing here. It will be dependent on the amount of memory pressure the system is under at the time. If the whole level can fit into VRAM why would you bother removing vertex data.

Vertex Data (positions, indexes) , shaders, textures all are potentially stored in VRAM so yes.

I would say mesh data is almost always stored in at least system ram if it is to be rendered. So generally upon loading a level unless you decide to stream off disk or other medium.

Also you want to take into account instancing. The same mesh and texture objects drawn multiple times don’t take up much extra memory.

You can look at the VBO data to see how many meshes there really are in VRAM.

Generally even if they are requested to be in VRAM, the driver will overwrite any data not used to render at the time with data that needs to be there to render the frame. As OpenGL has no management layer at all like DX has it, the stuff is generally in RAM and only in VRAM when requested and bound for rendering and gets then sent there. I’m unsure for what objects unity has persistent VBOs at all, but for sure for nothing thats under batching control, neither dynamic nor static, as they are constantly changed.

So, hypothetically, if I was running on a PC with 2 GB or RAM and 128 MB of VRAM, should I be able to have a scene with 500 MB worth of small meshes spread over a large level without any performance implications? As long as I made sure that the amount of objects being rendered at any one time are under the 128 MB VRAM limit?