MackeyK24 Posted September 27, 2018 Share Posted September 27, 2018 Yo @Deltakosh and @Sebavan ... I am having problems with loading a GLTF Character with Morph Targets. I exported a GLTF file with guy that has a SMILE MORPH TARGET... When viewing with BabylonJS the Skin on arms gets distorted with lines or something and IT DOES NOT show the actual SMILE on the face. But viewin the same file in simply switching to THREE.JS it look great, no distortion and is it showing the smile. Any clues ??? BabylonJS Screen Shot (Look close up on face and arms.. and NO SMILE) Now same GLTF Viewing session... just switched to THREE.JS Hmmm... We do support morph targets... right ??? Quote Link to comment Share on other sites More sharing options...
Guest Posted September 27, 2018 Share Posted September 27, 2018 Pinging @bghgary This should be supported Quote Link to comment Share on other sites More sharing options...
Guest Posted September 27, 2018 Share Posted September 27, 2018 Can you provide the gltf file? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 28, 2018 Author Share Posted September 28, 2018 Yo @Deltakosh and @bghgary Here is model... Just converted from Mixamo to GLTF using my Toolkit. Test GLTF Scene with Remy Quote Link to comment Share on other sites More sharing options...
bghgary Posted September 28, 2018 Share Posted September 28, 2018 Thanks @MackeyK24 This is a bug. I'm working on a fix. Quote Link to comment Share on other sites More sharing options...
bghgary Posted September 28, 2018 Share Posted September 28, 2018 Here is the PR: https://github.com/BabylonJS/Babylon.js/pull/5276 Note that this won't update what the glTF extension for vscode until the Babylon scripts are updated. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 28, 2018 Author Share Posted September 28, 2018 Yo @bghgary did you notice the multiple skeleton animations in that test Remy model. FYI... I made that export using that Animation baking code I sent you before where I thru all the bones and SAMPLE the animation clip then encode the TRS for each bone at the given frame time All other UnityGLTF seem to be missing that part that actually encode skeleton animations but my Canvas Tools works great... I am working on the actual blend shape animation key frames next ? bghgary 1 Quote Link to comment Share on other sites More sharing options...
bghgary Posted September 28, 2018 Share Posted September 28, 2018 @MackeyK24 Yes, I saw them. I verified all of them in the sandbox which is now updated with the fix. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 28, 2018 Author Share Posted September 28, 2018 I’m gonna optimize that Remy model for WebGL ...is strait from Miami... right now it has so many meshes, and materials as well as like 3 separate skeletons ... because each mesh may have a different root bone... them I resend case you wanna use that model for demo Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 30, 2018 Author Share Posted September 30, 2018 Yo @bghgary I have a question about the Accessor Mix And Max and GLTF Validator. For Example: I have a Vector3[] ExportAccessor function... during setting the mix and max... There is CLEARLY a -1 in the Vector.z in one of the vector4 array elements... that is the LOWEST Vector.Z value in the array... But for some reason the GLTF Validator in VSCODE and the one in the THREE.JS GLTF Viewer say there is a Validate error.. it says the min value = -1 BUT the Actual lowest value = 1. How can that be. I looped thru the whole array tracing the Z component... I clearly see a -1... I also popped those in a List and used the values.Min() and values.Max() functions... WHICH ALSO CLEAR RETURNS -1 as the lowest Z value. Why the heck would the validator say that wrong and the actual value is 1 ??? Quote Link to comment Share on other sites More sharing options...
bghgary Posted October 1, 2018 Share Posted October 1, 2018 @MackeyK24 My guess is that the data is being flipped somewhere after you calculate the min/max. In VSCode, you can inspect the values of the data by pressing Ctrl+D on a bufferView reference and see the values. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted October 2, 2018 Author Share Posted October 2, 2018 That makes sense ... I think I switch handiness in the ExportAccesor after the min max check... I’ll try start there Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted October 2, 2018 Author Share Posted October 2, 2018 Yo @bghgary ... Thanks a million bro. That was it exactly. I dont know how i missed that. I use buffer list for all values now and switch the handness when dumping into buffer list.. Then i can use that same list for Mix Max Values Function as well as loop thru serializing the values: One example ExportAccessor function: private AccessorId ExportAccessor(Vector3[] arr, bool switchHandedness=false, string accessorName = null) { var count = arr.Length; if (count == 0) { throw new Exception("Accessors can not have a count of 0."); } var accessor = new Accessor(); accessor.ComponentType = GLTFComponentType.Float; accessor.Count = count; accessor.Type = GLTFAccessorAttributeType.VEC3; accessor.Name = accessorName; List<Vector3> values = new List<Vector3>(); foreach (var vec in arr) { values.Add(switchHandedness ? vec.SwitchHandedness() : vec); } accessor.Min = new List<double> { values.Select(value => value.x).Min(), values.Select(value => value.y).Min(), values.Select(value => value.z).Min() }; accessor.Max = new List<double> { values.Select(value => value.x).Max(), values.Select(value => value.y).Max(), values.Select(value => value.z).Max() }; var byteOffset = _bufferWriter.BaseStream.Position; foreach (var vec in values) { _bufferWriter.Write(vec.x); _bufferWriter.Write(vec.y); _bufferWriter.Write(vec.z); } var byteLength = _bufferWriter.BaseStream.Position - byteOffset; accessor.BufferView = ExportBufferView((int)byteOffset, (int)byteLength); var id = new AccessorId { Id = _root.Accessors.Count, Root = _root }; _root.Accessors.Add(accessor); return id; } Works like a charm... 0 ERRORS now... Thanks again bghgary and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.