Jump to content

How to make Blender and Second Life use the exact same "centre to object" coordinates?


Recommended Posts

Posted (edited)

I've been messing about with creating modular assets and, for the most part, it has been okay so far but as the geometry becomes more complex - the discrepancies start to become more obvious.

I've tried the usual things such as using cubes as the parent, to force Firestorm to use that as a pivot point but even then there's a small difference in position; especially regarding the Z axis.

I uploaded a simple cube, with a tapered roof, for testing purposes to see if I could figure out why it's slightly off. I then sent that back into Blender and compared it, side by side, to my original test mesh. The "centre" point is slightly off compared to the centre point of the test mesh in Blender.

I've also tried creating an invisible bounding box, and used that as the centre pivot, but even that doesn't work. I've pretty much tried everything that I can think of but the bounding box is always a little off regarding the centre of the bounding box, in relation to what it is in Blender. I'm a stickler for precision so this is kinda driving me crazy lol. I wish that it was a case of just mathematically working out the difference variants but obviously it's very dependant on the mesh itself.

Is there any way to make Blender use the same bounding box centre that Firestorm will make the mesh use?

Thanks!

(On the left is the original, basic mesh, and on the right is the same mesh but brought back in from Second Life. As you can see there's a difference between the two "origin" points."

difference.png

Edited by Kelley Amiot
Posted
8 minutes ago, Kelley Amiot said:

Is there any way to make Blender use the same bounding box centre that Firestorm will make the mesh use?

The nominal center of a mesh in Second Life (regardless of which viewer it has been uploaded with) is always exactly in the middle between the two most extreme vertices along each of the three axises. If you want exact alignment between the center in Blender and in SL, you have to positions those vertices precisely and also, since vertice drift is quite common in Blender, check their positions right before you export.

  • Like 2
Posted

"you have to positions those vertices precisely and also, since vertice drift is quite common in Blender, check their positions right before you export."

I'm not entirely sure what you mean by this?

Posted

I think I've figured out what the issue is for this particular object. It's because the angles sort of "confuse" the Second Life uploader. I measured the length of one of the angles, for the "roof" and then calculated that against the actual height of the bounding box. The difference between the two makes up for the difference seen in the image above.

It's bizarre really...

Posted
25 minutes ago, Kelley Amiot said:

I think I've figured out what the issue is for this particular object. It's because the angles sort of "confuse" the Second Life uploader. I measured the length of one of the angles, for the "roof" and then calculated that against the actual height of the bounding box. The difference between the two makes up for the difference seen in the image above.

It's bizarre really...

As @ChinRey already pointed out above the pivot point is calculated for each mesh when it's imported to SL based on the dimensions of its bounding box.  Blender, like most 3D apps, allows you to change the topology of an object without affecting its original pivot point which, if the changes to the topology affect the dimensions of the object, will result in that pivot point being offset from the center of the objects bounding box.

It should be possible to recenter the pivot point of the object to it's current bounding box in Blender before exporting (although I couldn't tell you how specifically since I don't use Blender), alternatively you could create a "bounding box object" which can be merged with each modular component before export to ensure that they all have their pivot point in the same place (this can be as simple as two very small triangles at opposing corners of a cube which defines your desired bounding box proportions).

  • Like 1
Posted
1 hour ago, Kelley Amiot said:

"you have to positions those vertices precisely and also, since vertice drift is quite common in Blender, check their positions right before you export."

I'm not entirely sure what you mean by this?

You mean vertice drift? The exact position of the vertices can sometimes change as you work on your model in Blender, even vertices you don't modify. This can sometimes be a problem for relatively small models that require high precision so it's something we should be aware of. It shouldn't be an issue for soemthing as big as your model though so maybe I shouldn't have mentioned it here.

The problem you seem to have is that you confuse the origin point in Blender with the center of the bouding box. Those are two completely different things. The bounding box is not included in the export anyway. The bounding box used in SL is generated by the uploader based on the position of the vertices.

  • Like 1
Posted (edited)

A classic workaround to get your inworld center-of-object where you want it to be is to add degenerate geometry that isn't culled during upload to the model so that the calculated extents are different. There's a couple ways, but the most reliable one (and the only one I remember) is simply degenerate triangles scaled to 0, i.e. a proper triangle with a face but with 3 vertices in the same spot. They're completely undetectable inworld, but will be accounted for when the bounding box is calculated, just make sure you don't merge or otherwise clean them up. They do count towards the LI calculation, but a single triangle here and there probably won't have too much impact.

image.png.256bfb075a17c83019e9687b5453643d.png

This model would have its calculated center on the top side of cube after uploading.

Edited by Frionil Fang
  • Like 2
Posted (edited)
5 hours ago, Kelley Amiot said:

Is there any way to make Blender use the same bounding box centre that Firestorm will make the mesh use?

I created an object like yours. Select the object in Object Mode, then search for Origin to Geometry.

The origin is now in the center of that object. That's where the center will be in SL. (Not because the origin is there, but because that's the center.)

 

