POV-Ray : Newsgroups : povray.general : Boned mesh file formats? : Some answers Server Time
2 Aug 2024 16:24:12 EDT (-0400)
  Some answers  
From: John VanSickle
Date: 26 Aug 2004 20:14:07
Message: <412e7ccf@news.povray.org>
Rune wrote:

> I have been searching a little and the Half-life .mdl format seems to be
> widely used. However, that is intended for games primarily and I guess it is
> mostly used for low-polygon models. I'm also fairly sure I wouldn't be able
> to make a reader for it in Java. But the Half-life SDK can be downloaded and
> I've read that a description of the format is available, if anyone's
> interested.
> 
> One program that is also low-poly is Milkshape:
> http://www.swissquake.ch/chumbalum-soft/
> It can convert between many different formats, and supposedly it's easy to
> write one's own export plug-in too. It's shareware, but not very expensive
> ($25).
> 
> I'd be interested in working together with others to find a solution how to
> handle skeletal/boned meshes in POV-Ray. I only know POV-Ray SDL and Java
> have no experience reading and writing binary files.

In my bone system, I have a set of two transforms for each bone,
one for the start and one for the end.

The start transform is derived from a rotation around one or two axes,
followed by the application of the end transform of the parent bone (if
there is a parent bone) or by a translate (if there is no parent).

The end transform is derived from a translation around the z-axis,
followed by a rotation around z, followed by the application of the
start transform just calculated.

The vertices that are attached to each bone are local to either the
start or the end of the bone.

The rotations to be done depend on the kind of joint between the parent
and the current part.  The joint type is a way of interpreting the
angles supplied by the user.

The first kind of joint I use is the uni joint.  In it the shaft of
a bone is rotated around the x-axis, then the y axis.  In the following
example, the part has no parent.

#declare Part1_tb=transform {
    rotate <Part1_ax,Part1_ay,0>
    translate Part1_p
}

The second kind of joint I use is the ball joint.  The shaft of the bone
is rotated around an axis passing through the base of the bone; the 
direction of this axis is determined by another angle of rotation.
The following example shows the rotations for this joint.  This bone
has a parent bone (the previous one).

#declare Part2_tb=transform {
    rotate -z*Part2_ay
    rotate <Part2_ax,0,Part2_ay>
    transform Part1_te
}

The third kind of joint I use is the hinge joint.  The shaft of the
bone is rotated around the horizontal axis, but there is no rotation
around the vertical axis.  This seems redundant with the uni joint,
but I developed it because the hinge and uni provide for different
ways of posing the model when the end point is dragged by the mouse
in my modeler.  In the following example, the bone is a child of the
second bone above.

#declare Part3_tb=transform {
    rotate x*Part3_ax
    transform Part2_te
}

The end transform for all three bones is calculated in the same
way:

#declare Part1_te=transform {
    rotate z*Part1_az
    translate z*Part1_sl
    transform Part1_tb
}

#declare Part2_te=transform {
    rotate z*Part2_az
    translate z*Part2_sl
    transform Part2_tb
}

#declare Part3_te=transform {
    rotate z*Part3_az
    translate z*Part3_sl
    transform Part3_tb
}

You can base the objects on these transforms:

cylinder { 0,Part3_sl,rRadius transform Part3_tb }

My modeler works in conjuction with my subdivision surface
macros.  If the original mesh has some vertices based on one
bone, and other vertices based on another bone, the faces
that span the two bones will show stretching when the bones
are moved relative to each other.

Hope this helps,
John


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.