Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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
0
Question by MichaelDN · Jan 13, 2018 at 10:40 AM · c#scripting problemmeshruntimeefficiency

Runtime mesh decimation

Hi everyone I'm currently trying to develop a c# script for unity for my thesis at university that aims to decimate the mesh of a model at runtime (namely in game) when the FPS count is a bit over the 60fps

what I wonder is if it really is possible to do such a thing I tried a few ways to decimate the meshes but none of them worked

does anyone have any suggestion? thanks in advance for the help

Comment
Add comment · Show 4
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 Bunny83 · Jan 14, 2018 at 11:59 AM 1
Share

There are many things not clear in your question. First of all what do you mean by "decimate"? A $$anonymous$$esh simply consists of vertices and triangle definitions between those. If you aim for lowering the triangle / vertex count for arbitrary meshes that's not possible. This is generally called "retopo" but usually requires user steps in order to produce any useable output.


Second as mentioned already, what kind of meshes do we talk about? Even if you find some automatic way to reduce the poly count it won't work for an arbitrary mesh. If you remove / reduce certain parts of a mesh it will no longer look right. A good example is the Utah $$anonymous$$pot (i made this one). The Utah $$anonymous$$pot however is 100% procedurally generated from nurbs surfaces (you can see the control points when you enable "control"). If you set the U and V resolution to the $$anonymous$$imum the lid handle would basically disappear. Also the spout as well as the handle would be just a flat surface.


Finally you haven't mentioned what the overall goal is. What does the framerate has to do with this? Reducing the triangle count doesn't really increase performance. The number of drawcalls / setpass calls usually has a much greater impact. Since Unity is limited to 16 bit index buffers a mesh is limited to 65k vertices.


The question is way too unspecific. You should edit / improve your question to make it more clear what you actually want to do. UnityAnswers is for concrete technical questions about the Unity engine and development with the Unity engine. Yes you can manipulate a mesh at runtime in Unity. The rest of your question seems to be related to an algorithm which you didn't specify.

avatar image MichaelDN Bunny83 · Jan 25, 2018 at 03:28 PM 0
Share

thank you for the answer, what I am trying to do is indeed a retopo of a mesh; unfortunately I am not very expert with unity and I don't know of a good algorithm that is able to do so. I tried to ask here hoping that someone could give me an advice

the final goal is to verify if it is a valuable possibility other than using the LOD system

avatar image Bunny83 MichaelDN · Jan 25, 2018 at 05:22 PM 0
Share

Creating a retopo automatically isn't an easy task and doesn't necessarily work for arbitrary meshes as it's difficult to tell what general shape the mesh has and what would be important to preserve the overall shape. Some modelling tools offer an auto retopo feature but i don't know any artist who has ever used it. Our artist created the models in 3ds $$anonymous$$ax and refined it in z-brush. Finally he created a retopo manually in 3ds $$anonymous$$ax (by specifying new low poly edges on the surface) and created a normal map from the high poly model to perserve the details. So in the game we just used the low poly model with the normal map.


An algorithm is nothing that is specific to Unity. A mesh consists of vertices and triangles. Unity's $$anonymous$$esh class gives you access to those. Everything beyond that isn't really related to Unity. Creating a retopo is probably more complex than finding the convex hull of an arbitrary object. Finding the convex hull is also a quite complex problem and also doesn't have a simple solution. Doing a retopo would actually be slightly related to finding the convex hull with a lower number of vertices. Just that the result shouldn't always be convex which makes the problem even harder.


Since it's a thesis you should have thought about how it might be accomplished beforehand. $$anonymous$$eep in $$anonymous$$d that every thesis can either be proven or disproved. Of course it's not good when the reason you can't proof it is that you failed to implement an algorithm that does what your thesis relies on.


So in short, no i don't have an algorithm that does what you want.

avatar image meat5000 ♦ · Jan 25, 2018 at 06:44 PM 0
Share

So if someone comes up with an answer for you then you are committing Plagiarism and can get you kicked off your course and Arrested! Sorry to tell you this.

In my humble opinion what you are trying to achieve defeats the purpose : $$anonymous$$esh manipulation is pretty intensive given the work required. To perform this as a cycle-saver surely would not work as a result.

You will need to perform Decimation in advance (Blender makes this easy) and save the models ready for use. Its then a simple case of enabling and disabling GameObjects to swap out. I know this is not what you're after but this is how its done in AAA. Good luck in your endeavours.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ZnCroXD · Jan 25, 2018 at 03:34 PM

That is currently on exist, is called LOD (Level of Details), this works with the distance at the camara render the objects (if is too far, will be more decimate) may be u can use teh API to make the LOD system Decimate the mesh with the Time.framerate variable.

Comment
Add comment · Show 1 · 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 Bunny83 · Jan 25, 2018 at 04:34 PM 0
Share

The LOD system in Unity does not reduce the mesh automatically. YOU have to provide the different levels of detail. The LOD system just helps you to select the appropriate level depending on how large the object would appear on screen.

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.

Follow this Question

Answers Answers and Comments

433 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 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 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 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

Why is my job running slowly the first few frames then speeding up? 1 Answer

How to detect when two colliding objects create a corner? 1 Answer

Mesh Creator (editor script) At Runtime 1 Answer

Multiple Cars not working 1 Answer

TextMesh/3DText modify shape 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges