<div dir="auto">I had a thought that this might be handled by NURBS?</div><div dir="auto"><br></div><div dir="auto">John</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 27, 2023 at 7:19 AM Michalis Kamburelis <<a href="mailto:michalis.kambi@gmail.com">michalis.kambi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Indeed glTF has additional interpolation options, and I think it would<br>
make sense to add them to X3D.<br>
<br>
Looks like X3DOM and view3dscene/Castle Game Engine go in this<br>
direction already :)<br>
<br>
1. X3DOM has SFString "interpolation" field, default "LINEAR", see<br>
<a href="https://doc.x3dom.org/author/Interpolation/X3DInterpolatorNode.html" rel="noreferrer" target="_blank">https://doc.x3dom.org/author/Interpolation/X3DInterpolatorNode.html</a> .<br>
Andreas above explained how it supports "CUBICSPLINE" option.<br>
<br>
2. view3dscene / Castle Game Engine allow to use "STEP" interpolation<br>
explicitly.<br>
<br>
For this, we add such field:<br>
<br>
SFString [in,out] interpolation "LINEAR" # range: ["LINEAR"|"STEP"]<br>
<br>
.. to all X3DInterpolatorNode descendants (so, all interpolator<br>
nodes). This seems exactly like X3DOM, we just added "STEP", where<br>
X3DOM added "CUBICSPLINE". In the end we should probably have all<br>
["LINEAR"|"STEP"|"CUBICSPLINE"].<br>
<br>
3. Note that even without this field, with default linear<br>
interpolation, it was possible to have effectively step interpolation,<br>
as Andreas mentions. You can just duplicate keys in the middle, like<br>
<br>
key [0 0.33 0.33 0.66 0.66]<br>
keyValue [10 10 20 20 30 30]<br>
# interpolation "LINEAR"<br>
<br>
This is valid with X3D ("""keys shall be monotonically<br>
non-decreasing""" according to spec).<br>
<br>
It is equivalent to<br>
<br>
key [0 0.33 0.66]<br>
keyValue [10 20 30]<br>
interpolation "STEP"<br>
<br>
Using explicit "STEP" is slightly better, as you need 50% less<br>
memory to store it, less computation (no need to do lerp or detect<br>
this special case to optimize), and seems just simpler for authors --<br>
it specifies intention explicitly, which makes sense, also if one<br>
hopes a round-trip e.g. import to Blender and export to Blender.<br>
<br>
Having such additional interpolation options seems common, glTF<br>
and Blender too have them (<br>
<a href="https://docs.blender.org/manual/en/latest/editors/graph_editor/fcurves/properties.html#editors-graph-fcurves-settings-interpolation" rel="noreferrer" target="_blank">https://docs.blender.org/manual/en/latest/editors/graph_editor/fcurves/properties.html#editors-graph-fcurves-settings-interpolation</a><br>
).<br>
<br>
4. Note that view3dscene / Castle Game Engine do not support<br>
"CUBICSPLINE" interpolation yet, but we plan to.<br>
<br>
For now we support curve interpolation by adding extra<br>
intermediate keys to the linear interpolation -- so, we have<br>
needlessly more keys / key values. But this is only a temporary<br>
solution, we want to support "CUBICSPLINE" properly, like X3DOM.<br>
<br>
Regards,<br>
Michalis<br>
<br>
niedz., 25 cze 2023 o 05:33 Andreas Plesch <<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>> napisał(a):<br>
><br>
> > Date: Sat, 24 Jun 2023 10:11:03 -0700<br>
> > From: Joseph D Williams <<a href="mailto:joedwil@earthlink.net" target="_blank">joedwil@earthlink.net</a>><br>
> > To: Michalis Kamburelis <<a href="mailto:michalis.kambi@gmail.com" target="_blank">michalis.kambi@gmail.com</a>><br>
> > Cc: GPU Group <<a href="mailto:gpugroup@gmail.com" target="_blank">gpugroup@gmail.com</a>>, X3D Graphics public mailing list<br>
> > <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
> > Subject: Re: [x3d-public] Blender > Exporting rig transforms to HAnim?<br>
><br>
> > Which shows that yes, you have a list of the key times that just have to be ascending. Default is linear interpolation between keyvalues. Now new to me, I like the STEP option where value not interpolated but stays the same until next keyvalue change. For that effect, gltf makes it easier. I want that STEP option in x3d! And then there is also the cubic spline with specified tangents. Me want that one too.<br>
><br>
> In order to support glTF x3dom added a CUBICSPLINE with tangents<br>
> option to interpolators, in the same form as glTF, eg. three values<br>
> (in tangent, value, out tangent) per key. Parallel to glTF x3dom<br>
> interpolators have a "interpolation" SFString field which can have<br>
> "LINEAR" and "CUBICSPLINE" values. I suspect due to glTF support other<br>
> viewers also already do something like that and could expose such a<br>
> mode to regular X3D.<br>
><br>
> A STEP option is already elegantly solved by X3D with duplicate keys<br>
> with different values in series. That allows mixing step wise and<br>
> linear interpolation in one animation. x3dom just translates glTF STEP<br>
> to that format which is very straightforward. A dedicated STEP option<br>
> would be 50% more efficient in storage but I am not sure if this is<br>
> enough of a benefit to justify duplication of existing functionality.<br>
> It may not or it may as x3dom already does it internally for glTF. It<br>
> would be possible to add to x3d as well but perhaps not necessary.<br>
><br>
> Andreas<br>
><br>
> _______________________________________________<br>
> x3d-public mailing list<br>
> <a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
> <a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
<br>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div></div>