Jump to content
Memo Opaque

About Origin of Meshes

Recommended Posts

Hello, i am creating a clock. And i want its hands to turn around their origins which are in the first picture. But when i upload them to SL, their origins change as in the second picture. What may be the problem ? I upload two hands together(not as joined). Would uploading them together affect it ?

https://prnt.sc/g52omb

https://prnt.sc/g52o1t

 

Edited by Memo Opaque
  • Like 1

Share this post


Link to post
Share on other sites

You would need to attach a (maybe invisible) "rotation prim" to the fulcrum of each hand, and link the new prim to the hand as the root prim. That will make the hand rotate around the root prim.

 

(I learned that at Jayden Firehawk's "rotation prims" class at Builders Brewery a few weeks ago! :-) )

Edited by angeoco
  • Like 3

Share this post


Link to post
Share on other sites
16 minutes ago, angeoco said:

You would need to attach a (maybe invisible) "rotation prim" to the fulcrum of each hand, and link the new prim to the hand as the root prim.

That is the old hinge prim trick. The problem with it is that you can't link the hands to the clock.

A much better solution is to make the hands as "balanced" meshes the way modern mesh doors are made. Add an extra fully transparent face to the mesh extending "backwards" so the physical center of the mesh as a whole is exactly at the rotation point.

 

33 minutes ago, Memo Opaque said:

But when i upload them to SL, their origins change as in the second picture.

Please note that the origin point in Blender is not under any circumstance kept when a mesh is uploaded to Second Life. Usually the origin point or rotation point if you like, is the physical center of the mesh's bounding box.

The only exception is when you try to upload a mesh with two many faces and the uploader spltis it up automatically. You don't want to do that though, it gets seriously messy fast.

Edited by ChinRey
  • Like 3

Share this post


Link to post
Share on other sites
5 minutes ago, ChinRey said:

Add an extra fully transparent face to the mesh extending "backwards" so the physical center of the mesh as a whole is exactly at the rotation point.

Take a look at this video to see one approach to doing that >>>

 

  • Like 3

Share this post


Link to post
Share on other sites
14 minutes ago, ChinRey said:

A much better solution is to make the hands as "balanced" meshes the way modern mesh doors are made. Add an extra fully transparent face to the mesh extending "backwards" so the physical center of the mesh as a whole is exactly at the rotation point.

Is the video that Rolig pasted in what you mean?   That is how I have been doing things for years but very happy to learn something new if it is better :D.

You can also use a plain door without the extra invisible triagle and use a different kind of script, one that isn't based on the "cut prim" to make half a door. I don't DO that of course as I am not a script person LOL.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Chic Aeon said:

Is the video that Rolig pasted in what you mean?

There are far faster and easier ways to do it than what the video shows but yes, it's the same idea.

 

Edit, a bit more details, this is a door:

59876c7ca8b79_Doorpivotpoint01.png.d82f5d5d75eddfa0a0a1b9eb02738326.png

From the top with the 3D cursor marking the pivot point:

59876caaabcee_Doorpivotpoint02.png.088c290c0bb2a7a99415eb32dd101080.png

To make the door rotate correctly (without using awkward offcenter rotation scripts) we need to make the pivot point the center of the mesh as a whole. That means we'll have to extend the mesh to the point the 3D cursor is at here:

59876d7ed4eca_Doorpivotpoint03.thumb.png.7a652377bd97feb661ca012faf0e5cb7.png

The solution is to add a "balance triangle" that extends out to that point:

59876db003fd1_Doorpivotpoint04.thumb.png.42ebc60d240043c0d9615640d488eae8.png

The balance triangle has to be fully transparent of course (we don't want to actually see it), it has to extend exactly to that point I marked with the 3D cursor and unless you're adding some offset along the other axises, it must not extend outside the original boundaries of the mesh in any other direction. Those are all the requirements. It doesn't matter how big or small it is, it doesn't matter what shape it has and it dosen't matter whether it's horizontal or vertical or angled in some weird direction.

At last count I think there were about 216.47 ways to achieve this in Blender but there may be more.

Oh, and since this thread is supposed to be about clock hands not doors: maigne the top views of the door are just pictures of a very weird looking clock hand. ;)

 

Edited by ChinRey
Adding more info
  • Like 3
  • Haha 1

Share this post


Link to post
Share on other sites
36 minutes ago, ChinRey said:

There are far faster and easier ways to do it than what the video shows but yes, it's the same idea.

Here is my prefered method. Same principle as with nano meshes. No extra material, no transparency etc..

PivotPoint01.thumb.jpg.c49b77e5834198bcbcdb3f5023eb7c30.jpg

  • Like 5

Share this post


Link to post
Share on other sites
1 minute ago, arton Rotaru said:

Here is my prefered method. Same principle as with nano meshes. No extra material, no transparency etc..

Interesting.

What you do there is make the balance triangle invisible not with transparency but by placing to of the vertices at exactly the same spot so there is no surface to be visible. Does that work? I've been considering the method myself but been a bit nervous about it since I was afraid the viewer would insist ond rawing a line there anyway.

Share this post


Link to post
Share on other sites
1 minute ago, ChinRey said:

I was afraid the viewer would insist ond rawing a line there anyway.

I do it all the time with no issues. It just has to be 3 vertices still, so it's still a triangle, a degenerated triangle indeed. Since there is no surface area in that triangle, and the viewer doesn't render edges, it works pretty well. You just can't load it as a physics shape as well indeed, then the importer will complain about the degenerated triangle. ^_^

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, ChinRey said:

There are far faster and easier ways to do it than what the video shows

Yeah, in fact I don't do it exactly the way the video shows either, but I was too lazy to explain my version.  As you said, there are probably dozens of variations on the theme. The important thing is that you are extending the bounding box of your mesh so that its center is at the hinge point/line of your final model.

Edited by Rolig Loon
  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, arton Rotaru said:

I do it all the time with no issues. It just has to be 3 vertices still, so it's still a triangle, a degenerated triangle indeed. Since there is no surface area in that triangle, and the viewer doesn't render edges, it works pretty well. You just can't load it as a physics shape as well indeed, then the importer will complain about the degenerated triangle. ^_^

I have to try that next time. Of curse there is also a third way, one that Drongle mentioned in a thread long ago.

If we start with my single balance triangle:

598780cc2562c_Doorpivotpoint04.thumb.png.ebb326f8427510fac72cb182b6fadc7f.png

Delete the triangle and two of the vertices so there is just a single vertice left out there:

598782ecda1b8_Doorpivotpoint05.thumb.png.dfef37950232cc6773b5b84ef87a48dd.png

Select that vertice and only that vertice and sort the vertice list with it as no. 1 (Mesh menu -> Sort Elements -> Selected):

5987838ba42b6_Doorpivotpoint06.thumb.png.364bdf9c29a97e4d11fa66d13dd1afec.png

That way we don't have to add any extra polys - degenerate or not - at all. We just use a single "balance vertice" to expand the mesh size and vertices are of course never ever drawn.

The downside is that we're really expoliting a bug here and that means there is always a chance that LL will fix the bug some day i the future.

The uploader is supposed to identify and delete any loose vertices and edges, that is any that don't actually have any triangles. But this is the Second Life mesh uploader after all, so it's not very good at it and sometimes misses a few. One vertice it will never delete, no matter how loose it is, is the one that is first on the list in the dae file so by assigning the balance vertice to that place in the lsit, we're sure it will survive the upload. Until LL fixes the bug that is ... well it can happen!

Edited by ChinRey
  • Like 2

Share this post


Link to post
Share on other sites

Yeah right, the single vertex works when it's the first. I'm to lazy to re-order vertices though, and to be honest, I would have to lookup how to do it in 3ds max. The triangle version works no matter what the order is. So I just do it this way.

If they fix the importer, that would applly only to new imports. Those which are in-world already will continue to work. ^_^

Edited by arton Rotaru

Share this post


Link to post
Share on other sites
4 minutes ago, arton Rotaru said:

If they fix the importer, that would applly only to new imports. Those which are in-world already will continue to work. ^_^

Oh, I didn't know that. Maybe method no. 4 - the "8+ face mesh upload exploitation" way is worth looking at too then. I asked LL about it and they told me they couldn't guarantee it would work in the future.

Share this post


Link to post
Share on other sites

That's just the standard phrase. ^_^ Once the asset is uploaded, I don't think they are going to alter them in any way.

Probably they meant that the method to get to that asset behavior isn't guaranteed to work forever.

Share this post


Link to post
Share on other sites
15 hours ago, arton Rotaru said:

I do it all the time with no issues. It just has to be 3 vertices still, so it's still a triangle, a degenerated triangle indeed. Since there is no surface area in that triangle, and the viewer doesn't render edges, it works pretty well. You just can't load it as a physics shape as well indeed, then the importer will complain about the degenerated triangle. ^_^

So in this case, and in the case of ChinRey's displaced-vertex-sorted-first, how do you arrange for the physics to align correctly?  Use a real triangle in the physics (as in ChenRey's first example)?

