[x3d-public] Displacer and normals ?
John Carlson
yottzumm at gmail.com
Sat Feb 15 13:49:28 PST 2025
Great idea, Andreas, being able to select a fraction of the mesh for
animation. I’ll have to think about how to import and export animations
from Blender in this way.
John
On Sat, Feb 15, 2025 at 3:35 PM Andreas Plesch via x3d-public <
x3d-public at web3d.org> wrote:
> Non-linear displacement paths
>
>>
>> It would be probably feasible from an implementation perspective to have
>> displacers with weight (key) ranges for piecewise linear interpolations to
>> approximate curved displacement paths. Thinking about it, it may already be
>> possible to design a CoordinateInterpolator of _displacement_ keyValues
>> which gets routed to the displacement field of a displacer, with a constant
>> weight of 1. So animation then happens by changing displacement values
>> directly rather than weight values. This would allow for arbitrary
>> displacement paths and does not need any changes, still allowing targeting
>> vertex subsets and composing. Might be worth testing, seems interesting.
>>
>
> This idea seems to work. Here is a simple example based on John's
> Tongue.x3d
>
>
> https://raw.githubusercontent.com/andreasplesch/x3dom/refs/heads/HAnim_displacers/test/functional/hanim/tongueCurved.x3d
> [ Use Alt-Q to flip line wrapping of long lines. ]
>
> It adds an additional displacement step halfways through the animation
> which has non-linear z displacements.
>
> Could be interesting.
>
> -Andreas
>
> -Andreas
>>
>> On Wed, Feb 12, 2025 at 10:58 PM Joe D Williams <joedwil at earthlink.net>
>> wrote:
>>
>>> I think degenerate triangles, ones that flip from ccw to cw, or overlap
>>> or
>>>
>>> whatever messes up a triangle when any of all of its points get moved
>>>
>>> is purely result of author error(s) in setting the parameter(s).
>>>
>>>
>>>
>>> Whatever happens with normals of triangles moved or destroyed by
>>> Displacer
>>>
>>> must match what happens with points moved by joint-driven skin
>>> animations
>>>
>>> which can also mess up, and by points moved by CoordinateInterpolator,
>>>
>>> same as any morphing operation.
>>>
>>> Normals can also be set by the author each frame if desired.
>>>
>>>
>>>
>>> Maybe some help given in authortime but not any sort of
>>>
>>> enumerated error except undefined in runtime since this visual effect;
>>>
>>> it is just an artifact of bad data.
>>>
>>> Esp likey when deformable face is actually composed of multiple shapes
>>>
>>> and they must blend regardless of the combinations of shapes
>>>
>>> that move to make the motion for a pose.
>>>
>>> Always? much easier with single basic mesh for the face and and then
>>>
>>> add features and accessories animated individually?
>>>
>>>
>>>
>>> One of the limitations with Displacer is that it is just a single scaled
>>> 3D vector,
>>>
>>> meaning it has a fixed relative direction regardless of the weight
>>> applied.
>>>
>>> When a curved displacement is required, then point motion can be
>>>
>>> controlled using joint rotation, like the eyeball.
>>>
>>> In some cases,a CoordinateInterpolator may be used to move points
>>> around.
>>>
>>> Texture position and rotation can be animated.
>>>
>>>
>>>
>>> Since all these Displacer nodes have been produced by finding the
>>>
>>> simple 3D vector difference between the first and last data point
>>>
>>> of a source CoordinateInterpolator it is likely that some displacements
>>>
>>> do not produce exact same movement of a point just because the
>>>
>>> original interpolator keyValue keyframe data points described a curved
>>> path.
>>>
>>>
>>>
>>> Sure, we can update the 3D vector direction each frame if we want to,
>>>
>>> but I would like to see a Displacer which could use multiple sets of
>>> vectors
>>>
>>> interpolated to produce computed keyframes like other interpolators.
>>>
>>> For each point there could be a set of vectors where the output value for
>>>
>>> point movement is the result of interpolation between
>>>
>>> adjacent key time (weight) keyValue 3D vectors.
>>>
>>>
>>>
>>> So, more fun with x3d HAnim
>>>
>>> Thanks,
>>>
>>> Joe
>>>
>>>
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Extensible 3D (X3D) Graphics public discussion <
>>> x3d-public at web3d.org>
>>> Sent: Feb 12, 2025 9:11 AM
>>> To: X3D Graphics public mailing list <x3d-public at web3d.org>
>>> Cc: Andreas Plesch <andreasplesch at gmail.com>
>>> Subject: Re: [x3d-public] Displacer and normals ?
>>>
>>>
>>>
>>> Responses below:
>>>
>>>
>>>> Date: Tue, 11 Feb 2025 15:58:40 -0600
>>>> From: John Carlson <yottzumm at gmail.com>
>>>> To: "Extensible 3D (X3D) Graphics public discussion"
>>>> <x3d-public at web3d.org>
>>>> Subject: Re: [x3d-public] Displacer and normals ?
>>>>
>>>> Did you get the black tongue effect? I?ve seen that in Sunrize, and
>>>> reported it there. Holger had a response about providing normals.
>>>
>>>
>>> I found https://github.com/create3000/sunrize/issues/9
>>>
>>> Yes, I think this is similar. x-ite/sunrize just may not automatically
>>> recalculate normals for performance reasons which in some cases may be
>>> beneficial by avoiding the effects of degenerate triangles.
>>>
>>>
>>>> The displacers were taken from CoordinateInterpolators in the
>>>> HumanoidAnimation/FacialAnimation X3D archive.
>>>>
>>>> https://www.web3d.org/x3d/content/examples/HumanoidAnimation/FacialAnimation/index.html
>>>> Perhaps we could derive normals from those examples, realizing only one
>>>> set
>>>> of meshes is chosen for the final version.
>>>>
>>>> It?s relevant, because I will be providing a unified skin mesh for FACS,
>>>> and it would be nice to provide normals.
>>>
>>>
>>> I noticed the effect actually only in combined displacers/morphers, eg.
>>> the Contempt combo. That brings up the future question of how pre-computed
>>> normals from multiple displacers may be combined, maybe just by averaging
>>> the slerped orientation from each.
>>> There may have been studies on how to best recombine facial
>>> subexpressions for a valid result.
>>>
>>> -Andreas
>>>
>>>
>>>>
>>>> On Tue, Feb 11, 2025 at 3:41?PM Andreas Plesch via x3d-public <
>>>> x3d-public at web3d.org> wrote:
>>>>
>>>> > I noticed that some displacers cause degenerate or flipped triangles
>>>> which
>>>> > may cause rendering problems, mostly due to problems calculating
>>>> > automatically a good normal vector.
>>>> >
>>>> > In general, for best rendering results, it is necessary to provide
>>>> > precomputed normals. rather than rely on automatic normal
>>>> calculations. Was
>>>> > there a discussion on how to have displacers provide precomputed
>>>> normals
>>>> > along with the displacement of the vertices ? That would help with
>>>> > rendering quality, and may be necessary for some use cases.
>>>> >
>>>> > This may be deemed a long term feature to consider.
>>>> >
>>>> > Perhaps an idea would be a MFRotation normalRotations field which has
>>>> the
>>>> > rotation required to rotate the normal (per vertex, or perhaps per
>>>> face)
>>>> > from the rest orientation to the final orientation. Weights are
>>>> applied
>>>> > with slerp. For animation authors it would be probably easier to be
>>>> able to
>>>> > just directly provide the final orientation.
>>>> >
>>>> > Any feedback or comment much welcome, -Andreas
>>>> >
>>>> >
>>>> > --
>>>> > Andreas Plesch
>>>> > Waltham, MA 02453
>>>> > _______________________________________________
>>>> > x3d-public mailing list
>>>> > x3d-public at web3d.org
>>>> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>>> >
>>>> -------------- next part --------------
>>>> An HTML attachment was scrubbed...
>>>> URL: <
>>>> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250211/a4be3c1a/attachment-0001.html
>>>> >
>>>>
>>>> ------------------------------
>>>>
>>>> Message: 3
>>>> Date: Wed, 12 Feb 2025 11:27:59 -0500
>>>> From: Andreas Plesch <andreasplesch at gmail.com>
>>>> To: John Carlson <yottzumm at gmail.com>
>>>> Cc: Holger Seelig <holger.seelig at yahoo.de>, X3D Graphics public
>>>> mailing list <x3d-public at web3d.org>, Joe D Williams
>>>> <joedwil at earthlink.net>
>>>> Subject: Re: [x3d-public] Turning on and off simultaneous animations
>>>> individually
>>>> Message-ID:
>>>> <
>>>> CAKdk67vXRSz1pM4QLjcxuCQHfjY4LUT924cSmX7rPAasroPUCw at mail.gmail.com>
>>>> Content-Type: text/plain; charset="utf-8"
>>>>
>>>> Hi,
>>>>
>>>> I took a first stab at Displacers in Segments for x3dom and use it now
>>>> in
>>>> the editor:
>>>>
>>>>
>>>> https://andreasplesch.github.io/Library/Viewer/index.html?url=https://raw.githubusercontent.com/coderextreme/ci2had/refs/heads/main/resources/ManyClocks.x3d
>>>>
>>>> This is experimental and mostly for testing purposes. If there is an
>>>> example combining Displacers in both Joints and Segments that would be
>>>> interesting as it is not necessarily expected to work.
>>>> The experimental implementation is inefficient and expensive as it is
>>>> weight_changed event driven. If you activate multiple displacers the
>>>> frame
>>>> rate starts to drop. It probably is not very useful at this point.
>>>>
>>>> Fee free to give it a try, -Andreas
>>>>
>>>> On Wed, Feb 5, 2025, 4:11?PM Andreas Plesch <andreasplesch at gmail.com>
>>>> wrote:
>>>>
>>>> > Hi John,
>>>> >
>>>> > Thanks. I found the tongue.x3d example but if you can create another
>>>> one
>>>> > that would be helpful in general.
>>>> >
>>>> > You vastly overestimate my ability and availability ;) This would be a
>>>> > longer term project. I have an idea what to do.
>>>> >
>>>> > Andreas
>>>> >
>>>> >
>>>> > On Wed, Feb 5, 2025, 1:31?PM John Carlson <yottzumm at gmail.com> wrote:
>>>> >
>>>> >> I had one I sent to Holger, probably derived from this one:
>>>> >>
>>>> >>
>>>> >>
>>>> https://github.com/coderextreme/ci2had/blob/main/resources/JinMouthStretch.x3d
>>>> >>
>>>> >>
>>>> >> What I would do (again) is take out all the segments but the tongue.
>>>> >>
>>>> >> There?s no menus involved in this one.
>>>> >>
>>>> >> If you need further assistance, like a smaller example, I can help.
>>>> Also
>>>> >> all the Jin*.x3d FACS action units can also provide examples.
>>>> >>
>>>> >> I?ll be pretty unbusy today. I can allocate some time for creating a
>>>> >> model, make sure it animates, etc.
>>>> >>
>>>> >> If you?re able to allocate some time today, great, we have an HAnim
>>>> >> meeting tomorrow and showing off X3DOM editor using Displacers would
>>>> be
>>>> >> fantastic!
>>>> >>
>>>> >> Remember there?s a coord field in HAnimSegment that the
>>>> HAnimDisplacer
>>>> >> operates on!
>>>> >>
>>>> >> John
>>>> >>
>>>> >> On Wed, Feb 5, 2025 at 12:01?PM Andreas Plesch <
>>>> andreasplesch at gmail.com>
>>>> >> wrote:
>>>> >>
>>>> >>> Hi John,
>>>> >>>
>>>> >>> The reason is that Displacers are currently implemented in x3dom
>>>> only
>>>> >>> for Joints, but not for Segments, unfortunately. Do you know of a
>>>> simple
>>>> >>> but instructive test case of Segments with Displacers ?
>>>> >>>
>>>> >>> Andreas
>>>> >>>
>>>> >>>
>>>> >>> On Tue, Feb 4, 2025, 2:33?PM John Carlson <yottzumm at gmail.com>
>>>> wrote:
>>>> >>>
>>>> >>>> I will try to test this in castle model converter.
>>>> >>>>
>>>> >>>> I did try setting a value for the outputOnly fields, but the
>>>> converter
>>>> >>>> wouldn?t shut up.
>>>> >>>>
>>>> >>>> The model below doesn?t seem to animate when one presses the menu
>>>> >>>> items. Did you get it to animate?
>>>> >>>>
>>>> >>>> On Tue, Feb 4, 2025 at 12:27?PM Andreas Plesch <
>>>> andreasplesch at gmail.com>
>>>> >>>> wrote:
>>>> >>>>
>>>> >>>>> Hi John, all,
>>>> >>>>>
>>>> >>>>> It turns out that x3dom currently expects a default value for
>>>> Proto
>>>> >>>>> fields even for outputOnly fields. This is due to how Proto
>>>> fields are
>>>> >>>>> initialized. They always need to have a value. While the spec.
>>>> does not
>>>> >>>>> require this, it seems still good practice to always define a
>>>> default value
>>>> >>>>> in the ProtoInterface. There may be a case where an outputOnly
>>>> field is
>>>> >>>>> used in ISing where a valid value would be expected. There may be
>>>> other
>>>> >>>>> corner cases.
>>>> >>>>>
>>>> >>>>> Here is your example with added default values for outputOnly
>>>> fields:
>>>> >>>>>
>>>> >>>>>
>>>> >>>>>
>>>> https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/af5ff3148c1159f71d34fb78c1f63024/raw/b3d4470107ab74e301ed48448ab2a4f4154672e0/ManyClocks_John.x3d
>>>> >>>>>
>>>> >>>>> This could be fixed in x3dom, by always setting some default
>>>> value. Is
>>>> >>>>> there a list of recommended defaults for each data type if no
>>>> other source
>>>> >>>>> of defaults is available? For SFTime it seems to be -1.
>>>> >>>>>
>>>> >>>>>
>>>> >>>>> -Andreas
>>>> >>>>>
>>>> >>>>>
>>>> >>>>> On Mon, Feb 3, 2025 at 7:39?AM Andreas Plesch <
>>>> andreasplesch at gmail.com>
>>>> >>>>> wrote:
>>>> >>>>>
>>>> >>>>>> Hi John,
>>>> >>>>>>
>>>> >>>>>> On Mon, Feb 3, 2025 at 12:48?AM John Carlson <yottzumm at gmail.com
>>>> >
>>>> >>>>>> wrote:
>>>> >>>>>>
>>>> >>>>>>> Andreas, "startTime" is an accessType outputOnly field, so why
>>>> do I
>>>> >>>>>>> need to provide a value attribute in fieldValue? I'm kind of
>>>> confused.
>>>> >>>>>>> I'm probably missing something in the spec.
>>>> >>>>>>>
>>>> >>>>>>
>>>> >>>>>> You are right, I only outlined scenarios where the accessType
>>>> allows
>>>> >>>>>> input or initialization..
>>>> >>>>>> In the outputOnly case it is not necessary to provide a
>>>> fieldValue
>>>> >>>>>> node at all since there is no value which can be provided.
>>>> Providing the
>>>> >>>>>> node would indeed be confusing, to both the user code reader and
>>>> any X3D
>>>> >>>>>> browser.
>>>> >>>>>> I believe the spec. is silent on this case in any encoding.
>>>> >>>>>>
>>>> >>>>>> Best, Andreas
>>>> >>>>>>
>>>> >>>>>> Thanks for any clarification.
>>>> >>>>>>>
>>>> >>>>>>> I have finally enabled schematron on the project, but I'm
>>>> finding it
>>>> >>>>>>> hard to understand the messages, and modifications that I make,
>>>> while
>>>> >>>>>>> removing the immediate problems, seem to move the problems
>>>> elsewhere.
>>>> >>>>>>>
>>>> >>>>>>> Explaining why I need a "startTime" fieldValue value is my main
>>>> lack
>>>> >>>>>>> of understanding, but perhaps I need a whole review of
>>>> accessType.
>>>> >>>>>>>
>>>> >>>>>>> Castle Model Converter reports:
>>>> >>>>>>>
>>>> >>>>>>> castle-model-converter: Warning: X3D: X3D XML: <fieldValue>
>>>> element
>>>> >>>>>>> references unknown field name "enabled"
>>>> >>>>>>> castle-model-converter: Warning: X3D: X3D XML: <fieldValue>
>>>> element
>>>> >>>>>>> references unknown field name "startTime"
>>>> >>>>>>> castle-model-converter: Warning: X3D: X3D XML: <fieldValue>
>>>> element
>>>> >>>>>>> references unknown field name "stopTime"
>>>> >>>>>>>
>>>> >>>>>>> I will try providing a field value in the ProtoInterface
>>>> >>>>>>>
>>>> >>>>>>> If I "cleanup" enabled, startTime and stopTime, I get:
>>>> >>>>>>>
>>>> >>>>>>> castle-model-converter: Warning: VRML/X3D: Within prototype
>>>> >>>>>>> "MenuItem", event "inputTrue" references (by "IS" clause)
>>>> non-existing
>>>> >>>>>>> event "enabled"
>>>> >>>>>>> castle-model-converter: Warning: VRML/X3D: Within prototype
>>>> >>>>>>> "MenuItem", event "triggerTime" references (by "IS" clause)
>>>> non-existing
>>>> >>>>>>> event "startTime"
>>>> >>>>>>> castle-model-converter: Warning: VRML/X3D: Within prototype
>>>> >>>>>>> "MenuItem", event "triggerTime" references (by "IS" clause)
>>>> non-existing
>>>> >>>>>>> event "stopTime"
>>>> >>>>>>>
>>>> >>>>>>> I guess what I conclude at this point is, startTime and
>>>> stopTime are
>>>> >>>>>>> bad DEF names, but what about enabled as a field? The dominoes
>>>> are falling.
>>>> >>>>>>>
>>>> >>>>>>> About your two scenarios in the other message, perhaps this is
>>>> >>>>>>> revealing.
>>>> >>>>>>>
>>>> >>>>>>> See attached attempt to fix original issue, which resulted in
>>>> the
>>>> >>>>>>> above.
>>>> >>>>>>>
>>>> >>>>>>> John
>>>> >>>>>>>
>>>> >>>>>>> On Sun, Feb 2, 2025 at 3:59?PM Andreas Plesch <
>>>> >>>>>>> andreasplesch at gmail.com> wrote:
>>>> >>>>>>>
>>>> >>>>>>>> I think x3dom, reasonably, expects a value for the fieldValue
>>>> nodes:
>>>> >>>>>>>>
>>>> >>>>>>>> For example:
>>>> >>>>>>>>
>>>> >>>>>>>> <fieldValue name="startTime" />
>>>> >>>>>>>>
>>>> >>>>>>>> and others.
>>>> >>>>>>>>
>>>> >>>>>>>> On Sun, Feb 2, 2025 at 5:42?AM John Carlson <
>>>> yottzumm at gmail.com>
>>>> >>>>>>>> wrote:
>>>> >>>>>>>>
>>>> >>>>>>>>> Andreas, Joe,
>>>> >>>>>>>>>
>>>> >>>>>>>>> Reset Button, Reset_Clock added.
>>>> >>>>>>>>>
>>>> >>>>>>>>> See attached zip for details, or visit link;
>>>> >>>>>>>>>
>>>> >>>>>>>>>
>>>> >>>>>>>>>
>>>> https://create3000.github.io/x_ite/playground/?url=https://raw.githubusercontent.com/coderextreme/ci2had/refs/heads/main/resources/CleanedYouClocks.x3d
>>>> >>>>>>>>>
>>>> >>>>>>>>> For some reason, this link doesn't show the live scene?
>>>> >>>>>>>>>
>>>> >>>>>>>>>
>>>> >>>>>>>>>
>>>> https://andreasplesch.github.io/Library/Viewer/index.html?url=https://raw.githubusercontent.com/coderextreme/ci2had/refs/heads/main/resources/CleanedYouClocks.x3d
>>>> >>>>>>>>>
>>>> >>>>>>>>> Puzzled, haven't researched it yet. Looks good in Sunrize and
>>>> >>>>>>>>> X_ITE, will try FreeWRL next.
>>>> >>>>>>>>>
>>>> >>>>>>>>> John
>>>> >>>>>>>>>
>>>> >>>>>>>>>>
>>>> >>>>>>>>
>>>> >>>>>>>> --
>>>> >>>>>>>> Andreas Plesch
>>>> >>>>>>>> Waltham, MA 02453
>>>> >>>>>>>>
>>>> >>>>>>>
>>>> >>>>>>
>>>> >>>>>> --
>>>> >>>>>> Andreas Plesch
>>>> >>>>>> Waltham, MA 02453
>>>> >>>>>>
>>>> >>>>>
>>>> >>>>>
>>>> >>>>> --
>>>> >>>>> Andreas Plesch
>>>> >>>>> Waltham, MA 02453
>>>> >>>>>
>>>> >>>>
>>>> -------------- next part --------------
>>>> An HTML attachment was scrubbed...
>>>> URL: <
>>>> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250212/6f37d6ce/attachment.html
>>>> >
>>>>
>>>> ------------------------------
>>>>
>>>> Subject: Digest Footer
>>>>
>>>> _______________________________________________
>>>> x3d-public mailing list
>>>> x3d-public at web3d.org
>>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> End of x3d-public Digest, Vol 191, Issue 57
>>>> *******************************************
>>>
>>>
>>>
>>> --
>>> Andreas Plesch
>>> Waltham, MA 02453
>>>
>>>
>>>
>>
>>
>> --
>> Andreas Plesch
>> Waltham, MA 02453
>>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250215/098e34df/attachment-0001.html>
More information about the x3d-public
mailing list