- Home /
Render VBO on GPU through MeshRenderer
Hi all, is there a way to load a VBO in a buffer on the GPU and tell Unity to render it through a MeshRenderer? Thanks in advance!
Answer by Bunny83 · Jun 08, 2015 at 12:30 PM
Your wording doesn't makes much sense. A VBO is a vertex buffer object. A VBO is by definition stored in the GPU's memory. And yes a MeshRenderer uses a VBO to actually render the mesh.
Sorry, probably I was not clear enough. What I meant is the following: is it possible to manually allocate a buffer on the GPU and load a VBO into it (let's say through CUDA), and then tell Unity to render that particular VBO through a $$anonymous$$eshRenderer?
No, not without native code plugins. Unity is a high level development environment. What's the point of manually allocating an VBO?
Unity abstracted the concept of a VBO(OpenGL) / VertexBuffer (Direct3D) with the $$anonymous$$esh class. What would you do differently than Unity? To update the content of a VB you always need to allocate system memory where the content can be stored and then uploaded to the GPU. You don't have direct access to the video ram as it isn't system memory.
btw: a VBO is an object on the GPU. When you "lock" the buffer Direct3D allocates a temporary memory section in the system memory and copies the content of the VB into that memory. When you unlock it, it does the reverse. For OpenGL it's a very similar procedure. By calling glBufferDataARB you copy data that is located in the system memory into the VBO.
But again, what's the point?
For example, for updating the positions of the vertices in parallel through CUDA and avoiding data transfers between CPU and GPU in every frame. So, do you know how (if possible) could I do that through native code plugins?
Well it should be possible with low level native code plugins. Unity also provides compute shaders to do calculations on the GPU.
Have you actually any experiance with CUDA or really low level rendering in OpenGL and / or DirectX?
Further more, at least in the past, native code plugins was a Unity pro only feature. However it's not really clear anymore since the Untiy website is, well, chaos. At the moment it's near to impossible to get a clear list of features. If you have Unity pro that shouldn't be a problem for you.
Sorry for the late response. I know I could use low level rendering with native code plugins, but what I was asking is: can I still take advantage of $$anonymous$$eshRenderer components if I want to use VBOs loaded in low level plugins? If so, how can I do that?
Your answer
Follow this Question
Related Questions
How does Mesh.CreateVBO work? 1 Answer
ECS mesh dissapears on camera move in Game or Scene 0 Answers
Mesh Renderer glitch when switching its parent 0 Answers
Better model? Use Mesh clipping or add more vertices? 0 Answers
Weapon system 0 Answers