Re: [osg-users] Hardware skinning computeBound() calculation

29 views
Skip to first unread message

Steven Powers

unread,
Jan 30, 2018, 12:35:23 PM1/30/18
to osg-...@lists.openscenegraph.org
I understand this completely and realize that compute bound will return something incorrect since the vertices are manipulated on the vertex shader.

I might have misrepresented my issue.

Even if I set the initial bound to be something I believe is correct... lets say radius=20. The problem is that there are scale transforms in the parental scene graph somewhere that then shrink this radius down to radius=2.

Currently I traverse the node path and apply the inverse of the scale to the initial bound so that initially it is radius=200 and will then pass return it's way back up to result in radius=20.

My question is... is this the correct way of doing this? Is there a better way to compute the bound of the hardware skinned bounding box or am I doing this correctly??

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72888#72888





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Julien Valentin

unread,
Jan 30, 2018, 1:23:08 PM1/30/18
to osg-...@lists.openscenegraph.org
Hi Steve
You say to have a transform scaling x0.1
so you want that shrink your rig...
But you seams not to want the initial bound to be shrink as well
I don't understand what you're doing?

If you want to compute correctbound of a HWskinned rig from the CPU the solution is to merge both SoftWare and HW RigTransform and do the transform on the CPU and GPU independantly.
It's what is done in osgCal but in osg we've choose not to duplicate job so you'll have to write a custom RigTransform for it.
Perhaps I'll do it my self one day but I've always found a way to circumvent the problem with initial bound

Cheers



DrPowers wrote:
> I understand this completely and realize that compute bound will return something incorrect since the vertices are manipulated on the vertex shader.
>
> I might have misrepresented my issue.
>
> Even if I set the initial bound to be something I believe is correct... lets say radius=20. The problem is that there are scale transforms in the parental scene graph somewhere that then shrink this radius down to radius=2.
>
> Currently I traverse the node path and apply the inverse of the scale to the initial bound so that initially it is radius=200 and will then pass return it's way back up to result in radius=20.
>
> My question is... is this the correct way of doing this? Is there a better way to compute the bound of the hardware skinned bounding box or am I doing this correctly??


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72889#72889

Steven Powers

unread,
Jan 30, 2018, 1:42:40 PM1/30/18
to osg-...@lists.openscenegraph.org
Thanks for the attention Julien.

I'm setting my initial bound for the drawable equal to the computeBound() returned by the initial geometry, which gives me radius = 20. This calculation does not have the scale applied to it.

The character (a whale in this example) renders with dimensions around 20m which should be wrong since there is a scale value of 0.1 applied within it's node path. I would expect to see the whale render with dimensions around 2m

Something somewhere is not getting scaled properly. It's either the hardware skinning (my guess) or something else. Let me try some things and get back with further information.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72890#72890

Julien Valentin

unread,
Jan 30, 2018, 3:39:23 PM1/30/18
to osg-...@lists.openscenegraph.org
I don't have requirements to test it by myself but can give you some insight about the vertex shader
gl_ModelViewMatrix in the shader should embed the matrix scale your talking about (try to remove it from the shader if the result is the same-wich in doubt- then your scaling transform is correctly apply)
matrixPalette contain dynamic transform managed via osgAnimation::StackedTransformElement

my guess is you transform problem come not from a osg::Transform but from
a osgAnimation::StackedScaleTransform on your Rig


DrPowers wrote:
> Thanks for the attention Julien.
>
> I'm setting my initial bound for the drawable equal to the computeBound() returned by the initial geometry, which gives me radius = 20. This calculation does not have the scale applied to it.
>
> The character (a whale in this example) renders with dimensions around 20m which should be wrong since there is a scale value of 0.1 applied within it's node path. I would expect to see the whale render with dimensions around 2m
>
> Something somewhere is not getting scaled properly. It's either the hardware skinning (my guess) or something else. Let me try some things and get back with further information.


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72891#72891

Steven Powers

unread,
Jan 30, 2018, 4:43:15 PM1/30/18
to osg-...@lists.openscenegraph.org
So I've concluded that there is extra scaling occurring via the skeleton that we have within our model.

It seems that our skeleton and our geometry are on two different scales and the geometry is getting scaled up on the shader to match the skeleton's dimensions.

I think the fix is to match this geometry with a different skeleton that is of appropriate scale. In the meantime I will set the initial bound to take this extra scaling into account.

In previous instances a skeleton that is too small/large usually would be obvious when an animation started but in this case the vertex/bone weights must have been scaled alongside and it was not an obvious error.

Thank you Julien.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72892#72892
Reply all
Reply to author
Forward
0 new messages