Skip to content
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4e1cdd1
Updated editor and tileset with KHR_materials_unlit option
david-lively Aug 5, 2025
5dbf57c
Added check for khr_ignore_unlit
david-lively Aug 5, 2025
8a71f7a
Changed checkbox label in editor
david-lively Aug 5, 2025
9cd2432
Updated changelog
david-lively Aug 5, 2025
a66bb91
Formatting
david-lively Aug 5, 2025
7ceaff3
Update CHANGES.md
david-lively Aug 5, 2025
6ddcc6b
Overriding primitiveInfo.isUnlit so that the khr_material_unlit flag …
david-lively Aug 5, 2025
f729277
Added support for KHR_material_unlit override
david-lively Aug 6, 2025
42ce4cc
Unrolled changes to cesium-native. Added CreateModelOptions struct to…
david-lively Aug 7, 2025
a934090
Update ConfigureReinterop.cs
david-lively Aug 7, 2025
bf7fd74
Update ConfigureReinterop.cs
david-lively Aug 7, 2025
bc9559f
Removed unused include
david-lively Aug 7, 2025
db7ccbe
Added a comment to CesiumPrimitiveInfo::isUnlit
david-lively Aug 7, 2025
8fd4f47
Moved CreateModelOptions from separate header into UnityPrepareRender…
david-lively Aug 7, 2025
2277e48
Restored original material file from main
david-lively Aug 8, 2025
d5128bc
Renamed field to follow established naming conventions
david-lively Aug 8, 2025
667432b
Address PR feedback
david-lively Aug 8, 2025
998e0bd
Moved CreateModelOptions into tilesetOptions.rendererOptions
david-lively Aug 8, 2025
4966168
added std::make_any<> for readability.
david-lively Aug 8, 2025
c8c5cf5
Formatting.
david-lively Aug 8, 2025
18c12e7
Added explicit keyword to address a warning
david-lively Aug 11, 2025
440d1dc
Added package-lock.json to gitignore
david-lively Aug 11, 2025
7ac3553
Revert "Added package-lock.json to gitignore"
david-lively Aug 11, 2025
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
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 option to ignore the `KHR_material_unlit` extension to force default lighting on tilesets.

## v1.17.0 - 2025-08-01

##### Additions :tada:
Expand Down
15 changes: 15 additions & 0 deletions Editor/Cesium3DTilesetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class Cesium3DTilesetEditor : Editor
private SerializedProperty _culledScreenSpaceError;

private SerializedProperty _opaqueMaterial;
private SerializedProperty _ignoreKHRMaterialsUnlit;
//private SerializedProperty _useLodTransitions;
//private SerializedProperty _lodTransitionLength;
private SerializedProperty _generateSmoothNormals;
Expand Down Expand Up @@ -83,6 +84,7 @@ private void OnEnable()
// this.serializedObject.FindProperty("_lodTransitionLength");
this._generateSmoothNormals =
this.serializedObject.FindProperty("_generateSmoothNormals");
this._ignoreKHRMaterialsUnlit = this.serializedObject.FindProperty("_ignoreKHRMaterialsUnlit");

this._pointCloudShading = this.serializedObject.FindProperty("_pointCloudShading");

Expand Down Expand Up @@ -425,6 +427,19 @@ private void DrawRenderProperties()
"normals requires duplicating vertices. This option allows the glTFs to be " +
"rendered with smooth normals instead when the original glTF is missing normals.");
EditorGUILayout.PropertyField(this._generateSmoothNormals, generateSmoothNormalsContent);

var ignoreKHRMaterialsUnlit = 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 "+
"shadows. This property will have no effect if the tileset does not have any "+
"tiles that use this extension. "+
"\n\n"+
"The KHR_materials_unlit extension is often applied to photogrammetry "+
"tilesets because lighting and shadows are already baked into their "+
"textures. "
);
EditorGUILayout.PropertyField(this._ignoreKHRMaterialsUnlit, ignoreKHRMaterialsUnlit);
}

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

[SerializeField]
private bool _ignoreKHRMaterialsUnlit = false;

/// <summary>
/// Whether to ignore the KHR_materials_unlit extension on the glTF tiles in
/// this tileset, if it exists
/// </summary>
/// <remarks>
/// 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
/// shadows. This property will have no effect if the tileset does not have any
/// tiles that use this extension.
///
/// The KHR_materials_unlit extension is often applied to photogrammetry
/// tilesets because lighting and shadows are already baked into their
/// textures.
/// </remarks>
public bool ignoreKHRMaterialsUnlit
Comment thread
david-lively marked this conversation as resolved.
Outdated
{
get => this._ignoreKHRMaterialsUnlit;
set
{
this._ignoreKHRMaterialsUnlit = value;
this.RecreateTileset();
}
}


[SerializeField]
private CesiumPointCloudShading _pointCloudShading;

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.ignoreKHRMaterialsUnlit = tileset.ignoreKHRMaterialsUnlit;
tileset.createPhysicsMeshes = tileset.createPhysicsMeshes;
tileset.suspendUpdate = tileset.suspendUpdate;
tileset.previousSuspendUpdate = tileset.previousSuspendUpdate;
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
Comment thread
david-lively marked this conversation as resolved.
Outdated
244 changes: 244 additions & 0 deletions native~/Runtime/package-lock.json

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

Loading
Loading