EDIT:

OK, I tried the displaced-vertex-sorted-first and it appears that the up-loader in the Official Viewer is quite happy to use it as a Phys.  I found that surprising.

Edited by anna2358
More info after a test
  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, anna2358 said:

So in this case, and in the case of ChinRey's displaced-vertex-sorted-first, how do you arrange for the physics to align correctly?  Use a real triangle in the physics (as in ChenRey's first example)?

In cases like the clock hands, where it doesn't matter when the physics shape covers the entire bounding box, a plain cube will do.

Though, here is how for a door.

PivotPointPhys01.thumb.jpg.7ec62a3545297cb2b103f251a31b1d37.jpg

  • Like 3

Share this post


Link to post
Share on other sites
23 hours ago, anna2358 said:

So in this case, and in the case of ChinRey's displaced-vertex-sorted-first, how do you arrange for the physics to align correctly?

Just remember that the phsyics model will be scaled to the same overall size as the main visual model but apåart frm that there is no direct relationship between them whatsovere, they're not even handled by the same computer (visuals are client side, physics server side).

I actually have a ready made standard physics dae I use for most doors. It's made from a cube covering half the width and a very small single horizontal triangle right on top and aty the edge furthest away from the cube.

  • Like 1

Share this post


Link to post
Share on other sites
On 8/6/2017 at 8:41 PM, arton Rotaru said:

