Object centre moving between Blender and OpenSim

Building using prims, sculpties and meshes. Texture creation techniques.
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Object centre moving between Blender and OpenSim

Post by John Mela »

Hi. I have a tetrahedron in Blender that I need to import into Kitely. When I do this, the centre of the object shifts, which unfortunately makes the object useless. I can't for the life of me figure out why this is happening.

To get the object into Kitely, I exported to DAE, then upload the DAE using Firestorm (OpenSim version). I'm getting the same results when I test in another OpenSim 0.8 grid and in Second Life. I've also tried two different base models of tetrahedron.

Here's the object in Blender:
Image.
The centre of the object is at the workspace origin (location of the object is 0,0,0, and applied), and aligning the camera to any of the faces shows the centre of the object/scene neatly in the centre of each face. For example, this is a top-down view in orthographic mode:

Image

However, when I upload to Kitely, this is what I get:

Image

The object centre is lower down, and nowhere near the centre of any face when viewed from that direction. Here's another view in Kitely, this time looking from roughly perpendicular to one of the side faces:

Image

Could anyone please tell me what I'm doing wrong here? Thanks!

EDIT: If anyone wants to try it for themselves, here's one of the models I used: https://3dwarehouse.sketchup.com/model/ ... dron?hl=en
These users thanked the author John Mela for the post (total 2):
Selby EvansIlan Tochner
Zed deTremont
Posts: 86
Joined: Wed Oct 22, 2014 5:37 am
Has thanked: 108 times
Been thanked: 147 times

Re: Object centre moving between Blender and OpenSim

Post by Zed deTremont »

Hello John,

Although I do not use blender the principles of all meshes made in 3D programs are the same. Downloaded your object to have a look what might go wrong.

When opening the .dae file I noted that you haven't what is called zero'd out.


The pivot point has been set on the tip your tetrahedron. Unfortunately for us, unlike Unity, unreal and other programs, for VWs as OpenSim it's good practice to center the pivot point, delete the history and freeze the transformations before bringing something inworld. If you don't you take the risk of having weird things happening in the worst case and in any circumstance when uploaded the pivot point will set itself in the centre of the geometry. I also noted that one way or another you have a camera as child of your geometry. I don't know how you'll find that in blender for me I see that in something called "outliner" where I see a list of all objects in a specific scene. This might be the cause of your troubles.

If this mesh has to be part of a larger "build" and needs to be scripted. In principle this is not too much of a problem as long as you have a script which handles this correct. Sei Lisa in sl made me one that works absolutely marvellous, disadvantage is that you have to do the setup in sl (eventually in adits - test grid of sl).

In short:
1. Zero out: which was not done in the geometry you've set up to download.
2. Get rid of the camera which is connected as a child to this geometry and might dislocate the position of the pivot.
3. If that is done there is no reason why the pivot would't fit in the centre of the object.

Hope this helps, if not you can contact me inworld and I answer the moment I see the eventual IM.

Cheerio,
Zed
Attachments
Screenshot 2019-05-20 at 09.51.13.png
Screenshot 2019-05-20 at 09.51.13.png (158.38 KiB) Viewed 8490 times
Screenshot 2019-05-20 at 09.51.13.png
Screenshot 2019-05-20 at 09.51.13.png (158.38 KiB) Viewed 8490 times
These users thanked the author Zed deTremont for the post (total 3):
Ilan TochnerJohn MelaChris Namaste
Zed deTremont
Posts: 86
Joined: Wed Oct 22, 2014 5:37 am
Has thanked: 108 times
Been thanked: 147 times

Re: Object centre moving between Blender and OpenSim

Post by Zed deTremont »

Sorry better make a correct screenshot of what I found with indication of transformations and tiny camera at the left side.
Attachments
Screenshot 2019-05-20 at 10.18.07.png
Screenshot 2019-05-20 at 10.18.07.png (233.59 KiB) Viewed 8490 times
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Object centre moving between Blender and OpenSim

Post by John Mela »

Many thanks, Zed.

Unfortunately, I didn't describe what I'd done very well, so I'll explain it step-by-step and see if that relates to your description.

The object I linked was not the one I made - that's where I sourced the geometry from (and I tried a couple of others too). I'll use that file I linked as a basis for this description.

Here's what I have done:

1. Import the DAE

2. Delete any extraneous objects (in this example, the camera) so the only object in the scene is the tetrahedron

Here's the object at that stage, with the centre on one of the vertices:

Image

3. Select all faces and set the 3D cursor to selection (ie equidistant from the centre of each face)

4. Transform the object to set the origin to the 3D cursor.

This is how it looks now, with the origin in the correct location (note the location data on the right):

Image

5. Zero the location X,Y,Z to move the object to the centre of the workspace

Image

6. "Apply" the location, rotation and scale. I suspect this is the same as "freeze the transformations" in your description. There doesn't appear to be any way to delete the history in Blender other than to quit and reload, so I've done that. This quit/reload wasn't something I've done previously, although I've always applied the location/rotation/scale data to fix it.

This is the "Apply" menu, for reference:

Image

Here's the object and its parameters after applying: Image

7. Export to Collada and import to Kitely.

The result is the off-centre origin:

Image

If you don't mind, I will contact you in-world.

Again, many thanks for looking into this.
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Object centre moving between Blender and OpenSim

Post by John Mela »

After more experimentation today, I've found that if the tetrahedron is exported and uploaded after step 3, everything is OK except that the rotation is not what's needed.

Step 5 - applying a rotation to align one of the faces to the floor plane - seems to be the point at which the origin of an exported DAE no longer matches the origin shown in the workspace.
These users thanked the author John Mela for the post (total 2):
Ilan TochnerChris Namaste
Zed deTremont
Posts: 86
Joined: Wed Oct 22, 2014 5:37 am
Has thanked: 108 times
Been thanked: 147 times

Re: Object centre moving between Blender and OpenSim

Post by Zed deTremont »

Hello John,

I've seen your message inworld over email, haven't had the time to come in yet. If I read through your steps normally all should be alright but pictures can be sometimes misguiding so I don't know what exactly goes wrong. More ideal would be if we could do a share screen then I can see step by step.

Anyway in a bit of time I'll be able to pick some time of rl and will check as you asked in Maya and eventually make some new geometry that just takes a few minutes. As said before the centre (pivot point) will always be in the centre of the mesh. Just the way things are in opensim and any related grid.

I'll get in touch inworld.

Cheers,
Zed
Zed deTremont
Posts: 86
Joined: Wed Oct 22, 2014 5:37 am
Has thanked: 108 times
Been thanked: 147 times

Re: Object centre moving between Blender and OpenSim

Post by Zed deTremont »

lol, I never seem to be able to answer all in one go. If with rotation you mean that the axis are not correct applied inworld, pls check following:
1. Almost all 3D progams and at least all I use have the Y axis up. Maya, ZBrush, speedtree, MD, Unity, Substance painter etc.
2. For some reason, sl, opensim and all related grids have the Z axis up. Pls don't ask me why.
3. This can give conflicting situations for scripting if it's not taken in account although knowing you this shouldn't give a problem.
4. In Maya a can change the axis orientation to Z up even though this is a hassle when I have to export it for other applications. Pls check which axis is up in blender. Perhaps this might be the issue.

Checking the geometry again in depth this time, I'll write below what I encountered so that you can follow.
1. Geometry has Y axis up for me. (see above)
2. Do you need an exact tetrahedron with 4 equal triangles since I see that it is off centre in the X,Y plane (can be on purpose of course) see pic 1 in orthogonal view below
3. OK, found something else, if you look in the upper left corner under tris. I see 96 tris and 48 faces. I'm afraid you have what are called stacked vertices. Unless this is something that happens when I import from blender which would be very weird pls always see to it that you combine those verts. You should have 4 verts for this geometry if not you end up with severe problems and have a object that is way to heavy for what it is.
4. After combining the verts the pivot looks as if off centre though the reason it that the top of the tetrahedron is off centre.
5. Bringing in geometry in Kitely measurements <3.048;3.520;2.874> as you see not equal at all.
I'll send it to you inworld
Pls let me know what you need and I quickly make it, to start from scratch is no work at all. I did give you more info so that you're able to see where eventual problems might be.
Pls mind that since I didn't knew if this is exactly the shape you had in mind I didn't make a UV map for it so it will texture bad as it is right now.

Hope this helps you further,
Cheers,
Zed
These users thanked the author Zed deTremont for the post (total 4):
Selby EvansChris NamasteRamesh RamlollJohn Mela
Zed deTremont
Posts: 86
Joined: Wed Oct 22, 2014 5:37 am
Has thanked: 108 times
Been thanked: 147 times

Re: Object centre moving between Blender and OpenSim

Post by Zed deTremont »

Right did it again, herewith the picture, sorry.
Attachments
Screenshot 2019-05-21 at 10.27.33.png
Screenshot 2019-05-21 at 10.27.33.png (99.73 KiB) Viewed 8456 times
These users thanked the author Zed deTremont for the post (total 2):
Chris NamasteJohn Mela
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: Object centre moving between Blender and OpenSim

Post by John Mela »

Hi Zed. Thanks for getting back to me.