On the left is my original object (3D cursor at center), on the right is the same object exported from SL (origin at center).

image.thumb.png.9b96bca95dff3b261c177bb890eb5f8f.png

Edited by Wulfie Reanimator
  • Like 1
Posted (edited)
5 hours ago, Kelley Amiot said:

Is there any way to make Blender use the same bounding box centre that Firestorm will make the mesh use?

Hmmmf ........... well Wulfie  has already shown you a quick way using the 3D cursor while I was taking screenshots of another way using the objects origin.

As mentioned above, SL uses the center of the objects bounding box as the pivot point.

If, in Blender you place the objects Origin at the center of the objects Bounding Box then the default pivot point in Blender's object mode will be in the same position as pivot point of the object in SL. The BB dimensions remain the same therefore the pivot points are the same.

example:

1-min.thumb.png.ff292e9f8fd81fef04a4d0ff3bdc43a0.png

 

 To get the origin at the center of the BB, in Object mode select the object > Object > Set Origin > Origin to Geometry. When doing this make sure that the Transform Pivot Point is set to Bounding Box Center in the 3D veiewport header, or in the Last Operator panel bottom left hand corner.

2settingpivotpointinBlender.-min.thumb.png.18aa1ce0acbc98e81078e2ca2d93cd04.png

 

If it is set incorrectly to Median Point then the objects origin will be misplaced. Note that the position of the objects origin in Blender has no effect of the position of the objects pivot point when it is rezzed inworld.

3incorrectpivotpoint-min.thumb.png.6c9d5fced2ebf41c765582cbfa272e60.png

 

Rotating around the Objects origin (pivot point) X axis in Blender ...............

Blender_rotate.gif.0fdb61efbffac50eff66abb62304aad0.gif

 

has exactly the same pivot point for rotation in SL :

inworld_rotate.gif.264646a9f75040aaa80fcaf1ab6a438b.gif

 

And when imported back into Blender the pivot point remains in the same position.

4exportedfromSL-min.thumb.png.da8796007d6aea37c3a40aba2a40321f.png

 

 

Edited by Aquila Kytori
  • Like 1
  • Thanks 1
Posted

The problem I have is that I've already tried "origin to geometry." I've tried most of these things to be honest which is why I came here as a last resort.

I do sincerely appreciate all of the help you have each provided to me.

I think that the major issue here is that I am designing my entire sim within Blender then exporting the mesh pieces into Second Life, then mirroring over the co-ordinates from Blender to Second Life. On the X and Y axis, things snap perfectly, when translated to the region. It's just the Z axis that is the issue. I suppose it's because terrain doesn't have a bounding box so I am merely going from the height at which my feet are on the ground and this will cause discrepancies between Blender and SL.

As I said, everything else snaps perfectly on the X and Y axis, it's just the Z axis giving me issues.

I suppose I could just make it on a platform just above the ground and use that same height variation in Blender (I have the 256x256 region, in Blender, split into segments of 64x64 so I'd merely have to raise one of them to the desired elevation.)

I'll run some tests and see what I can accomplish.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...