You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a model is exported from Unity to the glb format, it seems that the material color is automatically slightly lightened.
Example:
The following model is being exported from Unity to the .glb format:
the following shader with the following material color is used:
In the next step, the model just exported is imported back into Unity, but the material color is slightly altered:
The issue occurs regardless of import during runtime or design-time.
glTFast version: 6.2.0
Unity Editor version: 2021.3.4f1
Render Pipeline and version: Built-in
Platform: Editor
export code:
var exportSettings = new ExportSettings
{
Format = GltfFormat.Binary,
FileConflictResolution = FileConflictResolution.Overwrite
};
var gameObjectExportSettings = new GameObjectExportSettings
{
OnlyActiveInHierarchy = false,
DisabledComponents = true,
};
var export = new GameObjectExport(exportSettings, gameObjectExportSettings);
export.AddScene(new GameObject[] { exportObject });
bool success = await export.SaveToFileAndDispose(metaDataHandler.pathCAD.Replace("_cad.json", ".glb"));
import code (during runtime):
try
{
success = await gltf.LoadGltfBinary(
data,
// The URI of the original data is important for resolving relative URIs within the glTF
new Uri(orgPath),
new ImportSettings()
);
} catch(Exception e)
{
success = false;
UnityEngine.Debug.Log("LoadGltfBinary failed: " + e.Message);
}
if (success)
{
GameObject model = new GameObject("ImportModel");
model.transform.parent = cadRoot.transform;
await gltf.InstantiateMainSceneAsync(model.transform);
...
The text was updated successfully, but these errors were encountered:
When a model is exported from Unity to the glb format, it seems that the material color is automatically slightly lightened.
Example:
The following model is being exported from Unity to the .glb format:
the following shader with the following material color is used:
In the next step, the model just exported is imported back into Unity, but the material color is slightly altered:
The issue occurs regardless of import during runtime or design-time.
export code:
import code (during runtime):
The text was updated successfully, but these errors were encountered: