Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about zero-scale meshes. #2059

Merged
merged 4 commits into from
Oct 4, 2021
Merged

Add note about zero-scale meshes. #2059

merged 4 commits into from
Oct 4, 2021

Conversation

emackey
Copy link
Member

@emackey emackey commented Oct 4, 2021

Following conversation from #1314 (comment) and subsequent comments, I'd like to add an implementation note encouraging optimizations for zero-scale meshes.

Zero-scale meshes can be used to animate visibility of a mesh, and can enable use-cases such as fluid simulation where the computed mesh changes shape and changes number of vertices over a set of known timesteps.

/cc @donmccurdy @javagl

@emackey emackey requested a review from lexaknyazev October 4, 2021 14:20
@emackey emackey force-pushed the zero-scale-meshes branch from 6f5d5bb to 0cd7910 Compare October 4, 2021 14:21
Copy link
Member

@lexaknyazev lexaknyazev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's just a hint for developers who may skip such an optimization in their scene graph implementations, right?

@scurest
Copy link

scurest commented Oct 4, 2021

Only applies to unskinned meshes.

@lexaknyazev
Copy link
Member

Transforms of a skinned mesh are controlled by the joints' transforms that could contain zero scale as well. However, the results may be unstable when only a part of the mesh is affected.

@emackey
Copy link
Member Author

emackey commented Oct 4, 2021

Is it enough to just change this to "un-skinned meshes," as I have just pushed here?

@lexaknyazev
Copy link
Member

Is it enough to just change this to "un-skinned meshes," as I have just pushed here?

I'd say it's a bit imprecise because applying zero-scale to all joint nodes (or just their root) would lead to the same effect for skinned meshes.

@emackey
Copy link
Member Author

emackey commented Oct 4, 2021

How about this:

When the scale is zero on all three axes (by node transform or by animated scale), implementations are free to optimize away rendering of the node's mesh, and all of the node's children's meshes. This provides a mechanism to animate visibility. For skinned meshes, this optimization would only be applicable if all joints in the skin were scaled to zero simultaneously.

@emackey
Copy link
Member Author

emackey commented Oct 4, 2021

Or this?

When the scale is zero on all three axes (by node transform or by animated scale), implementations are free to optimize away rendering of the node's mesh, and all of the node's children's meshes. This provides a mechanism to animate visibility. Skinned meshes must not use this optimization unless all of the joints in the skin are scaled to zero simultaneously.

Copy link
Member

@lexaknyazev lexaknyazev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless all of the joints in the skin are scaled to zero simultaneously

LGTM, assuming that this includes a case when the joints get a zero-scale transform from a root node.

@emackey
Copy link
Member Author

emackey commented Oct 4, 2021

Yes, that's the intention.

@lexaknyazev lexaknyazev merged commit 68b782e into main Oct 4, 2021
@lexaknyazev lexaknyazev deleted the zero-scale-meshes branch October 4, 2021 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants