-
Notifications
You must be signed in to change notification settings - Fork 490
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
Importing and exporting SkinnedMeshRenderer with blendshapes #363
Importing and exporting SkinnedMeshRenderer with blendshapes #363
Conversation
…r last lod) (KhronosGroup#364) * add the ability to control whether objects with lod should render when very far away * pr feedback
* Improve the performance of skinned animation import Current implementation of importing animation curve is very slow for animations with lots of key frames. (e.g. motion capture animation ). The bottleneck is in AnimationCurve.keys return a copy instead of reference. Hence, updating key frame in AnimationCurve is expensive. I build a list of keyframe for the curve, calculate the tangents from interpolation mode and then feed the key frames to the curve to avoid the overhead. * Improve the performance of skinned animation import 1, put the delegate function at the top of the file 2, replace spaces with tab 3, replace the keyframe list cache with 2d array
Thanks for contributing - tagging @azakariaMSFT to review this |
…KhronosGroup#365) * move tests * fixes level 3 warnings * remove redundant namespace * fix ups to level 3 warnings. remove unnecessary namespaces
I'm working through some bugs when attempting to load a file using this branch. The implementation in SetupBlendShapes assumes that all files with blendshapes will have SemanticProperties.POSITION/NORMAL/TANGENT embedded and that all targets will have their associated names embedded. There should be some conditionals in case these properties are not included. |
… gltf too), by never using multithreading in editor (KhronosGroup#368) * IsMultithreaded is now a property that always returns false when Application.isEditor is true. This prevents a "hard-freeze" in Unity editor when importing any GLB. * Update GLTFSceneImporter.cs Fixed a comment
Thanks, let us know when it's ready. |
…d Semantic properties POSITION, NORMAL, TANGENT exist
Thank you, I've updated SetupBlendShapes to check if target names and semantic properties exist. Please let me know if there are any more issues or better implementation methods. Thanks! |
KhronosGroup#378) * Expose GPU-only texture option to user and fix mismatching sampler state warning 'if' condition * Make linear/sRGB color space setting match spec
* Update KHR_texture_transform support * Flip tex offset y coord * Fix non-conformant texture origin
KhronosGroup#379) * Yield timeout should be common to all loaders as framerate is an application-wide concern * Resolve comments * . * .
* Enable UPM packages to be generated in releases * Travis OSX package should already contain zip package * Remove draft=true for releases deployment
Related to Issue KhronosGroup#398
…d of .Equal causing both matrix and RST data (KhronosGroup#392)
Co-Authored-By: rferrese <[email protected]>
* Set timeout after successfully awaiting. * fix spaces and remove file that unity keeps deleting
* Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Fixing Travis build environment issues * Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Fixing Travis build environment issues * Pull down upstream changes * Fixing merge conflict * Add Roughness float values to MetalRoughMap.cs * Add names to textures created by GLTFSceneImporter * Fix texture memory leak * Add task cancellation support * Add image name to texture name * Update UnityGLTF/Assets/UnityGLTF/Scripts/Cache/RefCountedCacheData.cs Co-Authored-By: rferrese <[email protected]> * Change cancellation in ConstructMesh * Camera in test scenes now moves only when dragged (mousedown) and the movement math is cleaner and more accurate, and zoom is now exponential instead of linear. (KhronosGroup#413) Also clean up some warnings around unused variables. * Fix loading time issue (KhronosGroup#414) * Simplify AsyncCoroutineHelper * revert default budget * Add missing meta file for integration test directory (KhronosGroup#419) * Add a component to display the list of models from gltf-Sample-Models and let you load them (KhronosGroup#420) * Add a component to display the list of sample models and let you load them at runtime. * Some improvements to the model list loader and adding a main scene to host it * Fix warning suppression * Address pr feedback. Remove commented line. Give a nice error if the model list json fails to download. Also improve orbit camera so that scrolling the other list doesn't cause it to zoom. * OrbitCamera now supports right mouse buttons to change position (KhronosGroup#422) * right mouse camera controls * More accurate right click mouse motion * Set the correct filter mode when loading texture samplers (KhronosGroup#421) * Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Include .asmdef files for correct UPM package generation * Splitting out UnityGLTFEditor scripts with its own asmdef file * Fixing Travis build environment issues * Include .asmdef files for correct UPM package generation * Splitting out UnityGLTFEditor scripts with its own asmdef file * Pull down upstream changes * Fixing merge conflict * Enable Azure Pipelines UPM releases (KhronosGroup#2) * Update Export-upm-packages.sh to support Azure Pipelines * Remove UPM Package generation from .travis.yml UPM package generation now works with Azure Pipelines
* Add ImportProgress indication * PR Comments
…viously they were internal and it worked in some Unity projects because they'd all end up in the same assembly. Now that we've added assemblydefs, the UnityGLTF classes are in their own assembly. (KhronosGroup#426)
Note: this is implementing the suggestion from @lexaknyazev in KhronosGroup/glTF#1036 of putting morph target names in the primitive.extras field. |
…er+blendshapes' into u/adam/morph
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @infinitydelta ,
Thanks for this PR. This is great! We definitely want to take your changes.
I have a few suggestions/questions, mostly around whitespace. Also there is currently a merge conflict. I actually fixed all of the merge conflicts in my own branch if you want to just take them before making any changes from my suggestions.
https://github.com/KhronosGroup/UnityGLTF/tree/u/adam/morph
Adam
@@ -553,12 +563,14 @@ private void FilterPrimitives(Transform transform, out GameObject[] primitives, | |||
var nonPrims = new List<GameObject>(childCount); | |||
|
|||
// add another primitive if the root object also has a mesh | |||
if (transform.gameObject.GetComponent<MeshFilter>() != null | |||
&& transform.gameObject.GetComponent<MeshRenderer>() != null) | |||
if (transform.gameObject.activeSelf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures only what is active is exported. I found this to be useful from a user perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change since it's different from the current behavior. But I agree that it seems like it could be useful. I'll take your change but then make another on top of it to wrap this behavior in an option object that the caller can pass in at runtime.
@@ -320,6 +320,40 @@ public static void BuildMeshAttributes(ref Dictionary<string, AttributeAccessor> | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General question:
Do you need to do something in ConstructClip? I just pulled down your branch and loaded a couple sample models with morph targets and I did not see them animate. I had playAnimationOnLoad enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove whitespace Co-Authored-By: Adam Mitchell <[email protected]>
Co-Authored-By: Adam Mitchell <[email protected]>
Co-Authored-By: Adam Mitchell <[email protected]>
…eights are [0, 100] range Co-Authored-By: Adam Mitchell <[email protected]>
… (using minimum blendshape count)
…hub.com/infinitydelta/UnityGLTF into feature/skinnedmeshrenderer+blendshapes
Co-Authored-By: Adam Mitchell <[email protected]>
Co-Authored-By: Adam Mitchell <[email protected]>
…hub.com/infinitydelta/UnityGLTF into feature/skinnedmeshrenderer+blendshapes
Co-Authored-By: Adam Mitchell <[email protected]>
Hi @AdamMitchell-ms , Thank you for your feedback and suggestions. I've integrated most of what you suggested and left comments on remaining issues. Let me know if there are any more issues. |
Thanks for the submission @infinitydelta. Your change is now in master. |
…Group#363) * exporting smr and blendshapes * import gltf mesh with blendshapes/morph targets * add the ability to control the final LOD when far away (cull vs render last lod) (KhronosGroup#364) * add the ability to control whether objects with lod should render when very far away * pr feedback * Improve the performance of skinned animation import (KhronosGroup#360) * Improve the performance of skinned animation import Current implementation of importing animation curve is very slow for animations with lots of key frames. (e.g. motion capture animation ). The bottleneck is in AnimationCurve.keys return a copy instead of reference. Hence, updating key frame in AnimationCurve is expensive. I build a list of keyframe for the curve, calculate the tangents from interpolation mode and then feed the key frames to the curve to avoid the overhead. * Improve the performance of skinned animation import 1, put the delegate function at the top of the file 2, replace spaces with tab 3, replace the keyframe list cache with 2d array * fix level 3 warning. move tests to get the nunit dependency in editor (KhronosGroup#365) * move tests * fixes level 3 warnings * remove redundant namespace * fix ups to level 3 warnings. remove unnecessary namespaces * Fix mapping between GLTF sampler and Unity filter/wrap modes (KhronosGroup#375) * A fix for the freeze in editor when importing GLB-files (might affect gltf too), by never using multithreading in editor (KhronosGroup#368) * IsMultithreaded is now a property that always returns false when Application.isEditor is true. This prevents a "hard-freeze" in Unity editor when importing any GLB. * Update GLTFSceneImporter.cs Fixed a comment * Added conditional checks in SetUpBlendShapes to see if TargetNames and Semantic properties POSITION, NORMAL, TANGENT exist * Expose GPU-only texture option to user and fix mismatching sampler st… (KhronosGroup#378) * Expose GPU-only texture option to user and fix mismatching sampler state warning 'if' condition * Make linear/sRGB color space setting match spec * Update KHR_texture_transform support (KhronosGroup#371) * Update KHR_texture_transform support * Flip tex offset y coord * Fix non-conformant texture origin * Yield timeout should be common to all loaders as framerate is an appl… (KhronosGroup#379) * Yield timeout should be common to all loaders as framerate is an application-wide concern * Resolve comments * . * . * Create UPM compliant packages in releases (KhronosGroup#385) * Enable UPM packages to be generated in releases * Travis OSX package should already contain zip package * Remove draft=true for releases deployment * Remove logging of private data (KhronosGroup#386) * Support iOS for GLTFSerialization.dll (KhronosGroup#387) * Prevent InvalidCastException (KhronosGroup#399) Related to Issue KhronosGroup#398 * Fix stream disposing bug (KhronosGroup#388) * Invert the _Glossiness Material value (KhronosGroup#383) * The comparison of matrix class fails due to using the operator instead of .Equal causing both matrix and RST data (KhronosGroup#392) * Add Roughness float values to MetalRoughMap.cs * Add names to textures created by GLTFSceneImporter * Fix texture memory leak * Add task cancellation support * Add image name to texture name * Update UnityGLTF/Assets/UnityGLTF/Scripts/Cache/RefCountedCacheData.cs Co-Authored-By: rferrese <[email protected]> * Change cancellation in ConstructMesh * Camera in test scenes now moves only when dragged (mousedown) and the movement math is cleaner and more accurate, and zoom is now exponential instead of linear. (KhronosGroup#413) Also clean up some warnings around unused variables. * Fix loading time issue (KhronosGroup#414) * Simplify AsyncCoroutineHelper * revert default budget * Add missing meta file for integration test directory (KhronosGroup#419) * Add a component to display the list of models from gltf-Sample-Models and let you load them (KhronosGroup#420) * Add a component to display the list of sample models and let you load them at runtime. * Some improvements to the model list loader and adding a main scene to host it * Fix warning suppression * Address pr feedback. Remove commented line. Give a nice error if the model list json fails to download. Also improve orbit camera so that scrolling the other list doesn't cause it to zoom. * OrbitCamera now supports right mouse buttons to change position (KhronosGroup#422) * right mouse camera controls * More accurate right click mouse motion * Set the correct filter mode when loading texture samplers (KhronosGroup#421) * Fix for loading performance issue (KhronosGroup#423) * Set timeout after successfully awaiting. * fix spaces and remove file that unity keeps deleting * Fix UPM package generation issues for UWP (KhronosGroup#406) * Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Fixing Travis build environment issues * Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Fixing Travis build environment issues * Pull down upstream changes * Fixing merge conflict * Add Roughness float values to MetalRoughMap.cs * Add names to textures created by GLTFSceneImporter * Fix texture memory leak * Add task cancellation support * Add image name to texture name * Update UnityGLTF/Assets/UnityGLTF/Scripts/Cache/RefCountedCacheData.cs Co-Authored-By: rferrese <[email protected]> * Change cancellation in ConstructMesh * Camera in test scenes now moves only when dragged (mousedown) and the movement math is cleaner and more accurate, and zoom is now exponential instead of linear. (KhronosGroup#413) Also clean up some warnings around unused variables. * Fix loading time issue (KhronosGroup#414) * Simplify AsyncCoroutineHelper * revert default budget * Add missing meta file for integration test directory (KhronosGroup#419) * Add a component to display the list of models from gltf-Sample-Models and let you load them (KhronosGroup#420) * Add a component to display the list of sample models and let you load them at runtime. * Some improvements to the model list loader and adding a main scene to host it * Fix warning suppression * Address pr feedback. Remove commented line. Give a nice error if the model list json fails to download. Also improve orbit camera so that scrolling the other list doesn't cause it to zoom. * OrbitCamera now supports right mouse buttons to change position (KhronosGroup#422) * right mouse camera controls * More accurate right click mouse motion * Set the correct filter mode when loading texture samplers (KhronosGroup#421) * Include .asmdef files for correct UPM package generation * Fix missing Integrations .meta file position * Splitting out UnityGLTFEditor scripts with its own asmdef file * Build script updates to properly support UWP with UPM compliant package * Include .asmdef files for correct UPM package generation * Splitting out UnityGLTFEditor scripts with its own asmdef file * Fixing Travis build environment issues * Include .asmdef files for correct UPM package generation * Splitting out UnityGLTFEditor scripts with its own asmdef file * Pull down upstream changes * Fixing merge conflict * Enable Azure Pipelines UPM releases (KhronosGroup#2) * Update Export-upm-packages.sh to support Azure Pipelines * Remove UPM Package generation from .travis.yml UPM package generation now works with Azure Pipelines * Add ImportProgress indication (KhronosGroup#424) * Add ImportProgress indication * PR Comments * Make all of the maps public so that callers can derive from them. Previously they were internal and it worked in some Unity projects because they'd all end up in the same assembly. Now that we've added assemblydefs, the UnityGLTF classes are in their own assembly. (KhronosGroup#426) * Fix uwp build (KhronosGroup#427) * Update GLTFSerialization/GLTFSerialization/Schema/MeshPrimitive.cs remove whitespace Co-Authored-By: Adam Mitchell <[email protected]> * remove whitespace Co-Authored-By: Adam Mitchell <[email protected]> * remove whitespace Co-Authored-By: Adam Mitchell <[email protected]> * rename bsname to blendShapeName * add comment clarifying that GLTF weights are [0, 1] range but Unity weights are [0, 100] range Co-Authored-By: Adam Mitchell <[email protected]> * change logerror to logwarning, added some clarity of what will happen (using minimum blendshape count) * add curly braces to if else statement * remove space Co-Authored-By: Adam Mitchell <[email protected]> * remove whitespace Co-Authored-By: Adam Mitchell <[email protected]> * add function ContainsValidRenderer for better readability * remove whitespace Co-Authored-By: Adam Mitchell <[email protected]>
Implement feature for exporting GameObjects with SkinnedMeshRenderer and blendshapes and importing GLTFMeshes with blendshapes/morph targets.