kuligs2 lol I was about to suggest that your origin axis or something to that effect was flipped in Blender

kuligs2 xyz uhm, i think i did that because i needed the x/y/z axis to be in aligned position with the mouse positive negative x/y axis so that it could translate without the trying to convert them somehow i cant even imagine right now..

Yeah but you don't need that at all. The orientation/basis of the gizmo or of the bone is not important as you're just need to set the position to a point calculated by constraining the mouse projection to a plane.

    xyz Continuing debugging, i noticed:

    When i click on the ball (i removed look_at() ) i print out positions of the ball and intersection.

    ball_node.gd

    if cam != null:
    	#look_at(cam.global_transform.origin,Vector3.UP)
    
    	print("interset click0: ", global_position)
    	
    	temp_plane = Plane(cam.global_transform.basis.z,global_position)
    
    	var RAY_LENGTH = (cam.global_position - global_position).length()*1.1
    	var mousepos = get_viewport().get_mouse_position()
    
    	var origin = cam.project_ray_origin(mousepos)
    	var end = origin + cam.project_ray_normal(mousepos) * RAY_LENGTH
    	var query = PhysicsRayQueryParameters3D.create(origin, end)
    	query.exclude = [self]
    	query.collide_with_areas = true
    	var intersect = temp_plane.intersects_ray(end, cam.global_transform.origin-global_position)
    	if intersect:
    
    		ball_position_changed.emit(bone_index, intersect)
    		print("interset click1: ", intersect)
    		ball_clicked.emit(position)

    Clicking the ball that is not related to bones prints out position that is close to real position of the ball.

    interset click0: (0, 0.959433, -1.63808)
    interset click1: (0.03866, 0.905366, -1.619112)

    But when i click the ball that is attached to bone, the ball jumps to some arbitrary location and prints out that wrong location.

    While i was writing this, i figured it out i think.

    Previously on garbanzo..

    func _on_ball_position_changed(bone_index, bone_pos):
    
    	skeleton_3d.set_bone_pose_position(bone_index,bone_pos)
    
    	pass

    Working code:

    func _on_ball_position_changed(bone_index, bone_pos):
    	
    	var pos =  bone_pos * skeleton_3d.global_transform
    	skeleton_3d.set_bone_pose_position(bone_index,pos)
    
    	pass

    So the problem was the transforms3d as per usual..
    Another culprit is that skeleton_3d.get_bone_global_pose and skeleton_3d.set_bone_pose_position work in local coord space relative to skeleton.

    But.. as per usual, some things are still not working.. 😃.. In the video i try to move the child-bone and this messes up everything.. mowing root-bone works as expected.

    Still need to work on the child node manipulations..

    • xyz replied to this.

      xyz

      func get_bones():
      	var bone_count = skeleton_3d.get_bone_count()
      	
      	if bone_count <1:
      		return
      	for b_index in range(0,bone_count-1):
      		
      		var b_pos = skeleton_3d.get_bone_global_pose(b_index)
      		var pos =  skeleton_3d.global_transform * b_pos * global_transform
      
      		var new_ball:Ball = ball.instantiate()
      		new_ball.ball_position_changed.connect(_on_ball_position_changed)
      		new_ball.bone_index = b_index
      		new_ball.cam = cam
      • xyz replied to this.

        kuligs2 This is initialization but balls of child bones are moving when you move a parent ball. How do you update this?

          xyz

          func _on_skeleton_updated():
          	pass
          	
          	for child:Ball in ball_nodes.get_children():
          		var b_pos = skeleton_3d.get_bone_global_pose(child.bone_index)
          		var pos =  skeleton_3d.global_transform * b_pos * global_transform
          		child.global_transform = pos

          Tomcat Blend shapes are per-vertex animation technique. It has nothing to do with what is happening here. Even skeletal mesh animation is not relevant. The problem very likely boils down to faulty transform calculations.

            xyz Blend shapes are per-vertex animation technique.

            I mean, both are changes to the meshes. Yeah, in different ways. But they're similar enough in appearance. We don't know the end goal thoroughly. Somehow modifying by bones is supposed to be easier for the engine (so it's sometimes claimed). I want to try it, though I'm still vague about how it might be.

              Tomcat so its a blender thing.. not really what im looking for unless the "end" goal i have in mind can be achieved with this.

              I agree with xyz, its always transforms..

              Tomcat well i didnt know any other way to do what i want - change for instance character shape.. i havent tested this with baked in animations, how it will all work, but the goal is to have character manipulation thingie, that players can set up their char face or any other bone/mesh the way they want.. with limits tho 😃..

              I kinda hate when devs take a shortcut and just give few options to change the hair or have pre baked faces or body types..

              I think something similar is in ARK survival game, tho i dont remember if you could adjust face.. i mean if you can adjust bone then face should be no problem.. ??

                kuligs2 so its a blender thing.. not really what im looking for unless the "end" goal i have in mind can be achieved with this.

                Well, those keys can be transferred to the engine.

                well i didnt know any other way to do what i want - change for instance character shape..

                Yep, that's exactly what the keys are for.

                But character customization is a bit more complicated. Just to give you a very brief rundown on that: you have to be careful to match the rig and the mesh.

                  Tomcat Well, those keys can be transferred to the engine.

                  from what i seen keys are like linear manipulation, but idk.. yes i saw you can export to godot, but i dont like that you have to manually select vertices and move to a "maximum" distortion value rather than just modifying the root deformation bone somehow.. idk.. maybe the bone thing wont work out with animations etc.. need more testing..

                  Tomcat But character customization is a bit more complicated. Just to give you a very brief rundown on that: you have to be careful to match the rig and the mesh.

                  yeah this i learned, but you need to scale rig + mesh at the same time, and it should be ok, pretty easy to do in godot on node level.

                    kuligs2 need more testing..

                    Yeah, I want to try that too.

                    but you need to scale rig + mesh at the same time, and it should be ok, pretty easy to do in godot on node level.

                    No, it's not the size (not only the size) but the ratio of the different bones that changes, and this leads to severe distortions.

                    So i keep breaking things, not sure how and why..

                    Idea today was to create function that resets the bones to the initial positions. But somehow when i do that the mesh is mangled up.

                    As a bonus i figured out why the child bone didnt work properly. It was that function that get triggered when the skeleton is updated, so i disabled it and now i can move child bones and the bone/ball is not jumping away from my grip but the mesh is still deforming in not the bone direction but opposite (child bones)

                    Working code so far:

                    func get_bones():
                    	var bone_count = skeleton_3d.get_bone_count()
                    	
                    	if bone_count <1:
                    		return
                    	for b_index in range(0,bone_count-1):
                    		
                    		# works	
                    		var b_pos = skeleton_3d.get_bone_global_pose(b_index)
                    		var pos =  skeleton_3d.global_transform * b_pos
                    
                    		var new_ball:Ball = ball.instantiate()
                    		new_ball.ball_position_changed.connect(_on_ball_position_changed)
                    		new_ball.bone_index = b_index
                    		new_ball.cam = cam
                    	
                    		new_ball.global_transform = pos
                    		ball_nodes.add_child(new_ball)
                    	get_bone_reset_postions()
                    	pass
                    	
                    func _on_ball_position_changed(bone_index, bone_pos):
                    
                    	# works
                    	var pos =  bone_pos * skeleton_3d.global_transform 
                    	skeleton_3d.set_bone_pose_position(bone_index,pos)
                    
                    	pass
                    
                    func get_bone_reset_postions():
                    	var bone_count = skeleton_3d.get_bone_count()
                    	
                    	if bone_count <1:
                    		return
                    	for b_index in range(0,bone_count-1):
                    		# works	
                    		var b_pos = skeleton_3d.get_bone_global_pose(b_index)
                    		var pos =  skeleton_3d.global_transform * b_pos
                    		
                    		reset_bones_positions[b_index] = pos
                    	print("Reset position get")
                    		
                    func set_bone_reset_postions():
                    	
                    	for child:Ball in ball_nodes.get_children():
                    		child.global_transform = reset_bones_positions[child.bone_index]
                    		
                    		var pos =  reset_bones_positions[child.bone_index].origin * skeleton_3d.global_transform 
                    		skeleton_3d.set_bone_pose_position(child.bone_index,pos)
                    	print("Reset position set")

                    Its all inside the garbanzo - the face scene where i have access to skeleton and ball_node which contains balls that gets spawned by get_bones()

                    Continuing observations..
                    Godot does not import last added bone in blender..

                    I created new mesh and new bones from scratch. And now the movements are again flipped.. its not consistent.. script hasnt changed..

                    And same script with the other mesh

                    Not sure how and why this is happening and how to proceed..

                    Maybe its time to investigate shape keys??

                    EDIT:
                    One thing i noticed while here is that bone direction are different in blender, maybe thats the reason?

                    While the garbanzo works decent on the bones that are not the nose, the suzy bones do not at all..

                    EDIT2:

                    Ah yes.. yes yes yes.. this is quite peculiar.

                    TLDR:
                    Cannot chain bones if you want to deform mesh
                    Remember to add last sacrificial bone in blender because godot is too based to import it.
                    In blender, create bones that are Z-aligned (call em Z-bones) Z- axis in godot, in blender it could be either x or y

                    Note:
                    So for deformation in godot, you want to create separate armature that is based on the things i mentioned above.

                    Next:
                    Try to create idle animation for the mesh, then deform bones in godot and see how animation looks after deform.

                    Next - to last:
                    Try to save deform bone transforms to import them from either file or memory and apply it to the current session.

                      works just fine on my end, just downloaded the zip, added the extracted zip folder and imported and edit in godot.

                      • xyz replied to this.

                        kuligs2 something wrong with main.tscn. Cannot seem to load referenced cholo.tscn.
                        Remove all other mesh stuff, keep only the monkey.

                          kuligs2 Could be the blender version. You're probably using the latest latest latest version, right?

                          kuligs2 Got it loading after pointing Godot to the latest Blender version and deleting import cache.

                          The balls on monkey head appear to be working as expected.

                            xyz didnt you read my TLDR?

                            kuligs2 TLDR:
                            Cannot chain bones if you want to deform mesh
                            Remember to add last sacrificial bone in blender because godot is too based to import it.
                            In blender, create bones that are Z-aligned (call em Z-bones) Z- axis in godot, in blender it could be either x or y

                            Note:
                            So for deformation in godot, you want to create separate armature that is based on the things i mentioned above.

                            Next:
                            Try to create idle animation for the mesh, then deform bones in godot and see how animation looks after deform.

                            Next - to last:
                            Try to save deform bone transforms to import them from either file or memory and apply it to the current session.

                            • xyz replied to this.

                              kuligs2 Yeah the importer probably mangled the file because I had Blender 3.1

                              kuligs2 Umm, too much stuff for me. I'm not interested in playing. If you have a specific problem - ask. Otherwise, I'm leaving you to your tinkering.

                              If you want each bone to behave something like Maya's cluster deformer then of course there's no point in making the hierarchy. Just parent them all to some root transform and edit vertex weights for each. No big deal.

                              kuligs2 Godot does not import last added bone in blender..

                              Are you importing a .blend file? Try gltf — there is a difference.

                              And, yeah, I guess there must be a root bone to which the mesh change bones are attached.

                              Tomcat Well, you are right. This is the correct way to go on about for character creation. Now i need to find a good workflow that i could apply to character making..

                              How did i came to this conclusion?

                              Well..
                              First i created the cube with bones and added animation, animating bones. then i imported to my godot (blend file) and with the ball nodes tried to move bones into position, and then play animation. and it reset bone positions.
                              For this to work i would have to calculate the animation bone transforms relative to what i set the deform to, but that is outside my abilities.
                              While you could do what maths pros like @xyz does and calculate their way out of situations, i just go the least resistance path 😃..

                              So the least resistance would be to deform enough the character mesh parts,, create necessary shape keys, animate char like usual with rig and then import the glft file, blend file does not import shape keys, annd use the same bone animation along with shape key values.

                              Now i need to figure out if you can go above 1.0 value in godot. In blender you can.

                              EDIT:

                              This oldschool video shows little bit about how to use blender shapekeys in godot

                              You dont need that escn importer/exporter, gltf/glb file can do that too. Atleast in blender 4.2.1 and godot 4.3

                                kuligs2 This oldschool video shows little bit about how to use blender shapekeys in godot

                                Well, thanks for the tons of ads! Can you tell me in a nutshell how this is different from my tutorial?

                                Now i need to figure out if you can go above 1.0 value in godot. In blender you can.

                                Why? Make the shape for max change, so you don't need more than 1.

                                For this to work i would have to calculate the animation bone transforms relative to what i set the deform to

                                It's enough to bind the change bones of the mesh (make them children) to the bones of the model's rig, so that they move together. Here is an example, when boobs and butt are controlled by bones attached to the skeleton.

                                As far as I understand, this is roughly the method used in the first animations — moving vertices, before the invention of the rig. Now they are coming back to this idea (kind of like surface animation). But the question arises — how many such bones are needed to control the mesh? Ideally, probably as many as there are nodes on the mesh. Something too much turns out.

                                  Tomcat Well, thanks for the tons of ads! Can you tell me in a nutshell how this is different from my tutorial?

                                  not sure what ads you talking about. And your tutorial seems pretty software specifit as it generates predefined meshes with predefined structure. I was talking in general terms. Its not necesarily used for characters. You could bind the shapekeys to objects etc..

                                  Also Like i said, that blend file is not exporting shapekeys for some reason. Maybe it worked in godot 3.4 and blender 3.2 but not in godot 4.3 and blender 4.2. You ahve to export to gltf file to get access to blend shapes.

                                  Tomcat Why? Make the shape for max change, so you don't need more than 1.

                                  To have faces like this:




                                  Tomcat It's enough to bind the change bones of the mesh (make them children) to the bones of the model's rig, so that they move together. Here is an example, when boobs and butt are controlled by bones attached to the skeleton.

                                  this implies you need to add more bones to the rig. while this is possible, im not sure how this is going to be in production.. i mean im no pro when it comes to these things.. i try not to get too complex otherwise ill set myself up for a failure to deliver something 🙂.

                                  Also this looks super crazy..

                                  Crazy ass rig

                                  And face

                                  But it deforms so beautifully

                                    kuligs2 not sure what ads you talking about.

                                    Oh, come on, there.

                                    In our country now slow down YouTube and cut off VPN — you can watch only through TOR. And waiting for the ads to load (usually at the beginning) — the pleasure is much below average.

                                    You could bind the shapekeys to objects etc..

                                    It's not a good idea.

                                    To have faces like this:

                                    Oh, gross! It's a bug, not a feature. And if you need to do randomization of characters, will such monsters run all over the world? The process has to be controlled. Morph shape = maximum variation. If you need special deviations, make the morph accordingly. But again up to 1.

                                    this implies you need to add more bones to the rig.

                                    Yep.

                                    Also this looks super crazy..

                                    Yep again. Full customization is a real nightmare.

                                      Morgan's proportions were not customizable afaik. Those are all animation bones but it's likely a multitude of different skeletons and bone sets that are turned on/off in realtime as needed in the game context.

                                        Tomcat In our country now slow down YouTube and cut off VPN — you can watch only through TOR. And waiting for the ads to load (usually at the beginning) — the pleasure is much below average.

                                        any invidious instance should help, you can copy and paste the yt link inside it and watch there, https://iv.nowhere.moe/

                                        Tomcat It's a bug, not a feature.

                                        To each their own.

                                        xyz Morgan's proportions were not customizable afaik.

                                        I know, i just wanted to show an example of crazy bones.

                                        Right now im trying to rig a simple face mesh, animate it a bit, and then see what kind of bones i can attach and where to make some morphs work and keep the morph when its animating..

                                        Thankfully blender offers ready made assets https://www.blender.org/download/demo-files/

                                        7 days later

                                        Continuing, ive come to a result which seems more doable with my skillset.

                                        Stumble upon this Starts @ 254s

                                        It boils down to this:
                                        Face with interactable areas

                                        Hovering mouse over the area highlights the are you can adjust

                                        Guy even went so far to add colorpicker for that area

                                        This is all done with blendshapes, so you dont lose the rigged character animations.

                                          Now my question to myself is how to set up the blendshapes so that the modifying in the character creation feels natural?...

                                          • xyz replied to this.