Search Unity

Character Model Pivot issues with Probuilder and Blender

Discussion in 'Asset Importing & Exporting' started by KnightsHouseGames, Apr 12, 2021.

  1. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    So I have gone pretty far out of my way to avoid using Blender, but have found myself in a position where I have no choice but to use it, and it has been like pulling teeth

    I made my initial character model inside Unity, via Probuilder, and I think it came out pretty good.

    Screenshot_2021-04-12_17-56-45.png

    I'm going for a Low Poly-ish look, think late PS1/Early PS2

    The issue is the pivots are all messed up. I tried freezing transforms and centering the pivot and all that good stuff inside Probuilder, and the point from which you move the model inside Unity is indeed the center of the character, but the problems begin once I try to export the model outside of Unity.

    I exported it as an OBJ and used Mixamo to rig it. That worked...OK. The rig attached to the model just fine, but the vertex weights left something to be desired. My hope was I could import it into Blender, do the weight painting myself, then set up some basic IK and do the animating myself there for a quick idle and walk cycle. But this is where I noticed the first issue. It took a second to find the model in the preview windows on the site. I thought little of it at the time, and moved on

    Then I took the rigged model into Blender. I dislike using blender, I was trained to use Maya in school, and Maya, along with Unity, and pretty much any other normal 3D software I've ever tried, uses certain keybinds and ways of doing things that are all pretty much identical and make sense. But not Blender. And setting it to "industry standard" controls is deceptive, because it only changes some things, just enough to make it similar, but somehow more infuriating. And then while in that mode, you can't follow any tutorials, because the keybinds in the tutorial are never the industry standard controls, so you have to use the awful default controls....

    Anyway....This is where the problems became more serious. When I swap from object to edit mode, the model jumps way off the center point of the scene and all the individual parts just go off whatever which way, and the model and armature don't want to always stay together, and I can't seem to get them to sit in the center no matter what I try.

    I know it's some sort of pivot point problem, I just have no idea how to fix it in either program. I tried what I thought was supposed to fix it in Probuilder, but that didn't seem to actually fix it. When I try to rotate the model, it shows that it's moving the position of the model in addition to adjusting the rotation to compensate for the issue, because when I try to manually set the rotation inside the inspector, it jumps away exactly like it does in Blender. I thought it was just Blender doing Blender things, but clearly the issue is more serious than that.

    So how can I fix this?
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    If your model moves when you rotate it then it sounds like your model's pivot is far outside of the mesh. It also sounds like your rig is weird.

    I would open your unrigged character in Blender. In object mode, make sure the object's transform position is 0,0,0. Then in edit mode, select all of the vertices and move them so that the model is where you want relative to the origin. Usually I have the origin at the very bottom of the model (where the floor would be) right between the feet. Rig it after the pivot is correct.

    Also, Blender's default fbx export is a little wonky. It exports the model with unexpected rotation values. I don't know if it makes any difference in Mixamo (never used Mixamo myself), but I recommend you install this script in to Blender (just to make your life easier ;)):
    https://github.com/EdyJ/blender-to-unity-fbx-exporter
     
  3. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    I gotta be honest, I had forgotten about this thread until I went through my tabs just now.... I have a lot of tabs....

    Anyway, I mostly fixed the issue with the pivot. I suspect I didn't fully understand how freezing transforms worked in Probuilder. It seems to just pretend the pivot point has been moved in Unity worldspace rather than actually moving it, so it leads to a lot of confusion when you export it. So I had to find the actual origin point of the scene and move the model there are orient it there the way I wanted it before exporting it. Maybe I was supposed to do that from the start, I dunno.

    After fumbling around Blender for the better part of a month, I finally have a set of animations I'm ready to test with in my project. The Miximo rig works fine, it's a little weird in some places, but it works better than the one I made, no weird issues with intersecting meshes or anything like that.

    @kdgalla Thanks for this tip, I hadn't even thought about the possibility of export weirdness.

    As has been made clear here, I am inexperienced with Blender. Will this script work in the Linux version of Blender? I assume it will because it's Python, but I don't know for sure. I'm also not 100% on how to install this, but I would like to if it would make my life easier
     
  4. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    So uhh....It KINDA worked?

    The model imported just fine, the exporting add-on worked no problem, animations all there and whatnot, but err...

    Screenshot_2021-05-13_17-21-04.png
    The textures....not so much...

    The skirt worked as I UV'd it, but everything else is kind of a wreck, and I'm not sure why...

    Weirdly, not all the UVs are broken on the main model...

    Screenshot_2021-05-13_17-25-03.png
    Literally these 2 faces, and a single random face on each glove came in right. Everything else is broken...

    Also, the pauldrons kinda got mangled a bit, but I might just be able to bring those in as separate models or something

    Is there something I did wrong in Blender to screw up the UVs or something?
     
  5. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    Just to be sure, you did unwrap everything, right? I've not problems with UVs importing except in cases where a mesh had more than one UV mapping in Blender. In that case only the first one will import as UV0.
     
  6. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    I know I did, I did it in Probuilder before the initial export. You can see what it was supposed to look like in the image in the first post. And the UVs on the faces that do have a texture on them are in the correct spots, so it must have kept at least some of that data.

    Looking at the UVs in Blender, it looks like there are 2 layers, and layer 0 is the correct UVs, with the exception of those 3 faces, while the other one is just those 3 faces.

    The UVs are definitely here for sure, it just only exported that second, screwed up layer instead of the default Layer 0, and I have no idea why. I don't even know why it has those 2 layers, thats not how I did it.
     
  7. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    As I understand, Unity will automatically add a second set of UVs to a mesh for light-maps. Maybe that's it? Your texture UVs should not be divided over the two sets, though. It should have kept all of your texture UVs in the first set so I don't know why you'd have problems in some parts of the model. Maybe whatever you are using to export the model from Unity to Blender is fusing vertexes or something?

    Last time I dealt with this sort of thing, the UV sets from Blender, importing into Unity depended on what order they were listed in the "object data properties" tab in Blender. Whichever UV set I put at the top of the list always imported as UV0 (the texture UVs). That was several Blender versions ago, so maybe it's different now.
     
  8. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    Is there a way for me to fuse these two sets back together into a single UV set, so theres no way for it to get confused?

    In my hierarchy or whatever they call it in Blender on the side, it says there are 2 versions of the model in the scene. At least, thats how I interpret it, I'm not sure if theres supposed to be 2 or what?

    Screenshot_2021-05-14_16-58-42.png

    This is it showing with the layer with the almost complete set of UVs that didn't go along with the export. In the upper corner you can see "AriModel" and "AriModel8". I'm not sure if those are both supposed to be there, I just know there wasn't 2 when I exported the model from Unity.
     
    Last edited: May 14, 2021
  9. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    Not sure what you mean by "two versions of the model". I see at least 6 meshes In your scene here. Are all of your meshes unwrapped to the same texture map?
     
  10. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    Nah, the other parts are just the pieces like the skirt and pauldrons and the sheath for the sword, stuff I wanted to have move along with the rig. They were all UV'd separately. The only one that seemed to stay intact is the one for his skirt, which came out fine.

    What I mean is "Ari Model" which is the main model, and "AriModel8" which I have no idea the origin of.

    But I guess none of the other models had clones, and they came out messed up too, so maybe it's nothing?

    All I know for certain is that at least in SOME capacity, the UV data is there. I just don't know how to get it to export with the correct UVs all in one place
     
  11. KnightsHouseGames

    KnightsHouseGames

    Joined:
    Jun 25, 2015
    Posts:
    850
    So the question I have now is can I merge the 2 layers of UVs into a single layer? And will that even solve my problem?

    I'm not even really sure what to search for, and most of the results I find are usually out of date or have nothing to do with what I'm trying to do.