Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by hijinxbassist · Jun 06, 2012 at 09:01 AM · verticestriangles

Vertices array in mesh vertices

Is there a specific way that unity adds vertices to the mesh.vertices array? Does it differ from mesh to mesh/program to program/ or is it just random altogether(or based on many variables)? I guess all the tools are there for me to determine that the index is of each vertex in a specific mesh, but if they are added to the array in a specifc order i can cut down uv/normal calculations(this would be very optimal if you can hint to how unity handles importing a meshes vertices).

Im still working out the whole uv/normal calc for each vertex using references here from other answers like: @bunny83 's post about http://answers.unity3d.com/questions/259127/does-anyone-have-any-code-to-subdivide-a-mesh-and.html>subdividing and @Statement 's post about http://answers.unity3d.com/questions/52728/fetching-triangles-from-a-3d-mesh.html>fetching triangles. I actually got inspired by Lasse 's answer to @Fattie 's question about finding http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html>nearby triangles, which is basically exactly what i am doing. I want to set up a tree for an equal planes triangles(unitys built-in plane for now)(quadtree built from Start() ?) , i suppose thats the most relevant part of my question/inquiry other than order of vertices in the mesh.vertices array.

Sorry for the compacted question/answer post, hopefully it will inspire others as it has me. I look forward to your insight on this, ive been pondering this question for days now and just trying to figure out the best method before i type it all out(cuz ill probly get lazy and not continue research if i type it out first, at least 'til it becomes a problem :P).

Comment
Add comment · Show 3
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 Fattie · Jun 06, 2012 at 09:54 AM 1
Share

"Is there a specific way that unity adds vertices to the mesh.vertices array"

Unity does not add the vertices: it would be like asking, "Why does microsoft word choose to write a particular type of novel?"

Furthermore, there is a deeper very important point to understand.

in 3D models generally (forget about unity, which is just a tool that USES 3D models), there is NO $$anonymous$$EANING or ORDER to the vertices.

Even very sophisticated programmers often do not understand this. Your question is a ver good one.

avatar image hijinxbassist · Jun 06, 2012 at 10:18 AM 0
Share

@fattie thanks, i appreciate this simple clarification. I kinda figured that at the very least a program like 3ds$$anonymous$$ax would somehow 'know' where the vertices are(order wise) so they can somehow be 'arranged' in an fbx export. But i suppose its more of a decipher job than an ordering job, which makes more sense from a program$$anonymous$$g standpoint. Thanks for that, im beginning to piece it together. It seems like the more time i spend, the easier a modeling programs functionality s become(other than well optimized procedures, which i suppose is...everything :X). Wish i knew that type of smarts right - now, lol. but dont we all... Thanks again.

avatar image Fattie · Jun 06, 2012 at 10:23 AM 0
Share

it was incredibly bizarre to me when i started out that the 3D pipeline has no knowledge, at all, of tri positions. But, that's life!! again that other question linked to is basically a massive investigation of the issue "how to find nearby tris". really the answer is you just do it yourself.

some difficult issues arise conceptually, like, what do you "mean" by nearby, what if there's a very small gap, etc!

pls do not hesitate to up-thumb any long-winded answers that were helpful :-)

2 Replies

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

Answer by Fattie · Jun 06, 2012 at 10:08 AM

You have hit on an incredibly critical point here, jinx.

(1) Unity merely uses 3D models, it does not make or decide on them in any way.

It's important to note that even very sophisticated programmers often misunderstand this.

For example,

http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html

Note that someone was saying: "It is an absolutely true statement that Unity shares vertices where it can. There is no situation where this is not true." ... that statement, is utterly incorrect.

but more importantly - the statement doesn't even make sense. It would be exactly like saying "Microsoft Word only produces crime novels where possible, it never produces action novels" It simply: makes no sense. You could MAYBE say something like "MAYA shares vertices where it can". (That claim would be totally incorrect and demonstrate a misunderstanding of 3D models.) But the sentence "UNITY shares vertices where it can" is just utterly meaningless - UNITY is to 3D models as your Laser Printer is to Novels. Your laser printer does not make any decisions on anything such as the plot or characters in your novel :-)

