Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ libCesiumForUnityNative-*.so.meta
libCesiumForUnityNative-*.dylib
libCesiumForUnityNative-*.dylib.meta
Documentation~/Reference/
bin.meta
obj.meta

6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## ? - ?

##### Additions :tada:

- Added an option to `Cesium3DTileset` to enable tangent generation on the CPU for any tiles that are missing them.

## v1.18.0 - 2025-09-02

##### Additions :tada:
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions Editor/Cesium3DTilesetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class Cesium3DTilesetEditor : Editor
//private SerializedProperty _useLodTransitions;
//private SerializedProperty _lodTransitionLength;
private SerializedProperty _generateSmoothNormals;
private SerializedProperty _alwaysIncludeTangents;

private SerializedProperty _pointCloudShading;

Expand Down Expand Up @@ -84,6 +85,8 @@ private void OnEnable()
// this.serializedObject.FindProperty("_lodTransitionLength");
this._generateSmoothNormals =
this.serializedObject.FindProperty("_generateSmoothNormals");
this._alwaysIncludeTangents =
this.serializedObject.FindProperty("_alwaysIncludeTangents");
this._ignoreKhrMaterialsUnlit = this.serializedObject.FindProperty("_ignoreKhrMaterialsUnlit");

this._pointCloudShading = this.serializedObject.FindProperty("_pointCloudShading");
Expand Down Expand Up @@ -428,7 +431,17 @@ private void DrawRenderProperties()
"rendered with smooth normals instead when the original glTF is missing normals.");
EditorGUILayout.PropertyField(this._generateSmoothNormals, generateSmoothNormalsContent);

var ignoreKhrMaterialsUnlit = new GUIContent(
var alwaysIncludeTangents = new GUIContent(
"Always Include Tangents",
"Whether to generate tangents when they are missing from the glTF. " +
"According to the glTF spec: \"When tangents are not specified, client " +
"implementations SHOULD calculate tangents using default MikkTSpace algorithms " +
"with the specified vertex positions, normals, and texture coordinates " +
"associated with the normal texture.\""
);
EditorGUILayout.PropertyField(this._alwaysIncludeTangents, alwaysIncludeTangents);

var ignoreKhrMaterialsUnlitContent = new GUIContent(
"Ignore KHR_materials_unlit",
"Whether to ignore the KHR_materials_unlit extension on the glTF tiles in "+
"this tileset, if it exists, and instead render with standard lighting and "+
Expand All @@ -439,7 +452,7 @@ private void DrawRenderProperties()
"tilesets because lighting and shadows are already baked into their "+
"textures. "
);
EditorGUILayout.PropertyField(this._ignoreKhrMaterialsUnlit, ignoreKhrMaterialsUnlit);
EditorGUILayout.PropertyField(this._ignoreKhrMaterialsUnlit, ignoreKhrMaterialsUnlitContent);
}

private void DrawPointCloudShadingProperties()
Expand Down
21 changes: 21 additions & 0 deletions Runtime/Cesium3DTileset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,27 @@ public bool generateSmoothNormals
}
}

[SerializeField]
private bool _alwaysIncludeTangents = false;
/// <summary>
/// Whether to generate tangents when they are missing from the glTF.
/// </summary>
/// <remarks>
/// According to the glTF spec: "When tangents are not specified, client
/// implementations SHOULD calculate tangents using default MikkTSpace algorithms
/// with the specified vertex positions, normals, and texture coordinates
/// associated with the normal texture."
/// </remarks>
public bool alwaysIncludeTangents
{
get => this._alwaysIncludeTangents;
set
{
this._alwaysIncludeTangents = value;
this.RecreateTileset();
}
}

[SerializeField]
private bool _ignoreKhrMaterialsUnlit = false;

Expand Down
1 change: 1 addition & 0 deletions Runtime/ConfigureReinterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ public void ExposeToCPP()
//tileset.useLodTransitions = tileset.useLodTransitions;
//tileset.lodTransitionLength = tileset.lodTransitionLength;
tileset.generateSmoothNormals = tileset.generateSmoothNormals;
tileset.alwaysIncludeTangents = tileset.alwaysIncludeTangents;
tileset.ignoreKhrMaterialsUnlit = tileset.ignoreKhrMaterialsUnlit;
tileset.createPhysicsMeshes = tileset.createPhysicsMeshes;
tileset.suspendUpdate = tileset.suspendUpdate;
Expand Down
10 changes: 7 additions & 3 deletions Runtime/Resources/CesiumDefaultTilesetMaterial.mat
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ Material:
m_Name: CesiumDefaultTilesetMaterial
m_Shader: {fileID: -6465566751694194690, guid: 407c0cff68611ac46a65eec87a5203f5,
type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
- _BUILTIN_ALPHATEST_ON
- _BUILTIN_AlphaClip
m_InvalidKeywords:
- _DISABLE_SSR_TRANSPARENT
- _DOUBLESIDED_ON
m_InvalidKeywords: []
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
Expand All @@ -43,6 +45,7 @@ Material:
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
Expand Down Expand Up @@ -101,7 +104,7 @@ Material:
- _AlphaCutoffEnable: 1
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMask: 1
- _AlphaToMaskInspectorValue: 0
- _BUILTIN_AlphaClip: 1
- _BUILTIN_Blend: 0
Expand All @@ -116,6 +119,7 @@ Material:
- _BUILTIN_ZWriteControl: 0
- _Blend: 0
- _BlendMode: 0
- _BlendModePreserveSpecular: 0
- _CastShadows: 1
- _ConservativeDepthOffsetEnable: 0
- _Cull: 0
Expand Down Expand Up @@ -222,4 +226,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
version: 7
Loading