Skip to content
Closed
Show file tree
Hide file tree
Changes from 15 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ libCesiumForUnityNative-*.so.meta
libCesiumForUnityNative-*.dylib
libCesiumForUnityNative-*.dylib.meta
Documentation~/Reference/
package-lock.json

1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
##### Additions :tada:

- Added option to ignore the `KHR_material_unlit` extension to force default lighting on tilesets.
- Moved flat normal generation into `CesiumDefaultTilesetShader` pixel shader. Custom lit materials should expose a boolean property `computeFlatNormals` and generate normals accordingly.

## v1.17.0 - 2025-08-01

Expand Down
12 changes: 6 additions & 6 deletions Editor/Cesium3DTilesetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,13 @@ private void DrawRenderProperties()
"Generate Smooth Normals",
"Whether to generate smooth normals when normals are missing in the glTF." +
"\n\n" +
"According to the glTF spec: \"When normals are not specified, client " +
"implementations should calculate flat normals.\" However, calculating flat " +
"normals requires duplicating vertices. This option allows the glTFs to be " +
"rendered with smooth normals instead when the original glTF is missing normals.");
"This option allows the glTFs to be rendered with smooth normals when the " +
" original glTF is missing normals. If normals are missing and this option " +
"is not enabled, flat normals should be generated in the shader. "
);
EditorGUILayout.PropertyField(this._generateSmoothNormals, generateSmoothNormalsContent);

var ignoreKhrMaterialsUnlit = new GUIContent(
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 +439,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
2 changes: 1 addition & 1 deletion Editor/ConfigureReinterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,4 @@ public void ExposeToCPP()
var exceptionMessage = exception.Message;
}
}
}
}
7 changes: 3 additions & 4 deletions Runtime/Cesium3DTileset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,9 @@ public Material opaqueMaterial
/// Whether to generate smooth normals when normals are missing in the glTF.
/// </summary>
/// <remarks>
/// According to the glTF spec: "When normals are not specified, client
/// implementations should calculate flat normals." However, calculating flat
/// normals requires duplicating vertices. This option allows the glTFs to be rendered
/// with smooth normals instead when the original glTF is missing normals.
/// This option allows the glTFs to be rendered with smooth normals instead when the original glTF is missing normals.
/// If normals are missing and this option is not enabled, flat normals should be generated
/// in the shader.
/// </remarks>
public bool generateSmoothNormals
{
Expand Down
5 changes: 2 additions & 3 deletions Runtime/ConfigureReinterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void ExposeToCPP()
int pixelWidth = c.pixelWidth;
float aspect = c.aspect;
bool isOrtho = c.orthographic;
float orthoSize = c.orthographicSize;
float orthoSize = c.orthographicSize;
//IFormattable f = new Vector3();
//IEquatable<Vector3> f2 = new Vector3();

Expand Down Expand Up @@ -236,7 +236,7 @@ public void ExposeToCPP()
string e = request.error;
string method = request.method;
string url = request.url;
if (request.result == UnityWebRequest.Result.Success) { };
if (request.result == UnityWebRequest.Result.Success) { }
request.downloadHandler = new NativeDownloadHandler();
request.SetRequestHeader("name", "value");
request.GetResponseHeader("name");
Expand Down Expand Up @@ -949,4 +949,3 @@ Cesium3DTilesetLoadFailureDetails tilesetDetails
}
}
}

17 changes: 9 additions & 8 deletions Runtime/Resources/CesiumDefaultTilesetMaterial.mat
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,17 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CesiumDefaultTilesetMaterial
m_Shader: {fileID: -6465566751694194690, guid: 407c0cff68611ac46a65eec87a5203f5,
m_Shader: {fileID: -6465566751694194690, guid: f1bf6a52c1d9b4896bcefbee4a1432af,
type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
- _BUILTIN_ALPHATEST_ON
- _BUILTIN_AlphaClip
- _DISABLE_SSR_TRANSPARENT
- _DOUBLESIDED_ON
m_InvalidKeywords: []
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 2450
m_CustomRenderQueue: -1
stringTagMap:
MotionVector: User
RenderType: TransparentCutout
Expand All @@ -43,6 +41,7 @@ Material:
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
Expand Down Expand Up @@ -101,7 +100,7 @@ Material:
- _AlphaCutoffEnable: 1
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMask: 1
- _AlphaToMaskInspectorValue: 0
- _BUILTIN_AlphaClip: 1
- _BUILTIN_Blend: 0
Expand All @@ -116,6 +115,7 @@ Material:
- _BUILTIN_ZWriteControl: 0
- _Blend: 0
- _BlendMode: 0
- _BlendModePreserveSpecular: 0
- _CastShadows: 1
- _ConservativeDepthOffsetEnable: 0
- _Cull: 0
Expand Down Expand Up @@ -168,6 +168,7 @@ Material:
- _ZWrite: 1
- _ZWriteControl: 0
- _baseColorTextureCoordinateIndex: 0
- _computeFlatNormals: 0
- _emissiveTextureCoordinateIndex: 0
- _metallicRoughnessTextureCoordinateIndex: 0
- _normalMapScale: 0
Expand Down Expand Up @@ -222,4 +223,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
version: 7
Loading
Loading