Moving on to the meat of your question.

(2) There is absolutely no - utterly no, whatoever - "rules" about vertex placement in 3D models.

it is very mportant to understand this, and again, even many sophisticated people do not understand this. People not unreasonably think that 3D models must "understand" surfaces, or that 3D models have verts in some arrangement. Again it is totally untrue.

You can read about this at vast length in the yellow comments on the images here

http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html

Finally! the true meat of your question!! As you said I'm basically trying to create a quick reference for touching tris...

The answer is!

(3) Unfortunately - and very surprisingly - the 3D pipeline has absolutely, definitely, NO idea about the location of any triangles.

This was very surprising, incredibly surprising, to me when I first was fooling around w/ the 3D pipeline. But that's how it is. It all makes perfect sense when you get in to it. But the bottom line is, that is exactly what i was asking in this question, just like you "I'm bascially trying to create a quick reference for touching tris"

http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html

So unfortunately the simple answer to your issue ("I'm bascially trying to create a quick reference for touching tris") is that you just have to, when you start up the app, look through the mesh and on your own, build a list (or whatever you want) with the information about touching tris.

Very simply, loop through each tri, look at each edge, and then loop through for a matching one. (again it is discussed at vast length in that other question!)

Hopefully this long-winded reply is of some value to you or others!! Cheers

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 hijinxbassist · Jun 06, 2012 at 10:34 AM 0
Share

Thanks! i appreciate you taking the time to explain this. I suppose it isnt as cut and dry as i had originally thought, but it isnt as bad as connecting a nuclear power plant to an outlet(just a guess :) ). Im just hoping it wont take too much to loop through all the given tris of a single mesh..obviously the more tris the more work, but as a general incentive im gonna test the average fps drop between 100 tris and maybe 1,000 or 10,000 to get an idea and set a warning limit/per resources available. I appreciate the help, im working on a procedural script which should be on the asset store within a cpl weeks...hopefully, though time seems to fly by these days. Ill let you, and all the others that helped me out know when its done so you can have fun testing it out if you so desire!

avatar image hijinxbassist · Jun 06, 2012 at 11:00 AM 0
Share

Read your question...in its entirety(man theres alot of back and forth and tons of comments), but i understand it much better looking at it with fresh wine soak-en eyes o_0. Any-who, im gonna give it my best shot in the A$$anonymous$$ and im sure ill get much more accomplished with the added support. Thanks again.

avatar image Fattie · Jun 06, 2012 at 01:19 PM 0
Share

You will be pleased to hear, it is unbelievably fast to loo through the tris/verts like that looking for friends. it's one of those things where you worry about performance but it proves to be no problem.

I suppose, quite simply, it's just a blazingly fast native array (ie "some memory in a line") so it is damn fast.

typically it is something you do n start up, but it is so fast you could do it in realtime, really.

Don't forget too, you may well want to do it at BUILD TI$$anonymous$$E, and then the information is there locked in and you can just look it up instantly in a list or whatever.

Ask anything any time

avatar image
2

Answer by Eric5h5 · Jun 06, 2012 at 09:27 AM

There's no order other than what you supply. If you say "mesh.vertices = [Vector3(1, 1, 1), Vector3(2, 2, 2), Vector3(3, 3, 3), Vector3(4, 4, 4)];", then that's the order. If you're asking does Unity rearrange them for any reason, then no, it doesn't.

Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

Easy way to convert a bunch of vertices to triangles or uv's? 1 Answer

Connecting flatshaded vertices 0 Answers

Can you apply smoothing to split vertices on a generated mesh? 1 Answer

Problem drawing a mesh with Graphics.DrawMeshNow 1 Answer

Unique Triangles 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