• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by pmerilainen · Jul 11 at 09:36 AM · meshoptimizationtriangleslod

Sharing vertex buffer between mesh objects

Is there possibility to share vertex buffers between Mesh Objects. I have baked some bezier patches to Mesh objects. I would like to create a LOD version of a bezier patch; can I re-use the vertices from one mesh and just use different triangles (index buffer) to reduce poly count. This is trivial to do with pure graphics API but I have not found a way to do it with Unity meshes.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Bunny83 · Jul 11 at 10:18 AM

No, Unity does not support that. A Mesh instance actually "owns" its native vertex and index buffers. Unity provides methods like "GetNativeVertexBufferPtr" for native code plugin usage. However there is no way to set the vertex buffer of a Mesh class instance. You would have to assign the same vertex array / List to both Meshes which of course would duplicate the vertex buffer on the GPU. Though since you said it's pre baked it would make more sense to actually use a trimmed down vertex list as well.


However if it's important for you to save GPU memory you can do this if you handle everything in a native plugin. Of course native rendering plugins have to consider the actual used graphics interface which is different on most platforms. For more information see NativePluginInterface

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image pmerilainen · Jul 11 at 10:40 AM 0
Share

Seems to be more trouble than it's worth then. I was just thinking to replace far-away patches to meshes with simpler geometry; but the GPU memory is more important than the minor performance gain I can get from reducing polys. (in my system there are already simplified shaders for faraway objects etc..).

avatar image Bunny83 pmerilainen · Jul 11 at 10:51 AM 0
Share

Keep in mind that Unity already has an LOD system. All you have to do is provide seperate meshes, name them with the right suffix and use an LODGroup

avatar image pmerilainen Bunny83 · Jul 11 at 10:59 AM 0
Share

Yes I am aware of that. I am using procedural bezier patches in my own terrain system (allows overhangs and stuff) so I decided to incorporate custom LOD system for it. It would be trivial to create LOD versions of the patches on the fly but it wastes quite a lot of memory (bez patches have relatively high triangle counts) so I think I will not use any polygon reduction LODs.

For static objects like cliffs the builtin LOD system works well though.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

130 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Ways of modificating mesh triangles 3 Answers

Huge GC Overhead When Accessing Tris/Verts From Mesh? 2 Answers

Too much meshs are to optimize. 0 Answers

Best Way to Link Vertices into Mesh 0 Answers

Raycast - Add tris (script inside) 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges