Wednesday, June 6, 2012

OpenSim and Mesh - Understanding the Misunderstandings


The Situation

I'm not here to start a flame war. I feel that a lot of the anti-mesh sentiment is a result of misinformation, bad experiences, and a whole slew of other issues that are not the fault of the mesh format at all.

To be fair, as a reference, I have experience in all three forms of geometry building: prims, sculpts, and mesh. Not just small glances. I have done full scale, thorough projects using each. So please, keep an open mind, and listen to what I have to say. I'll do my best to be as clear as I can.

Invalid reasons to despise mesh:

  • Your viewer doesn't support it
    • There are very few viewers that are still in active development, that do not support mesh.
    • Your viewer is still your choice- but remember, it's only your choice. Don't try to force the decision on someone else.
  • It breaks the collaborative and seamless in-world experience.
    • You're going to have to read to the end to see this one. :)
  • You can't export mesh
    • Well, yeah, that's sort of a good thing. You don't want people downloading your assets. If you already have the 3D model on your hard drive, the very nature of mesh allows you to upload entire linkset-style scenes without having to resort to XML files. Nothing changes, build once, upload everywhere.
  • You don't know how to use a 3D modeler
    • In the old days, Blender's interface really was pretty bad, but since 2.5 on, they've re-factored their interface and it's actually a slick, powerful, even intuitive.
    • If you've been exclusively a prim modeler and have no interest in using a 3D modeler, that's fine, but still read on and see what I have to say. You may warm up yet.
  • You don't think you can learn to use a 3D modeler
    • This is simply just not true. ImagineFX and 3DWorld magazines are full of self-taught digital artists. Sure, a school can help, but the wealth of knowledge out there hinders nobody from getting into it.
    • It can be scary at first, I admit. I was there- but having friends who can help, going to the irc channels.
  • You've become frustrated with a 3D modeler
    • We've all been there- I've been there. It's not the program's fault (but sometimes we like to lapse and claim it is ;) ..) The truth is, you may have run into a limitation of that particular package, or someone just hasn't shown you how yet. Be patient, google, ask, and persevere. This is one of those "if it was easy, everyone would be doing it" sort of things. You need to put in the work if you want to stand out. It's the same drive you used to learn how to build with prims and script, it's just taking a little longer.
  • You've been burned by a 3D snob
    • This is the worst, and I don't understand where they came from, but I've been seeing a lot of people think that because they either went to school for it, or learned how to use a program, they're suddenly better than anyone else in 3D. These guys ruin it for everyone.
    • What's worse, they even fight among themselves, claiming one package is better than the other. Stay away from these battles, they mean nothing in the end.
    • At all else, usually asking them for their portfolio tends to shut them up. If someone feels the need to gallivant their prowess around, more often than not, they have nothing impressive to show. Serious digital artists tend to be more focused on their craft than convincing you they're the best thing since sliced bread and youtube cats. Even if they are good, all the more reason to beat them at their own game.

A Quick Primer in 3D Graphics Cards


On the most fundamental level, everything rendered in the SL viewer is composed of triangles, and textures mapped onto those triangles. Prims, sculpties, mesh, avatars, it's all composed of triangles.

The graphics card sees everything in this manner:

Source: http://www.esiee.fr/~perrotol/TheRedBook-1.0/chapter02.html

These are the "primitives" in the belly of the beast. You see cubes, cones, pyramids, and spheres. The graphics card only sees these. The very molecular structure of the virtual world.











Ok now let's see that in a way that actually makes sense:


OpenSim scene on let, same exact scene in wireframe view on right (ctrl+shift+r)
In this manner, the currency of your video card is how many triangles it can render in a fraction of a second. So, for example, if your video card can render 1.5 million triangles every 1/33rd of a second, your frame rate is 33fps (frames per second).

However, when your graphics card cannot render all the triangles in the scene in a short enough time, it will draw the scene fewer times per second. So, for example, if the scene is so heavy, your card can only draw the scene 5 times a second instead of 33, you get what we call, jokingly, a slideshow, or more appropriately, "lag".

What this means for you as a builder, is that when you overload your scene with too many triangles and too many textures, that 32,000 prim masterpiece may run so utterly slow, that visitors run screaming, because they can move their camera maybe once every 5 seconds.

Efficiency

Prims, Triangles, and Mesh



What does this prim and the mesh cubes have in common? They have the same amount of triangles.

That's right. The single prim cube on the left takes the same amount of effort for your graphics card to render as the 9 mesh cubes on the right.

I made texture mapping of the mesh cube match that of the prim cube. The only thing you can't do with the mesh cubes that you can do with the prim cube, is torture it.

Let's zoom in and compare.

Prim Cube: I did the math in the picture for convenience. There are 108 triangles on that cube, you can even count them.
Why are there so many? Prim torture. These shapes are mathematically generated by the parameters sent. Bandwidth-wise, they're great. Viewer-side, not so much.



Mesh Cube: You can see here, the mesh cube uses 1/9th the amount of triangles that the prim cube uses. It's as few triangles as you can get to create a cube. The mapping is the same, as you can see by the coloring I did on the faces.



Sculpties, Triangles, and Mesh

Ok, this needs to be covered. A lot of people have trouble telling the difference between a sculptie and a mesh. A sculptie is a square grid composed of 2,048 triangles.

single sculptie is equivalent to ~20 prim cubes, and ~171 mesh cubes.

That deserved to be bold. Let's look:


If you've been following everything so far, this should horrify you, and guess what-

We're using these things all over the place. Sculptie hair uses 10, 20, or more of these pieces. Rocks, birds, shoes, socks, toes, avatars- sculpties have found their way into every part of building- and for what was available at the time, they were great- but we have a better format available.

I could fill a blog post on the differences between the two, and if enough people want me to, I may, but let's keep this short, sweet and to the point. 


Props to whoever made the ubiquitous "noob". :)
Sculpts require many, many, individual pieces which must be exported from your 3D modeler of choice, and arranged properly inworld, by hand, with the build tool, resulting in things like this:










Want an example of how mesh changes that? Wireframe your own avatar body.
The true virtual reality of it all.


Hammering it home about prims


I really must reiterate, and hammer this in. Prims are just mathematically generated sets of triangles. You can pass them funky parameters and get some really broken shapes. To demonstrate, I grabbed Phoenix and rezzed some of their "extra" prims, in which they added options that send parameters to the viewer you can't normally access. This is all from the build tool:




Really, it all comes down to triangles. Prims get triangles into the scene by mathematical generation, sculpties do it by by applying modifying the placement of all the triangles in a predefined grid. Mesh is the most unconstrained method of all, because you can define where every triangle goes, and how many there are.


That's it. That's the big deal about mesh. It just gives you fundamentally direct access to to viewer's most basic geometry type- the triangle. That's something the previous two methods did not give you. It lets you be efficient, and precise.

Keeping the in-world experience "seamless"


I would be a complete and utter hypocrite if I tried to claim that everyone should use mesh for everything. That's not the point of this whole exercise. I'm terrifically guilty of several thousand prim builds:




It's true, prims feel great to use, and in many cases, they're good enough. They get the point across and provide an easy way for someone to get up and be creative in a fun way, with little effort. Mesh does not mean this has to end- not in the least.

In fact, mesh can mean new in-world tools for prim builders.

Let me explain.

If you've been following so far, you understand that a prim is essentially a mesh that is generated mathematically. In this manner, a prim is really just a mesh with settings, and predefined faces.

Well you can make your own primitives, for future reuse:



In the above picture I made a simple shape (a doorknob if you have enough imagination :P ) and I custom defined its faces. Now I have essentially a "doorknob prim" that I can re-texture and reuse however many times I want, and the only difference is I have to rez it from inventory instead of the build tool. (Well, you can't torture it either, but if you made the shape,  you shouldn't need to).

Important to note, this is an example of a more complete object, most prim builders will create a linkset of individual prims. The benefit of the mesh method is that you can do more intricate designs, or irregular base shapes, more efficiently, and define their faces so you can reuse them however you like in the future.

Yes, you still need to make that basic shape, or maybe others will make them free for you to use, but in the end you're manipulating them the same way you would manipulate prims, you just have more freedom in how you want to define your prims, and aside from actually creating the shape- once it's made, you can stay inworld and do not break the seamlessness.

One more example

Personally, when it comes to architecture, I like to use prims as a drafting medium- and optimize later on. Here's an example of a mesh version I created of a prim floor my friend had made for me:


In the end, we chose to keep the sim non-mesh, to suit people who still insisted on using non-mesh viewers. 

For my own projects though, any avatar I create will always be mesh :) I've put away my sculpties for good.


Why is this all so important? What does it have to do with OpenSim as a whole?


The more ambitious our projects get in the open grids, the more demanding the requirements will be on ourselves as well as our fellow viewers. If what you're working on fits within the confines of your resources, and the resources of your target audience, that's one thing..

.. but when you start reaching into the geometry count stratosphere of your sim, your visitors are going to feel the slowdown- and that's why it's important to OpenSim that mesh be allowed to flourish. Because of the platform, I've seen users build worlds that are simply immense in their scope. Unlike SL, we can afford to cover clusters of sims, and make them feel like a continuous world. If we're to continue being world builders, we need to understand the limitations of our tools.

45,000 prim cubes = 4,860,000 triangles
45,000 mesh cubes =   540,000 triangles

Mesh easily fits into every level of building there is. If you're going to give it the thumbs down, please, at least consider that you may be blaming it for something that's not its fault. (See top, invalid reasons to despise mesh).

It's just a format with an immense potential, and I never saw anything wrong with more tools in the toolbox. I don't like to hammer in screws.

19 comments:

  1. Excellent presentation about mesh ! Thank you for your clarity.

    ReplyDelete
    Replies
    1. Thank you very much ^^ I was getting getting a sore throat trying to explain these things to friends without it becoming a shouting match, so I thought maybe if I laid it out with tons of pictures, there would be less of a clash :)

      Delete
  2. Awesome explaining, Raz.

    Now, where can you go to learn how to make these? :)

    LOL

    John

    ReplyDelete
    Replies
    1. Hey Shep, this is a good start :) http://www.youtube.com/watch?v=VmOFRkRjOSQ

      Delete
  3. outstanding and much needed explanation!

    ReplyDelete
  4. Thank you this is a great breakdown of the differences :)

    ReplyDelete
  5. That's nice way of teaching maths geometry to kids, I am here to share simple definition of triangle.A triangle that has all angles less than 90°and Right Isosceles Triangle has a right angle (90°), and also two equal angles.
    What are Vertical Angles

    ReplyDelete
  6. At last I put the right keywords in google and found this page
    This was very useful. Thanks.

    ReplyDelete
  7. Awesome article. This should be mandatory material on any discussion of mesh-vs-sculpty-vs-prim. Thank you, I've used you as a reference!

    ReplyDelete
  8. Great article!

    Just my two cents: I've spent a great deal of time working with both mesh and prims and determining the strengths and weaknesses of both. In a nutshell, I've found through my own experience that prims are more suitable for structural elements (floors, etc.) due to our ability to powerfully/easily manipulate them in-world, while meshes are more suitable for independent objects (furniture, etc.) due to our creative control in 3D modeling software.

    I'm a huge fan of mesh and have been modeling mesh in Maya for several years (even before my involvement in OpenSimulator), and the only real weakness I see is that mesh can not be manipulated in-world to the degree that prims can, which makes mesh buildings more difficult to create. If some of my faces or edges aren't positioned correctly, for instance, I have to fix my mesh in Maya, reimport, reposition (linksets are beautiful things), and play the "trial-and-error" game until it looks right. However, the pros definitely outweigh the cons, and I think that mesh and prims complement each other very, very well. :)

    ReplyDelete
  9. You are so right, thank you for writing this. Will use as a reference it is much needed.

    ReplyDelete
  10. Brilliantly clear and easy to follow. I have to admit resistance to learning mesh. It just seemed so much more to learn when I am fine with prim's and sculpties but, after reading this, I have to think again. Thank you.

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. "However, when your graphics card cannot render all the triangles in the scene in a short enough time, it will draw the scene fewer times per second."

    Ahha! finally someone makes sense, until now I have not seen anything that really decribes what the difference between cards is besides price, as my "scene" looks good I can't imagine it any clearer or better, but your description says it all- obviously the better cards will render FASTER, thus, the 15 fps I always got in world would be maybe 30 with a better card!

    ReplyDelete
  13. I just link your article that finally made me understand the differences, thank you and congratulations for your explanation clear and objective
    greetings

    ReplyDelete
  14. Great piece. Bookmarked, framed and hanging in my hard drive. One question: Where you wrote
    "...if your video card can render 1.5 million triangles every 1/33rd of a second, your frame rate is 33fps (frames per second)"
    ...where is the 1.5mil in the FPS? Is 1.5mil a standard of sort?

    ReplyDelete
  15. I'm an old school prim builder and until recently (within the last year)I began using LK scuplts. I never learned to make my own although Lordy did I give it the old college try. Too many buttons for this old mind to digest. Any way... this morning I woke up and said to myself "learn mesh"! I never was for or against mesh (or sculpts) labeling it in my mind as evolution progress of the world environments. The future moves forward. This article really made me understand why mesh will benefit our worlds overall. Bingo! crystal clear! I did well in Geometry (in the 8th grade back in 1963) he he so I was able to follow and I am so glad I could. The pictures really made the difference to me as I'm a more visual learner than audio. I think I do agree with Chris Daley about prims still being best for floors (and maybe other items) since we walk on them. Bookmarked, shared and now really looking forward to learning mesh. Thank you!

    ReplyDelete
  16. Nice article! However there are a few points which are somewhat outdated. Number of triangles are less important now with modern graphics cards than they were a few years ago. Modern cards can process *millions* of vertices very quickly. One reason SL viewer prims have so many triangles is they looked much better with per-vertex lighting. Nowadays with per-fragment lighting, all those extra triangles are unnecessary but they don't really slow things down, at least not significantly. However, if a mesh is animated (such as an avatar with bones and weighted vertices) then there is more vertex processing that needs to happen and number of triangles would have a larger impact.

    What could be of higher impact are large textures, number of textures, transparency, and different mapping settings. A single prim can have several material settings and each one requires special processing to set up in the GPU. Using the same texture on all prim faces would be much faster than having several different settings. Add transparency or a specular or normal map and things can get very slow very fast. This is mainly due to the extra processing the CPU must do to set the GPU up for each of these materials and the time it takes to tell it what to do, and in modern computers with high-end graphics cards, often the GPU is idle waiting for the CPU to tell it what to do.

    ReplyDelete
  17. 【2020大熱心理測驗】日本神準心理測驗,用顏色秒測你的真實性格及判斷自己的心理狀態!
    Dion Wong, 2 months ago 1 min read 156
    圖片來源

    資料引用/摘錄:hk01.com

    顏色具有不同的象徵意義,不但能表達自身的性格特質,也有人說透過挑選顏色,可以了解自己的情緒狀態。最近,日本推出了一個心理測驗,他們運用了辨色測驗,作為評估之用,答案可以秒測你的真實性格,以及當下所產生的心理狀態,記得要根據自己的第一直覺,作答題目,快點跟Tutor Circle 尋補 的小編一起測試,看看這個心理測驗夠不夠準確,立刻看出你的性格!



    [延伸閲讀]【心理學101】控制命運的自證預言心理學

    [延伸閲讀]【11月星座運勢】11月各星座運勢!你是否這個月的幸運兒?



    圖片來源



    1. 認為是綠色的你
    圖片來源

    Green Mountain Painting

    在此時此刻,你的心情是豁然開朗,身上充滿正能量,能守著心靈上的滿足,可以讓自己保持情緒穩定!小編認為在此狀態下,大家可以嘗試制定長期目標,因為活潑和開心是成功的關鍵,可以帶領我們邁向卓越!而且,抱著正面的態度和思維,能夠讓你朝向美好的一面。即使你遇到挫折,跌倒了,也可以立即找回力量,令你重新振作,並從錯誤中學習,再接再厲地衝下去。你能找出自己想做的事嗎?現在可能是最佳的行動時機!

    2.認為是藍色的你
    圖片來源

    Teal Wall Paint

    生活上的壓力,似乎讓你感到疲倦,需要好好休息,停下來,放鬆一下。可能在你的日常生活中,正需要面對很多事情,對自己的生理和心理狀態,造成巨大的負擔,情緒也容易受到波動!在這一刻,大家可以先讓自己放鬆身心靈。跟別人相處中,不用刻意壓抑自己,配合其他人。假如發現大家的個性不合,就按著自己的方式,珍惜活著每一天,即使一個人生活,也要懂得享受生活!
    補習社
    補習免中介
    搵補習
    補習平台
    補習老師

    補習免中介
    搵補習
    flowclass
    3. 認為是灰色的你
    圖片來源

    ReplyDelete