There might be a problem with the simulator culling using the objects bounding
box. If an object moves away its position from its original bounding box due
to vertex skinning ( for example, a character walking around an area, not “in
place” ), the culling still acts on the position of the bounding box, so
(depending on the viewing angle) it assumes the object is outside the screen
and culls it, when in fact the object should still be visible. This it’s very
easy to troubleshoot, by placing the object with the Scenery Editor, that
shows the bounding box, and the object being culled away as soon the bounding
box crosses the screen boundary due to the camera angle. But the object is not
really there anymore, since it exited from its original bounding box because
of the skinned animation. I tried adding dummy geometry ( flipped triangles )
to enlarge the bounding box but, this seems to affect the LOD radius “Sphere”
( as seen in the LOD debugger ), but doesn’t fix the problem with the Skinned
object. I tried adding the extra triangles both as separate objects and as
attach to the skinned mesh ( under the Skin modifier ), but the object still
get culled. A similar object, which is moved due to its parent node being
animated but is NOT skinned, is not culled in the same way. Is there any way
to fix this ? Would be possible to tweak the bounding box, perhaps with an
exporter option, so we could override the automatic bounding box calculation,
and provide it with a bigger one, that covers the whole area in which the
skinned animation takes place ?
Could you just add an invisible cube around the extent of the animation in the
model? This would give it a huge bounding area.
@rhumbaflappy, as I posted, I already tried
that, in two different ways: - with small triangles placed around the
animation extent as separate objects. Didn’t work, even if the LOD radius
sphere clearly increased. - with the same small triangles, this time as part
of the skinned mesh itself, making the skinned object bigger. Didn’t work as
well. The problem is not just a generic culling issue, it seems that skinned
objects are handled differently because, in the same object, I have another
item that moves together with the skinned character, but it’s not moving
“because it’s skinned”, it’s really moving its center, and this item is not
culled. I think this is somewhat related to the fact the .GLTF format doesn’t
have an overall bounding box stored in the file ( like the .MDL format ), but
rather each part has its own extension values so, it’s likely up to the app
that loads the file to calculate the overall bounding box, and cleary a
skinned mesh that moves outside the boundaries would confuse it, because the
only way to know the real bounding box in that case, would be scanning the
skinned animation and figuring it out what the real extents would be. This is
tricky, that’s why maybe a way to override the bounding box in another way (
maybe in the object XML file ? ) might be useful.
@virtuali, Umberto I have the same issue with a project I am working with, the
object transform from small to large… so the bounding box being calculated at
the smaller size causes issues. You will need to add a cube as suggested by
rhumba, however the caveat is, it needs to be done to all LODs… the bounding
box is currently calculated based on the last LODs loaded… so if you add this
cube only to your LOD0, since LOD5 is loaded last… the bounding box will
remain small. If you add the cube to all LODs… the bounding box will be
calculated properly. Hope this helps. S.
@Simbol, Please read my message carefully, I’m perfectly aware we can place
extra geometry to artificially enlarge an object bounding box AND we should do
it for all LODs, this usually works, but it’s not the issue here. The issue
here is a DIFFERENCE due to the fact my object is made of just two meshes,
both animated, but ONE is Skinned, the other one it’s not. And it’s ONLY the
Skinned mesh that gets culled, even if it’s part of the same gltf and the same
LOD ( I only have 1 LOD, btw ) and their animation covers exactly the same
area. The only difference between them is the static mesh moves because its
animated itself, while the Skinned object moves because its Bones are
controlling it. I even tried to add those extra polygons ( covering the whole
animation area ) directly attached to the Skinned Mesh, effectively making the
skinned mesh itself larger, but it still gets culled as soon the screen
crosses the bounding box, but the skinned object is not there anymore, so it
shouldn’t be culled. I wouldn’t expect the sim to be able to deal
automatically with these fringe cases, that’s why having the ability to set
some kind of parameter in the object XML, to override the automatic
calculation of the bounding box, could be useful. Or, if anybody found a
workaround that would work for SKINNED meshes, I would be happy to hear it.
Adding degenerate geometry that covers, at frame 0, the whole animation area
is supposed to work. Not sure what happens in your case. Could you provide us
with a 3ds max file of the object producing this issue so we can investigate
further? Regards, Sylvain
@FlyingRaccoon, I replied with a private message with a sample 3ds max file
you can try, but I’m not sure if I set the visibility permissions correctly,
let me know if you have it.
@virtuali I checked your sample and it makes sense it’s not working. - You
tried to extend the skinned object bounding sphere by adding an independent
“Plane001” object. That won’t help, it will just create an independent object
with a dedicated bounding sphere. What you want to do is add geometry to the
skinned mesh directly. - In this particular case, there’s a better
alternative. Your skinned animation shouldn’t move the character and you would
have to use the root node to move him around so that the bounding sphere moves
with him. (That’s why the kart doesn’t disappear, you’re moving the node so
the bounding sphere is following) Does that make sense to you? Regards,
Sylvain
@FlyingRaccon, as I posted before, I already tried adding the extra geometry
directly to the skinned mesh, but the result was the same. I suspected the
problem was caused by the fact the skinned animation is translating the object
too, so I hope there was another solution, rather than having to redo the
animation to remove any translation component and add it back to a dummy. This
would require lots of work to redo many existing animations. None of this
would be an issue, if there was a way to override the bounding box, maybe as a
parameter in the object XML.
UPDATE I finally found a workable solution: When I just added the dummy
geometry to the actual skinned mesh, it didn’t work very well, the skinned
object was still getting culled from some angles. What seemed to work, was
adding the dummy geometry AND remove all the bones influences from their
vertexes, so instead of wobbling/moving around with the skinned mesh, they
just stayed in place to create the larger bounding box. This resulted in good
visual culling.
That’s surprising. At frame 0, the dummy geometry was correctly positioned to
cover the animation area? Allowing people to define the bounding sphere is
something we think about.
Here is an easy way to understand the issue and the easiest method to fix
it. The mesh size for the skin object decides the bounding box size. And
where ever frame zero is located is the bounding box location and size. And if
you move this skin object from that location in the sim and the camera can’t
see the original bounding box area at frame 0 it will cull. Example…So if
the animation like gear brings a small bones animated hose much lower toward
the ground at frame 100 or 140 then when the camera is out of view of the
frame zero bounding box size the object will cull. And this is easy to get a
cull since the hose is near the ground now and not in the gear bay. So you are
most likely looking down. How to fix: Move the animation keys so the bones
hose is now the furthest from frame zero location. Now attach a small box to
the skin mesh. Make another bone and have that bone have 100% influence to the
box only. And now this new bone will not move from this new location as we
will not link it to anything, and the new box will stay as well. Now you have
a very large bounding box and no more culling. Last you need to make a multi-
material so you can attach a visibility to the box and another material to the
hose. This way the box is hidden.