
| features |
importer |
exporter |
memo |
| color |
o |
o |
/materials/#/pbrMetallicRoughness/baseColorFactor |
| color texture |
o |
o |
/materials/#/pbrMetallicRoughness/baseColorTexture |
| sampler |
o |
o |
/samplers |
| multi uv |
|
|
|
| metallic map |
o |
|
/materials/#/pbrMetallicRoughness/metallicRoughnessTexture, require convert |
| normal map |
o |
|
/materials/#/normalTexture |
| occlusion map |
o |
|
/materials/#/occlusionTexture, require convert |
| emissive |
o |
|
/materials/#/emissiveFactor, material.enalbeKeyword("_EMISSION") not affect |
| emissive map |
o |
|
/materials/#/emissiveMap, material.enalbeKeyword("_EMISSION") not affect |
var texture=new Texture2D(2, 2);
texture.LoadImage(bytes, true);
texture.wrapModeU = TextureWrapMode.Clamp;
texture.wrapModeV = TextureWrapMode.Clamp;
texture.filterMode = FilterMode.Point;
var shader=Shader.Find("Standard");
var material=new Material(shader);
material.color = pbrMetallicRoughness.baseColorFactor;
material.mainTexture = texture;
| features |
importer |
exporter |
memo |
| positions |
o |
o |
/meshes/#/primitives/#/attributes/POSITION, reverse-z |
| normals |
o |
o |
/meshes/#/primitives/#/attributes/NORMAL, reverse-z |
| uv |
o |
o |
/meshes/#/primitives/#/attributes/TEXCOORD_0, reverse-y |
| tangent |
o |
o |
/meshes/#/primitives/#/attributes/TANGENT, reverse-z |
| primitive |
o |
o |
/meshes/#/primitives/#/indices |
| sharing attributes |
o |
o |
|
var mesh=new Mesh();
mesh.vertices = positions;
mesh.normals = normals;
mesh.uv = uv;
mesh.subMeshCount=primitiveCount;
for(int i=0; i<primitiveCount; ++i)
{
mesh.setTriangles(primitive[i].indices, i);
}
| features |
importer |
exporter |
memo |
| blend shape |
o |
o |
/meshes/#/primitives/#/targets |
| name ? |
|
|
|
foreach(var target in targets)
{
mesh.addBlendSapeFrame(target.name, 100.0f, target.POSITION, target.NORMAL, target.TEXCOORD_0);
}
- Matrix4x4 Behavior may be different between Unity 2017 and Unity 5.6
- Because of the bindmatrix, The animation of models with different inverseBindMatrices and node hierarchy break
// workaround. calculate bindMatrices from hierarchy
var hipsParent = nodes[skin.skeleton].Transform.parent;
var bindMatrices = joints.Select(y => y.worldToLocalMatrix * hipsParent.localToWorldMatrix).ToArray();
mesh.bindposes = bindMatrices;
| features |
importer |
exporter |
memo |
| boneweight |
o |
o |
/meshes/#/primitives/#/attributes/(JOINTS_0,WEIGHTS_0) |
| bindmatrix |
o |
o |
/skins/#/inverseBindMatrices |
| skeleton |
o |
o |
/skins/#/skeleton |
| joints |
o |
o |
/skins/#/joints |
mesh.boneWeights=boneWeights;
mesh.bindposes=inverseBindMatrices
var skin=go.addCompoenent<SkinnedMeshRenderer>();
skin.bones=joints;
skin.rootBone=skeleton;
| features |
importer |
exporter |
memo |
| translation |
o |
o |
/nodes/#/tlanslation, reverse-z |
| rotation |
o |
o |
/nodes/#/rotation, reverse-z |
| scale |
o |
o |
/nodes/#/scale |
| matrix |
o |
- |
/nodes/#/matrix, reverse-z |
- reverse-z. BindMatrices reverse-z in global, each curves reverse-z in bone local.
- AnimationUtility.GetCurveBindings
| features |
importer |
exporter |
memo |
| TRS |
o |
o |
/anmations/#/channels/#/target/path == translation |
| blendshape |
o |
|
/animation/#/channels/#/target/path == weight |
| interpolation |
|
|
|
foreach (var binding in AnimationUtility.GetCurveBindings(clip))
{
// Curve binding acquisition is possible only in editor mode
var curve = AnimationUtility.GetEditorCurve(clip, binding);
foreach(var key in curve.keys)
{
}
}
for Animation component.
var clip=new AnimationClip();
clip.legacy=true;
var animation = go.AddComponent<Animation>();
animation.clip = clip;
for Animator component.
for Animator component. require humanoid avatar.