Here is my prefered method. Same principle as with nano meshes. No extra material, no transparency etc..

I'vw always wondered why this can work, because the viewer has code that is supposed to eliminate deegenerate triangles before uploading them. It even has an minimum tolerance built in so that vertices don't have to be exactly identical to make a triangle degenerate. It may be similar to the unused first vertex trick. That is, if the degenerate triangle culling only happens after the update of the mesh extents. I'll have to see if I can get motivated to look into the source code again!

Share this post


Link to post
Share on other sites
28 minutes ago, Drongle McMahon said:

I'vw always wondered why this can work, because the viewer has code that is supposed to eliminate deegenerate triangles before uploading them.

Yes, it didn't even occur to me that it was possible before Arton mentioned it here.

Hese illustrations may give a partical explanation:

Here's a mesh with 13 triangles, six regular ones, one partly collapsed and six completely collapsed

59904139ede6c_Skjermbilde(603).png.941c3ecb32236dffd861e40aeee53554.png

(For those who wonder: the shape in the front is a cube with all the vertices of the top face collapsed, the line in the background is a single triangle with two vertices collapsed.)

If I upload it, I get seven triangles according to the uploader:

5990426524996_Skjermbilde(604).png.adb815eabb1abffdb5309b9b3c6a7b58.png

So it seems only fully collpased triangles - with all three vertices at the same position -  are culled, partly collpased ones remain.

I didn't ctually upload and check the in-world triangle count so it is of course possible partly collapsed triangles are culled at a later stage - after the triangle count has been calculated - but that wouldn't make any sense, not even within the strange alternative logic frame of the mesh uploader.

Share this post


Link to post
Share on other sites
7 hours ago, arton Rotaru said:

Yeah, the triangle remains in-world. It shows when selected the outlines still.

How do I phrase "the single minor flaw in an otherwise perfect piece of software" in a way so that even casual readers with no knowledge of said software whatsoever immediately catch the sarcasm?

  • Like 1

Share this post


Link to post
Share on other sites

the single minor flaw in an otherwise perfect piece of software, just like Windows Vista?

  • Like 1

Share this post


Link to post
Share on other sites

It's pretty easy to rotate around an arbitrary set of coordinates without fussing with balance triangles.. you just multiply the vector from this rotation center to your objects base position by the rotation to get the vector to its post-rotation center and update both its position and rotation in the same call to one of the SetPrimitiveParams group of functions.

Since this has been something we've been able to do from day one, using balance triangles is just sloppy work, an unnecessary kludge.

  • Haha 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...