Skip to content

HTML export: skinned mesh does not loop #728

Description

@abcamiletto

Hi!

Found a small bug when exporting the HTML of a skinned mesh (I assume this also affects other exports).
After the first play, the following loops are static and nothing moves. Here is a reproduction

import numpy as np
import viser

server = viser.ViserServer(port=0)

mesh = server.scene.add_mesh_skinned(
    "/body",
    vertices=np.array([[-0.5, 0, 0], [0.5, 0, 0], [0, 1, 0]], np.float32),
    faces=np.array([[0, 1, 2]], np.uint32),
    bone_wxyzs=np.array([[1, 0, 0, 0]], np.float32),
    bone_positions=np.array([[0, 0, 0]], np.float32),
    skin_weights=np.ones((3, 1), np.float32),
)

rec = server.get_scene_serializer()
for _ in range(40):
    mesh.bones[0].wxyz = (0.9239, 0, 0, 0.3827)
    rec.insert_sleep(0.05)
    mesh.bones[0].wxyz = (0.9239, 0, 0, -0.3827)
    rec.insert_sleep(0.05)

server.stop()
open("skinned-loop-repro.html", "w").write(rec.as_html())

I opened a PR with a minimal fix I found for this ( #729 )
Thanks a lot for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions