Following on from my post the other day about importing in to Blender. I need to change the bind pose to the T form so that all my animations start off from the same pose.
Repositioning the model can be done by posing the model using the armature. The trouble is that the moment you try to edit the mesh it always reverts to the original rest pose position.
I want to set the vertices in the posed position and for them to stay there.
I am sure I used to be able to move the model in pose mode and then apply that pose as the rest pose. I tried that and tried searching Google but nothing worked.
I eventually found what I needed and it is very simple.
Before doing anything save a separate copy of the file because you may want to go back and change your mind about the pose but the following removes the armature from the mesh.
Fixing the Pose
Pose the model in whatever form needed, swap back to Object mode and select the model not the armature and then simply press the button to apply the armature modifier.
Job done, the Object is now separated from the armature and remains in the pose it was last in when you edit it.
It is not always ideal to remove the armature but at least I can re-add an armature if necessary.
It's taken me most of the afternoon to work out how to do this but now I have run out of time. Sunday dinner is ready and I am unlikely to have time to edit the pose in to the T-pose until next weekend!
Sunday 16 September 2012
Thursday 13 September 2012
Importing In To Blender
I have purchased a few models to help make the levels a bit more interesting. It is supposed to save me time so I don't have to create them all myself but it has taken me a while to find a good method to get the models in to Blender.
The sets of models come with loads of different file types for each model. The most useful being Autodesk FBX, Collada DAE, Wavefront OBJ and Lightwave LWO. The trouble is none of them are fully compatible with the Blender importers for them!
Some of them just cause errors and will not import, some import without their textures but by far the biggest problem is that the models import as one object with multiple textures. The latter looks OK but the moment you edit them the textures get combined on to just one of the supplied textures spoiling the look of the model!
I have a solution for most of the issues with static models but I have not got anything reliable for the armature and animations in animated models.
Getting the model in to Blender
I found the best solution for static, non-animated, models was to use the Autodesk FBX converter (v2013.2). Take the FBX file as the source and output to an OBJ file. The result is compatible with the OBJ importer in Blender (2.63a).
It's very easy to use, just open the source FBX shown on the left, select OBJ on the right hand side and press convert.
Animated Models
As mentioned above I do not have a reliable solution for these. I would welcome hearing from anyone who does. Luckily the animated models I have purchased, so far, have always had a version of Collada compatible with Blender supplied with them. I can fix the other problems with the imported files using the techniques that follow.
I have tested converting FBX files to Collada using the Autodesk FBX Converter mentioned above and the results have failed to open in Blender!
As far as I know OBJ files do not contain any animation information. You can convert the mesh to OBJ but the armature and the animations are lost.
I cannot find a way to scale animations and keep them working!
Textures
Blender can find the textures more reliably if they are all in the same folder as the blend file. The first job I do at the start is to find all the images from the originating folders and copy them in to whichever folder I have created the blend file in.
Some source files contain the paths used by the author on their machine. That is not very helpful. You can use a text editor to fix this but I find that converting the FBX file as described above usually fixes that problem at the same time.
Importing
No need for instructions for this bit. Its just select import from the file menu, the import type, Wavefront (.obj) or Collada (.dae) and select the file.
A word of warning. Animated models can take a very long while to load. If Blender appears to hang, give it a chance. For one model I had to wait nearly 5 minutes but it did load eventually.
Rotation
If you've used the importer on the model you should have it in Blender looking correct but it might still have some problems. Most common is that lots of other 3D modelling editors use the Y axis for up but Blender uses Z for up.
When imported in to Blender an Object rotation might have been added so the model looks the correct way up. Check what the rotation is in the Transform window.
Alternately, the model appears laying on it's back but the Object rotation is set to zero.
My preference is to end up with no rotation in Object mode and apply any rotation needed in Edit mode. That is required if you want to use the model in XNA.
Blender has a simple function to sort this out but as is common with Blender it is lost within all the other features. See the apply menu which pops up when you press Ctrl+A.
First get the model looking the right way up in Object mode. If the model is laying on its back usually all that is needed is to manualy type in 90 in to the X axis field of the rotation transformation.
Once the model appears the correct way up and if it has a transformation you can apply that transformation to remove the Object mode settings and apply that to the vertices and armature. (Ctrl+A)
In Object mode select the model that needs rotating. It the model has an armature also select that at the same time. I usually select the mesh first then the armature. I don't know if it makes any difference.
Make sure the cursor (or whatever point is used for rotating and scaling round) is at exactly the same point as the origin of your model.
Move the model and the cursor to zero first or probably better still use the pivot centre that rotates and scales round the model.
With the rotation point in the correct position, from the Object menu, Apply, Rotation.
The model will stay the same but the transform settings will change to nothing.
If the model is animated, now is a good time to check that the actions still look correct.
Scale and Location
I would also recommend removing any scale and location before you start using the model. This is Just so you have a clean slate when you start. It is almost essential to do this if you want to use the model with XNA.
In object mode you can just edit the fields to a scale of one and location of zero. There are similar methods to that described for rotation to apply location and scale.
If you want the model to stay still and just the origin move apply the location (Ctrl+A L). I find that useful for laying out levels. If you want the whole model to move to zero then manually edit the location.
I have had mixed results with scale but mainly because the results can be dramatically affected by the rotation point. Make sure that you know where whatever rotation point you are using is. That rotation point affects what the model will look like after applying the scale. If all three scales are already the same yiou can just set them all to one and adjust the size of the model in Edit mode.
Separate The Textures
Although at this stage the model should look correct, if you were to try to manipulate it in Edit mode you would find that the UV mapping would get messed up. For some reason unknown to me the model is imported as a single object with multiple textures. I have no idea how to deal with a model like that in Blender.
I find the simplest solution is to split the model by its component textures before it gets muddled up.
It must be a common thing because Blender has a simple method to do this called Separate.
Select the model, go to EDIT mode and press P to separate. From the drop down list on the popup menu select 'By Material'. Job done. Now you have one object per texture. Much easier to keep the model looking as it should.
That's it. A few steps to get there but the model is in a usable form within Blender.
The sets of models come with loads of different file types for each model. The most useful being Autodesk FBX, Collada DAE, Wavefront OBJ and Lightwave LWO. The trouble is none of them are fully compatible with the Blender importers for them!
Some of them just cause errors and will not import, some import without their textures but by far the biggest problem is that the models import as one object with multiple textures. The latter looks OK but the moment you edit them the textures get combined on to just one of the supplied textures spoiling the look of the model!
I have a solution for most of the issues with static models but I have not got anything reliable for the armature and animations in animated models.
Getting the model in to Blender
I found the best solution for static, non-animated, models was to use the Autodesk FBX converter (v2013.2). Take the FBX file as the source and output to an OBJ file. The result is compatible with the OBJ importer in Blender (2.63a).
It's very easy to use, just open the source FBX shown on the left, select OBJ on the right hand side and press convert.
Animated Models
As mentioned above I do not have a reliable solution for these. I would welcome hearing from anyone who does. Luckily the animated models I have purchased, so far, have always had a version of Collada compatible with Blender supplied with them. I can fix the other problems with the imported files using the techniques that follow.
I have tested converting FBX files to Collada using the Autodesk FBX Converter mentioned above and the results have failed to open in Blender!
As far as I know OBJ files do not contain any animation information. You can convert the mesh to OBJ but the armature and the animations are lost.
I cannot find a way to scale animations and keep them working!
Textures
Blender can find the textures more reliably if they are all in the same folder as the blend file. The first job I do at the start is to find all the images from the originating folders and copy them in to whichever folder I have created the blend file in.
Some source files contain the paths used by the author on their machine. That is not very helpful. You can use a text editor to fix this but I find that converting the FBX file as described above usually fixes that problem at the same time.
Importing
No need for instructions for this bit. Its just select import from the file menu, the import type, Wavefront (.obj) or Collada (.dae) and select the file.
A word of warning. Animated models can take a very long while to load. If Blender appears to hang, give it a chance. For one model I had to wait nearly 5 minutes but it did load eventually.
Rotation
If you've used the importer on the model you should have it in Blender looking correct but it might still have some problems. Most common is that lots of other 3D modelling editors use the Y axis for up but Blender uses Z for up.
When imported in to Blender an Object rotation might have been added so the model looks the correct way up. Check what the rotation is in the Transform window.
Alternately, the model appears laying on it's back but the Object rotation is set to zero.
My preference is to end up with no rotation in Object mode and apply any rotation needed in Edit mode. That is required if you want to use the model in XNA.
Blender has a simple function to sort this out but as is common with Blender it is lost within all the other features. See the apply menu which pops up when you press Ctrl+A.
First get the model looking the right way up in Object mode. If the model is laying on its back usually all that is needed is to manualy type in 90 in to the X axis field of the rotation transformation.
Once the model appears the correct way up and if it has a transformation you can apply that transformation to remove the Object mode settings and apply that to the vertices and armature. (Ctrl+A)
In Object mode select the model that needs rotating. It the model has an armature also select that at the same time. I usually select the mesh first then the armature. I don't know if it makes any difference.
Make sure the cursor (or whatever point is used for rotating and scaling round) is at exactly the same point as the origin of your model.
Move the model and the cursor to zero first or probably better still use the pivot centre that rotates and scales round the model.
With the rotation point in the correct position, from the Object menu, Apply, Rotation.
The model will stay the same but the transform settings will change to nothing.
If the model is animated, now is a good time to check that the actions still look correct.
Scale and Location
I would also recommend removing any scale and location before you start using the model. This is Just so you have a clean slate when you start. It is almost essential to do this if you want to use the model with XNA.
In object mode you can just edit the fields to a scale of one and location of zero. There are similar methods to that described for rotation to apply location and scale.
If you want the model to stay still and just the origin move apply the location (Ctrl+A L). I find that useful for laying out levels. If you want the whole model to move to zero then manually edit the location.
I have had mixed results with scale but mainly because the results can be dramatically affected by the rotation point. Make sure that you know where whatever rotation point you are using is. That rotation point affects what the model will look like after applying the scale. If all three scales are already the same yiou can just set them all to one and adjust the size of the model in Edit mode.
Separate The Textures
Although at this stage the model should look correct, if you were to try to manipulate it in Edit mode you would find that the UV mapping would get messed up. For some reason unknown to me the model is imported as a single object with multiple textures. I have no idea how to deal with a model like that in Blender.
I find the simplest solution is to split the model by its component textures before it gets muddled up.
It must be a common thing because Blender has a simple method to do this called Separate.
Select the model, go to EDIT mode and press P to separate. From the drop down list on the popup menu select 'By Material'. Job done. Now you have one object per texture. Much easier to keep the model looking as it should.
That's it. A few steps to get there but the model is in a usable form within Blender.
Sunday 9 September 2012
Texture Names
I'm doing more and more of my level design within Blender. The process is much quicker. I can import nearly any model type and line it up as I want then export to a single FBX file for use in the game's pipeline.
I slightly changed my XNA code to sort models at the mesh level rather than the model level so I can load FBX files containing multiple models and multiple meshes. So far it works well.
In the process of doing this I notices that most models use a suffix to the texture name to indicate if the image is the diffuse texture or a normal map or a specular map etc. I had been using a prefix. I don't know if it will be useful in the future but I decided to do the same as everyone else before I had gone too far.
When renaming the UV map in Blender you need to be aware that the name of the texture on disk and internal name used by Blender are not necessarily the same.
When you replace the image you can see the old name used which will not have been renamed.
To ensure that the name used in the FBX export and the name on disk and the name within Blender are all the same I do the following:
The final crucial bit is to...
I use the same file name as the name shown in Blender.
In my opinion having the same name throughout saves a lot of confusion when transfering the exported FBX file and the textures for use in the XNA pipeline.
I slightly changed my XNA code to sort models at the mesh level rather than the model level so I can load FBX files containing multiple models and multiple meshes. So far it works well.
In the process of doing this I notices that most models use a suffix to the texture name to indicate if the image is the diffuse texture or a normal map or a specular map etc. I had been using a prefix. I don't know if it will be useful in the future but I decided to do the same as everyone else before I had gone too far.
When renaming the UV map in Blender you need to be aware that the name of the texture on disk and internal name used by Blender are not necessarily the same.
When you replace the image you can see the old name used which will not have been renamed.
To ensure that the name used in the FBX export and the name on disk and the name within Blender are all the same I do the following:
- Open the blend file before changing anything.
- Rename the files on disk.
- Rename the UV maps in Blender.
The final crucial bit is to...
- replace the file used in Blender with the renamed one.
I use the same file name as the name shown in Blender.
In my opinion having the same name throughout saves a lot of confusion when transfering the exported FBX file and the textures for use in the XNA pipeline.
Subscribe to:
Posts (Atom)