# v0.42

## ※Important Information※
The errors in VRM output from earlier versions (UniVRM 0.41 and before) have been fixed in v0.42. However, this fix comes along with the following impact:  

* The exported VRM data in v0.42 or later cannot be imported correctly in the earlier versions

When exporting VRM data using UniVRM, please check which version you use to make VRM model.
If you are using UniVRM to import VRM data, please update UniVRM to the latest version as soon as you can.

## UV Bugs Fix:
In v0.41 and the earlier versions, converting UV between Unity and GLTF was incorrect.

Before
```csharp
var converted_uv = new Vec2(uv.x, -uv.y);　// value becomes negative
```

After
```csharp
var converted_uv = new Vec2(uv.x, 1.0f-uv.y);
```

This change influences both import and export.

### Current status in v0.42:

* The UV of imported VRM is correct.
* V will become negative when loading the correct UV of VRM with the earlier versions.
* Texture display will be distorted if texture is set to `Clamp`. The default is `Repeat`.

|                    |VRM's UV in v0.41 and before|VRM's UV from v0.42|
|--------------------|----------------------|------------------------|
|Importer in UniVRM-0.41 and before |〇 (negative x negative = positive) |× (positive x negative = negative) |
|Importer from UniVRM-0.42 |〇              |〇            |
|General GLTF loader |×                     |〇                      |

* To developers: please update UniVRM to v0.42 as soon as possible.
* We created a judger based on the string `UniGLTF-1.16 (v0.42)` in GLTF `/assets/generator` in importer to detect whether a VRM model is made by the version before 0.42. For v0.42, it can import VRM model correctly.

## Tangents Bugs Fix:
The method to call [Mesh.RecalculateTangents](https://docs.unity3d.com/ScriptReference/Mesh.RecalculateTangents.html) 
was inappropriate and it was not able to generate Tangents.
We have fixed this issue.
It influences the use of normal map.

### Tangents processing modification: 
* Tangents can be calculated and generated from Normal and UV
* The differences of coordinate axes between GLTF and Unity can be absorbed
* File size can be decreased if Tangents is not recorded

Based on the reasons above, we decided not to export Tangents.
(If any problem occurs, please let us know through https://github.com/ousttrue/UniGLTF/issues)

## GLTF Improvement:

### `/bufferViews/*/byteStride`will not output
It seems necessary for outputting OpenGL's interleaved vbo format:

```csharp
// Example of interleaved format
struct Vertex
{
  public Vector3 Position;
  public Vector3 Normal;
}
Vertex[] Vertices;
```
Since UniGLTF outputs separate arrays for each vertex attribute, ByteStride was unnecessary.

> When this is not defined, data is tightly packed. When two or more accessors use the same bufferView, this field must be defined.

Also, we found that ByteStride should not output to Index.

### GLTF material support improvement:

* `/materials/*/alphaMode`
* `/materials/*/doubleSided`
* KHR_material_unlit
* texture sampler(repeat, clamp, mirror)
* https://github.com/ousttrue/UniGLTF/issues/12
* [Handling semi-transparent texture #28](https://github.com/dwango/UniVRM/issues/28)

[Details](https://github.com/ousttrue/UniGLTF/wiki/Material)

Also, when setting MToon, we tried to pass parameters as many as possible to GLTF material: `KHR_material_unlit, AlphaMode, DoubleSided`.

This improvement has influences on VRM files changed to .glb format when loading with other tools.

## VRM JsonShcema Release:

* https://github.com/dwango/UniVRM/tree/master/specification/0.0/schema

## Directory Structure Changes:

* VRM/UniHumanoid => VRM/UniGLTF/UniHumanoid
* VRM/Scripts/DepthFirstScheduler(Former UniTask) => VRM/UniGLTF/DepthFirstScheduler

## BlendShape Asset:
The asset for BlendShape now is independent (previously it is a sub-asset of Prefab)
* https://github.com/dwango/UniVRM/pull/26

## BlendShape Reference:
The state of BlendShape before model normalization is now used as a reference. You can make BlendShape before normalization and Bake the state of BlendShape during normalization.

## UniHumanoid BVH Judgement Fix:
We fixed BVH skeleton estimation.
Report errors here when it fails: https://github.com/ousttrue/UniHumanoid/issues
