Quantcast
Channel: Questions in topic: "skinned mesh renderer"
Viewing all 192 articles
Browse latest View live

Android Build problem with blend weights

$
0
0
greetings, my problem is that on editor(PC) the skinned mesh animation is smooth, but after I build it on android, the skinned mesh animations blend weights loss, it look like all vertex weights become 1.0f. I have quality settings blends weights set to 4 bones.

Dynamic batching of animated models

$
0
0
Hi. I'm trying to batch drawing 100 of animated models. The original model of the 100 models are the same. I'm using SkinnedMeshRenderer for an ORIGINAL model, and setting baked(using SkinnedMeshRenderer.BakeMesh) mesh to MeshRenderer of the remaining 99 models. The material is the same. I think they are qualified to be batched because they are using the same material and the same mesh but actually they are not batched. Can you tell me why? I really want to reduce drawcalls and CPU usage of transforming each models.

How to calculate a vertex position of SkinnedMesh?

$
0
0
Hi there, I'm trying to calculate the position of the vertices in given skinned mesh. Well, the result is mostly right, but in many models there is always some visible "offset". the formula I'm using: pos = (bones's weight) * (bone's local2world matrix) * (SMR's RotationMatrix) * (bindPoseMatrix) * object-space-pos the final pos is weight-sumed. Transform smrTr = smr.transform; BoneWeight[] weights = mesh.boneWeights; Transform[] bones = smr.bones; Matrix4x4[] bindposes = mesh.bindposes; Vector3 localPos = mesh.vertices[vidx]; Matrix4x4 localMat = Matrix4x4.TRS(Vector3.zero, smrTr.localRotation, Vector3.one); if (bw.weight0 != 0) { Matrix4x4 mat = bones[bw.boneIndex0].localToWorldMatrix * localMat * bindposes[bw.boneIndex0]; pos += mat.MultiplyPoint(localPos) * bw.weight0; } if (bw.weight1 != 0) { Matrix4x4 mat = bones[bw.boneIndex1].localToWorldMatrix * localMat * bindposes[bw.boneIndex1]; pos += mat.MultiplyPoint(localPos) * bw.weight1; } if (bw.weight2 != 0) { Matrix4x4 mat = bones[bw.boneIndex2].localToWorldMatrix * localMat * bindposes[bw.boneIndex2]; pos += mat.MultiplyPoint(localPos) * bw.weight2; } if (bw.weight3 != 0) { Matrix4x4 mat = bones[bw.boneIndex3].localToWorldMatrix * localMat * bindposes[bw.boneIndex3]; pos += mat.MultiplyPoint(localPos) * bw.weight3; } You can see in the pic that, the red rect(the point I calculated) drifts away from the tips of the mesh. I cannot figure out where this offset comes from, any help is appreciated. ![alt text][1] [1]: /storage/temp/24713-points.jpg

Wrong normals in skinned mesh renderer

$
0
0
So, i've got a rigged and skinned model created in 3dMax and imported in my Unity project. But, all normals seems to be flipped in Skinned Mesh Renderer (skinnedmeshnormals.png). However, if I use regular Mesh Renderer - normals are Ok (regularmeshnormals.png). How can I solve this normal flipping in Skinned Mesh Renderer? And if I set Root Bone parameter in Skinned Mesh Renderer to None - all works fine, but Skinned Mesh Bounds are displaced. Is it solution of my problem? Or such approach may cause more issues in future? Because, as for me, it is not seems to be right to remove root bone parameter [1]: /storage/temp/24825-skinnedmeshnormals.png [2]: /storage/temp/24826-regularmeshnormals.png

Fuse character combining skinned meshes & materials to reduce draw calls

$
0
0
Hi, I'm trying to reduce the number of draw calls required to render a fuse character. The fuse character has a number of skinned mesh renderers (one for each body part) and the default export from Fuse creates one material for each. I understand it's possible to place all the textures for all body parts on a single texture (or, one each for diffuse, normal, specular, gloss) by exporting as OBJ from fuse, and having it pack and uv map the textures, and then apply these textures to the rigged FBX version from Fuse. This is where I'm struggling. Skinned meshes using the same material seem to require a draw call each. Tried using the SkinnedMeshCombiner, but after setting the textures to readable to get past the errors, this just causes the character to become invisible, no errors. Thanks for reading, any suggestions greatly appreciated.

Unity Skinning issues. Skinned mesh renderer.

$
0
0
Hello, Could someone shed some like on this? I am importing a character from blender to unity 4.6.3 and there are some problems with the skinning of the character. I am trying thought to access the skinned mesh renderer to set the quality. Yet it is greyed out. Like so: ![alt text][1] [1]: /storage/temp/42830-a.png Any ideas why? I have tried importing the same character in Unity 5 and it works perfectly. But the project I am working on atm is based in unity 4 and the devs are reluctant to migrate it to version 5.

is it possible to animate a mesh that was imported with another model?

$
0
0
I have 3 objects imported from blender. they were made from the same file and their armatures are identical in every way but they are not actually the same. the first is a naked model, the second is a mess of clothes and the third is just the armature I thought I'd use this one as a clothes-slot in instances of the first. The second is way too big to use in full even once. I could divide it up but I want to be able to mix it up freely, so I put a skinned mesh renderer and an animation controller in the third one and put it in an instance of the first and put a mesh from the second into the skinned mesh renderer. The clothes show up correctly scaled and positioned and they move along with "Root Bone", but only the instance of the first is animated. All 3 are correctly configured and the instance of the first animates correctly no matter which of the 3 avatars it uses. Is there something else I need to reference to get the clothes to animate, is there some other good way of doing this or is it simply impossible?

how can I load a mesh from a larger object in resources to put in a skinned mesh renderer at runtime?

$
0
0
I have already figured out how to get it correctly positioned and animated. In the editor I can go to assets, 'spread out' the fbx file, pull out the mesh I need and put it into the Mesh slot in a skinned mesh renderer. I need to know how to do that with script at runtime. I have seen many examples of people using mesh filter, but for some reason this gets an error how ever I try to do it so I think it might be obsolete or just people trying things that doesn't work. it either doesn't compile for me or I get an error at runtime saying that types can't be converted this way. I would prefer if I could to load the mesh directly. I have managed to load the whole fbx object, but I would prefer not to instantiate it at least.

how to link bones in many objects

$
0
0
Hi, here [picture][1], i want to merge UMA_Male_Rig on avatar with UMA_Male_Rig in jeans, its have the same structure, size, and vectors. Underlined [picture][2] have skinned mesh rendered linked with bones (eyes, legs tors etc have linked with rigs on avatar, jeans skinned mesh have linked with bones on jeans object), I would like to scale avatar, and when link will be merged jeans will be also scaled, for example when i set more size legs jeans also will grow up. Thank for help [1]: http://pl.tinypic.com/view.php?pic=2rppdfn&s=8#.VZJFTkYS2Ht [2]: http://pl.tinypic.com/view.php?pic=2uy6dqw&s=8#.VZJHn0YS2Hs

Change children of fbx files at runtime

$
0
0
![alt text][1] [1]: /storage/temp/51821-error.jpg I'm attempting to swap a mesh from the resources folder. As you can see in the top left corner, my Golfer_1_Skinned object (brought in from Blender) has an animator component. It then has the skinned mesh parts as children. What I want to do is simple use C# to swap the children fbx parts to have a different character. I can obviously gain access to the Left_Arm, Body, Right_Arm of the in-scene game object, and I can even swap out the mesh using the editor by dragging the arm part (circled bottom left) into the Mesh part of the Skinned Mesh Renderer and it works fine. However I can't seem to target that red left arm (called Golfer_2_Left) because it's a child of the Golfer_2_Skinned object in the resources folder. So I've tried to do... Mesh meshObj = Instantiate (Resources.Load("Golfer_2_Left")) as Mesh; LeftArm.GetComponent ().sharedMesh = meshObj; But it doesn't find it. I've even tried: Mesh meshObj = Instantiate (Resources.Load("Golfer_2_Skinned/Golfer_2_Left")) as Mesh; LeftArm.GetComponent ().sharedMesh = meshObj; Any idea how I can swap the meshes of the animated game object? Thank you

Skinned Mesh bug while assigning new bones

$
0
0
Hello. I've made a shirt for my character which is basically the same vertices as in the character model but without the unnecessary faces (like legs, head, etc.) - it has the identical rig, weights setup and it's in .blend format. Now I put it inside of my player model, positioned it and applied a script that assigns it the bones of my character so it animates along with it but the thing is that it gets all messed up. . **This is how it looks like in pause mode:** . **And this is what happens in play mode:** . **Here's how I setup the new bones:** public class BoneReplacer : MonoBehaviour { public GameObject target; SkinnedMeshRenderer myRenderer; Transform[] newBones; SkinnedMeshRenderer targetRenderer; Dictionary boneMap = new Dictionary(); void Start() { targetRenderer = target.GetComponent(); foreach(Transform bone in targetRenderer.bones) { boneMap[bone.gameObject.name] = bone; } myRenderer = gameObject.GetComponent(); newBones = new Transform[myRenderer.bones.Length]; for(int i = 0; i < myRenderer.bones.Length; i++) { GameObject bone = myRenderer.bones[i].gameObject; if(!boneMap.TryGetValue(bone.name, out newBones[i])) { Debug.Log("Unable to map bone ~" + bone.name + "~ to target skeleton!"); break; } } myRenderer.bones = newBones; } } . Generally everything is animating fine, bones are following the animation just right but as you can see the mesh is a mess. Does anyone of you know of any solution to this problem? I'd be very grateful for one!

how to use the unity3d 5.3 particle system shape of skinned mesh renderer?

$
0
0
when i choose the shape with skinned mesh renderer and selected the Mesh from my character's body (skinned mesh renderer), and playback the particle system, it's seem nothing happened. can anyone help me how to use this?

Skinned Mesh renderer skin normals option gone?

$
0
0
Just wondering if anybody knew about this and how to fix the issue? Our character's mesh normals are not updating when it is being animated with both bones and blendshape correctives. I new before that in the skinned mesh renderer there was an option to "skin normals". This is gone now, and I do not know if it is supposed to be automatically active or if there is another way to activate it now. Thanks,

Are there any performance benefits to non-skinned characters?

$
0
0
***Non-skinned*** as in ***made of multiple smaller meshes representing body parts***, that is. Forearms, arms, hands, etc. You can see this in [Wave Race 64][1] as well as Super Mario 64, and SEGA seemed to at least partially rely on it as late as [Virtua Fighter 3][2] and [Crazy Taxi][3]. I'm assuming a basic mesh renderer makes for less overhead than a skinned one, but pretty much the entire planet and their dog uses skinning since the early 2000s, giving UT no incentive to optimise any other technique. The base question is: > How much better optimised is> skinning? and the *actual* question that stumps me is > How does *one single skinned mesh renderer + filter* compare to> *potentially as many mesh renderers + filters as there are body> parts*, times up to -- say -- a hundred characters onscreen at any one> time? Additionally, if non-skinned wins: > Is it even worth the potential> extra geometry between joints? If it helps any, I'm not down to individual fingers or any facial animation. [1]: https://youtu.be/dGy3x_pcAbs?t=5m20s [2]: https://youtu.be/ihBCn5hfOJQ?t=21s [3]: https://youtu.be/92cjeGNLEvc?t=50s

Make one skinned mesh with weighted bone values take on the bone movement of a main skeleton?

$
0
0
My problem is i am getting a model that has been bone weighted in, this is a piece of armor. When i step through the piece of armour it has only 23 binding poses while the main body i am attaching it to has 29 .. this seems to pinch a bunch of the verticies into a center after i assign the 29 bones from the body mesh to it . 80% of the armour looks fine but the chunks that are moving with the body are all pinched into the center. Any Ideas? public void SetMaterialForSkinnedMesh(SkinnedMeshRenderer renderer, MeshFilter filter, k.RarityType rarity) { // renderer.rootBone = body.rootBone; renderer.sharedMesh = filter.sharedMesh; Transform[] bones = new Transform[renderer.sharedMesh.bindposes.Length]; for (int i = 0; i < renderer.sharedMesh.bindposes.Length; i++) bones[i] = boneMap[i]; renderer.bones = bones; // for (int i = 0; i < renderer.sharedMesh.bindposes.Length; i++) // { // renderer.sharedMesh.bindposes[i] = renderer.bones[i].worldToLocalMatrix * transform.localToWorldMatrix; // } renderer.sharedMaterial = Game.Instance.Materials[rarity.ToString()]; }

turning a character with skinned mesh renderer into a regular mesh renderer

$
0
0
I have a skinned mesh character that I have posed, but the character will remain totally static throughout my game. I'm wondering if there is a way to optimize my scene by converting that skinned Mesh renderer into a standard static mesh?

Unity assigns the wrong "Root Bone" to a Skinned Mesh Renderer. Can I fix this?

$
0
0
Hello! I have clothing objects that are rigged to go with the character. When I import the objects, the "Root Bone" in the Skinned Mesh Renderer component is usually off by one or two bones. For instance, a "Bracer" which should be on a forearm bone, ends up having "Upper Arm" as it's root bone. The result is that the bounding box moves with the root bone rather than the object -- this can cause the object to disappear in close up camera shots, as Unity things the object isn't in the frame when it is. This seems to be an automatic thing. I can adjust it and save a prefab, but I can't seem to adjust it in the project folder -- I only have access to that when it's in the hierarchy. Is there a way to adjust the import, so that the Root Bone is proper automatically? Thanks!

Optimizing Character Textures/Atlases for Zombie crowds

$
0
0
I am trying to figure out if it is worth it to use Texture Atlases for skinned mesh characters for a mobile game. I have 1 Zombie model with 4-6 different textures. I would have a mob of Zombies that could include all 4-6 texture variations on the same model. Assuming I just have 4 textures, Is it worth it to build a single 1024x1024 texture atlas containing all 4 textures, then shift UVs to change appearance...Or should I just use 4 separate textures at a smaller size like 256x256? Right now I don't feel the atlas approach is going to buy me much, but just wanted to get some feedback.

Mesh.bindposes official sample not working

$
0
0
Hi, I just copy and paste Mesh.bindposes official sample into unity 5.30, adjust the camera position and run. The quad is static and no any animation. Do you know what's wrong? Document: http://docs.unity3d.com/ScriptReference/Mesh-bindposes.html My code: using UnityEngine; using System.Collections; //[ExecuteInEditMode] public class Test : MonoBehaviour { // Use this for initialization void Start () { gameObject.AddComponent(); gameObject.AddComponent(); SkinnedMeshRenderer rend = GetComponent(); Animation anim = GetComponent(); // Build basic mesh Mesh mesh = new Mesh(); mesh.vertices = new Vector3[] { new Vector3(-1, 0, 0), new Vector3(1, 0, 0), new Vector3(-1, 5, 0), new Vector3(1, 5, 0) }; mesh.uv = new Vector2[] { new Vector2(0, 0), new Vector2(1, 0), new Vector2(0, 1), new Vector2(1, 1) }; mesh.triangles = new int[] { 0, 1, 2, 1, 3, 2 }; mesh.RecalculateNormals(); rend.material = new Material(Shader.Find("Diffuse")); // assign bone weights to mesh BoneWeight[] weights = new BoneWeight[4]; weights[0].boneIndex0 = 0; weights[0].weight0 = 1; weights[1].boneIndex0 = 0; weights[1].weight0 = 1; weights[2].boneIndex0 = 1; weights[2].weight0 = 1; weights[3].boneIndex0 = 1; weights[3].weight0 = 1; mesh.boneWeights = weights; // Create Bone Transforms and Bind poses // One bone at the bottom and one at the top Transform[] bones = new Transform[2]; Matrix4x4[] bindPoses = new Matrix4x4[2]; bones[0] = new GameObject("Lower").transform; bones[0].parent = transform; // Set the position relative to the parent bones[0].localRotation = Quaternion.identity; bones[0].localPosition = Vector3.zero; // The bind pose is bone's inverse transformation matrix // In this case the matrix we also make this matrix relative to the root // So that we can move the root game object around freely bindPoses[0] = bones[0].worldToLocalMatrix * transform.localToWorldMatrix; bones[1] = new GameObject("Upper").transform; bones[1].parent = transform; // Set the position relative to the parent bones[1].localRotation = Quaternion.identity; bones[1].localPosition = new Vector3(0, 5, 0); // The bind pose is bone's inverse transformation matrix // In this case the matrix we also make this matrix relative to the root // So that we can move the root game object around freely bindPoses[1] = bones[1].worldToLocalMatrix * transform.localToWorldMatrix; mesh.bindposes = bindPoses; // Assign bones and bind poses rend.bones = bones; rend.sharedMesh = mesh; // Assign a simple waving animation to the bottom bone AnimationCurve curve = new AnimationCurve(); curve.keys = new Keyframe[] { new Keyframe(0, 0, 0, 0), new Keyframe(1, 10, 0, 0), new Keyframe(2, 0.0F, 0, 0) }; // Create the clip with the curve AnimationClip clip = new AnimationClip(); clip.SetCurve("Lower", typeof(Transform), "localPosition.z", curve); clip.legacy = true; // float animationLenghtInSeconds = 2; // var rot = Quaternion.Euler(0, 0, 30); // var localRotXCurve = AnimationCurve.EaseInOut(0, transform.localRotation.x, animationLenghtInSeconds, rot.x); // var localRotYCurve = AnimationCurve.EaseInOut(0, transform.localRotation.y, animationLenghtInSeconds, rot.y); // var localRotZCurve = AnimationCurve.EaseInOut(0, transform.localRotation.z, animationLenghtInSeconds, rot.z); // var localRotWCurve = AnimationCurve.EaseInOut(0, transform.localRotation.w, animationLenghtInSeconds, rot.w); // clip.SetCurve("Lower", typeof(Transform), "localRotation.x", localRotXCurve ); // clip.SetCurve("Lower", typeof(Transform), "localRotation.y", localRotYCurve ); // clip.SetCurve("Lower", typeof(Transform), "localRotation.z", localRotZCurve ); // clip.SetCurve("Lower", typeof(Transform), "localRotation.w", localRotWCurve ); // Add and play the clip clip.wrapMode = WrapMode.Loop; anim.AddClip(clip, "test"); anim.Play("test"); } // Update is called once per frame void Update () { } }

Best armature creation for 3rd person game

$
0
0
Hey guys! So, actually im using Riggify to get a pretty nice rig, but im running into some problems at Unity. The first one is that i cant make the IK turning to work nicely (when you turn your mouse, your character turn the head more than the shoulders and the spine, for example), and the Cloth properties are kinda messed up, because the Skinned Mesh root bone is on the pinky bone of the armature, and when i change to the root one, the bounds goes nuts, and when i add the cloth... well, then it goes double nuts, to the point where the leather jacket just fly away to infinity. So... this is a Riggify problem? I should create my bones one by one, so i'll finish with the only ones that i need (not the WGT and GZM form riggify), or is there a setup on unity that i should do?![alt text][1] [1]: /storage/temp/72343-teste1.jpg
Viewing all 192 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>