Replies to your points (numbers don't relate to your numbers):

1. The vertical axis in Blender is Z by default, so normally objects imported into SL/OS have the same orientation. This has caused problems when I've made objects for Unity (with its Y vertical), so it's actually useful to me that it's that way for OpenSim and Blender.

2. The sides should all be equilateral. In your picture, it looks like you're viewing it from along the Z axis, and the visible face is not orthogonal to the camera. It looks very similar to this view (orthographic, fixed to Y axis):

Image

where if I orbit the camera upwards (vertically), I get this:

Image

If your view isn't like that, then it looks like the object has been distorted somehow. Is it possible to measure the edges in Maya? They should all have exactly the same length.

3. You're quite right - the Sketchup model has duplicated vertices, which I hadn't noticed.

However, I'm no longer using that model anyway - I created a new tetrahedron by deleting vertices from a cube, and that has only the 4 vertices:

Image

That model also exhibits the shifting origin when I apply (freeze) the rotation. So unfortunately, the extra vertices are not the culprit.

4. The size of <3.048;3.520;2.874> doesn't surprise me - I wouldn't expect an imported tetrahedron to have equal values in the scale. It's made of equilateral triangles, and the length of one side of an equilateral triangle is not equal to the perpendicular distance between the centre of that side and its opposite corner (the Pythagorean theorem, aka "the square of the hypotenuse is equal to the sum of the squares of the other two sides").

If you like, I can upload that new tetrahedron somewhere, although it's probably just as quick to make one from a cube anyway, like in this tutorial: https://www.instructables.com/id/Create ... -Inventor/.

I would be eternally grateful if you were able to to do that, and to rotate the object such that one of the sides is on the same plane as the floor, and that one of the edges of that side is parallel to one of the horizontal axes. If you can do that and keep the object origin at the centre when exported to DAE, that would be a tremendous help. From there, I should be able to UV map it in Blender, so please don't worry about that (the orientation of the UV maps, and hence the surface binormals, is critical to our application, and I'd need to experiment to get that right).

Thanks SO much, Zed. You're a gentleman!
Zed deTremont
Posts: 86
Joined: Wed Oct 22, 2014 5:37 am
Has thanked: 108 times
Been thanked: 147 times

Re: Object centre moving between Blender and OpenSim

Post by Zed deTremont »

Hi John, you're welcome hope we don't let other people reading this fall asleep lol, it's getting lol.

Answer you by points also with same numbers.

1. OK, probably since blender is from the beginning quite close to sl and will be a bit of a hassle for unity indeed. Also for sure for substance painter since if you don't rotate you'll get weird shadows on the -Y value. I presume there is a way to rotate the axis in prefs if needed.

2. You're correct, I was wrong on this one indeed. In my mind I thought about a pyramid shape which with 3 sides is of course not the same.

3. Staked verts is something I've seen quite often with people who start working in 3D. Don't say you're starting but it's hard to see. 2 good pro trick to see if geometry is correct made and if there are problems with a) stacked verts b) problems with hard and soft edges.
a) select the geometry and smooth it, since there are no additional edges made against edge stress the shape will deform and should nice and even deform. With a bit of experience you can see problems at a glance. (see pic 1) sorry don't get them in as nice as you and have to do this in between rl.
In pic. left to right front shapes as you see them in 3D
line in back shapes as smoothed, this is only in preview the geometry as such hasn't been changed. Remark the weird form at the right. Even though the shape looks correct there are 2 stacked verts at the right of the tetrahedron

b) A very common problem I see on models is the wrong usage of soft and hard edges. I know this is not the initial topic but want to show it anyway. Apply a blin or glossy material to the geometry. If there are problems with soft/hard edges you'll see a bizar gradient in that area, for sure if you move around. (See pic 2) Please mind that the sample pic is seriously exaggerated. In practice you will more often see a subtal gradient which is never OK. Such shaders problems will also become very clear inworld. There a lot to do about soft and hard edges but is not subject to this topic and would lead us way to far.

4. You're absolutely right. My math became quite bad, haven't used more then the strict all day minimum for years. Good news (even though most will call me nuts). I'm studying maths again since I see one way or another I need it again. Picking up of Schaum's series and working through calculus ( I know... those VW's made me some kind of a geek). But I want to understand my stuff deeper and understand tessalation shaders and a lot of other things better. At some point I should get to matrixes, fractals and trigonometry. As said completely bonkers.

I make a tetrahedron in no time that's no issue no need to upload it.
I'll make it and send it to you np I'll UV map it too, also done in no time. If any adaptation there still remains the proposal to use Skype if you have nothing against it and I share screen. Via voice this issue would be solved a long time ago :) Of course this is a proposal in no way an obligation.

Cheers,
Zed
Attachments
Soft_hard edges
Soft_hard edges
Screenshot 2019-05-22 at 10.02.41.png (110.07 KiB) Viewed 8415 times
smooth geom
smooth geom
Screenshot 2019-05-22 at 09.52.13.png (90.64 KiB) Viewed 8415 times
These users thanked the author Zed deTremont for the post (total 2):
Ilan TochnerJohn Mela
Post Reply