Jump to content

New Pivot Trick?


Drongle McMahon
 Share

Recommended Posts

I started playing with the Project Importer viewer, and I wondered what happened to the pivot and the physics when the uploader split a model into two objects when you have more than eight materials (the release viewer just drops the geometry with the extra materials). It turns out that the pivot stays where it was for the whole model, and the physics, at least hull-based physics, is properly split. This gives a new way to make offset pivots, for example for a door hinge.

Here is a simple door model. In Blender (top left) the colours are the ten materials; the 8-colour tab has the first eight materials in the list, and the door has the last two (grey). When this is imported with the Project Importer viewer, you get a linkset with two prims (top right). The root is the tab, with the first eight materials, and the door is the other. When you unlink and select just the door, the pivot is still along the hinge position (lower left). The physics was made using Analyze on the high LOD, and here is the physics of the unlinked door after deleting the tab (lower right) - just as it should be, and it does indeed rotate about the hinge, manually, or with a script. No extra triangles needed.

Of course there is absolutely no guarantee that this will find its way into a release viewer.

dor.jpg

Link to comment
Share on other sites

I think I will ask them to keep this feature. There is one HUGE advantage in addition to the offset pivot. In general, if the components of a model uploaded as a linkset are accidentally moved, either by unlinking or inadvertently by Edit Linked, it can be impossible to manually realign them perfectly because of the limited precision of the edit spinners. However, if the linkset is the result of splitting because of >8 materials, then with the pivot working as it is now, setting the transform spinners (pos, rot, scale) of the components is guaranteed to bring them back into perfect registration. So far. as long it is possible to get material fragmentation with >21844 triangles, this will be essential to avoid bad problems for users.

The only odd thing is that the "stretch box (but not the bounding box), and the dimension spinners use the extents of the original linkset, even after the rest of it is deleted. That might be a little confusing at first, but I would say worth it for the advantages of the offset pivot. Since the 64m limit is applied (automatic scaling) to the whole model before splitting, the pivot cannot be offset more than 32m. That avoids all sorts of potential problems with very large offsets.

I guess the difference from uploading separate objects is that the normalisation and centering of the geometry is done for the whole object before splitting, while with separate objects it is done separately for each object. Fortunately, it appears that the physics is done after splitting, as each of the split objects gets its own proper default convex hull and explicit physics shape.

Link to comment
Share on other sites

So if I read this correctly, the land impact is calculated correctly from the bounding box dimensions of the split mesh.

Honestly, if they keep this, I don't see no reason to not give us custom pivots in general, for any mesh. Even with a forced max distance limit, for all I care. Nobody should be forced to do such cumbersome workarounds to just offset a pivot.:matte-motes-confused:

Especially if it's that easy to bring the collision shapes in sync with the visual mesh, that it can happen by accident. Which is what I assume is what happened here at this point, an accident.:matte-motes-nerdy:

But yeah, this would be sooo SL, if we end up with keeping just this. :matte-motes-delicious:

Link to comment
Share on other sites

You are right. An explicit pivot offset would be best.

I didn't check the LI calculation, but my guess would be that it's calculated from the bb of the original unsplit model, as that is where the dimensions in the edit dialog come from. That would be consistent with the idea that the geometry is normalised before splitting. (It's normalised to fit a 64k cube to maximise precision of vertices within the limitation of 16-bit coordinates - a 32-bit scaling vector is calculated to restore it to the proper size). In that case, there is a penalty for offsetting the pivot. For example, for the door, it is 2x2x0.1 with the offset but 1x2x0.1 without. That would give about 1.7 times the "radius". Presumably this affects the LOD switch distances and the download weight.

Yes. I just tested a 2.5m rounded cube with normal and 32m offset pivot (maximum possible). Thr former's download weight was 0.2. The latter was 6. So it's expensive. Sadly, I guess that could be regarded as making it a bug - you would get higher LI for the identical object if you let the uploader split it than if you split it yourself. Could they consider that reasonable?

On the other hand, if each split piece gets normalised etc after the split, LI might depend on how the splitting was done, which would depend on the order of the materials. Even worse, my guess is that the rounding errors in the normalisation would mean that the pieces don't fit perfectly when they are rescaled, each with a different scaling vector, and rezzed. That would be a nightmare. So they have to leave it the way it is, don't they?

This is looking more and more like a bag of worms.

Link to comment
Share on other sites

If the LI is still calculated with twice the dimensions of the mesh, at least in one direction, this new method then leads  pretty much to the same results as the current workaround by adding hidden geometry to offset the pivot.

So even that is not really an advantage then, I guess...

You could be right with the scaling vectors and resizing stuff, though. Which would mean custom pivots should be considered as well, IMO.

 

 

Link to comment
Share on other sites

"LL is working on having more then 8 materials on a single mesh object so this trick wouldn't work for long."

On the contrary, the trick is the result of that development.

As I said in the original post, it works only with the Project Import viewer*. That is the development viewer with the code that enables the import  of mesh with more than 8 materials. The way they have chosen to do that is to split mesh with more than eight materials into multiple (linked) objects during the upload process. At the moment, that leaves the split objects each with the pivot of the original object before it was split. That is how the trick works. It depends on the ability to upload mesh with more than eight materials.

However, since this is a development viewer, they might change it by adding code to to move the pivots to the centers of the split objects after they are split. They are likely to do that if the offset pivots are considered to present problems. So there is no guarantee that it will continue to work when the code is moved into the release viewer, as I also said in the original post.

 *the link to the download page for development viewer is in the blog post you linked to.

Link to comment
Share on other sites

Ah, thanks for clearing that up. To bad though... I thought we would actually have more unique faces to work with in a single object. But aside from the trick you mentioned there's no difference in splitting it up into multiple objects yourself. If I understand you correct you'll still end up with 8 unique faces per object.

Link to comment
Share on other sites

That's the way it looks so far. That is, you can uplaod a dae file that has meshes with more than eight materials, but they will be split into multiple objects each of which has eight or less. With the ones I tried, the split objects were in a linkset, That's ok provided you don't unlink them and there's none of the "prim drift" we hear about, and provided they don't get unlinked (no-mod if you transfer them!).

I haven't experimented yet with what happens with LODs. There could be problems with switching LODs of parts at different distances. Also, it looks as if the automatic default physics is made after splitting; if that's true for the automatic LODs too, there could be unexpected effects.

ETA. In fact it's impossible to upload LOD with this files at the moment, because of another bug. I think it's being dealt with. However, at the moment the LOD switching is at the same distance for all the parts, because they share the same pivot point and the same dimensions, all inheroted from the unsplit mesh. So that's another reason why I think they won't be able to change the present scheme - it would mess up the coordinateded LOD switching.

Link to comment
Share on other sites

So far I get the impression it is the same as with automatic LOD en Physics generation. It's better to do the work yourself if you want it to be done correct. But maybe a good option for creators who are just starting out with mesh. I sure didn't bother with LOD's or Physic models the first months I started with Mesh. Now I'm very a**l about getting it absolutely right, so I doubt I would use the automatic splitting of the uploader. 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...