Skip to content

Commit 171c3f8

Browse files
Refactor: Remove unused shader properties
This commit removes obsolete and unused shader properties from UnityToon and UnityToonTessellation shaders. Co-authored-by: sindharta.tanuwijaya <sindharta.tanuwijaya@unity3d.com>
1 parent fa12677 commit 171c3f8

File tree

2 files changed

+4
-149
lines changed

2 files changed

+4
-149
lines changed

com.unity.toonshader/Runtime/Integrated/Shaders/UnityToon.shader

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//Unity Toon Shader
1+
//Unity Toon Shader
22
//nobuyuki@unity3d.com
33
//toshiyuki@unity3d.com (Intengrated)
44

@@ -268,26 +268,13 @@ Shader "Toon" {
268268
_NormalScale("_NormalScale", Range(0.0, 8.0)) = 1
269269

270270
_BentNormalMap("_BentNormalMap", 2D) = "bump" {}
271-
_BentNormalMapOS("_BentNormalMapOS", 2D) = "white" {}
272271

273272
_HeightMap("HeightMap", 2D) = "black" {}
274-
// Caution: Default value of _HeightAmplitude must be (_HeightMax - _HeightMin) * 0.01
275-
// Those two properties are computed from the ones exposed in the UI and depends on the displaement mode so they are separate because we don't want to lose information upon displacement mode change.
273+
// Caution: Default value of _HeightAmplitude must stay in sync with authored displacement data.
276274
[HideInInspector] _HeightAmplitude("Height Amplitude", Float) = 0.02 // In world units. This will be computed in the UI.
277275
[HideInInspector] _HeightCenter("Height Center", Range(0.0, 1.0)) = 0.5 // In texture space
278276

279-
[Enum(MinMax, 0, Amplitude, 1)] _HeightMapParametrization("Heightmap Parametrization", Int) = 0
280-
// These parameters are for vertex displacement/Tessellation
281277
_HeightOffset("Height Offset", Float) = 0
282-
// MinMax mode
283-
_HeightMin("Heightmap Min", Float) = -1
284-
_HeightMax("Heightmap Max", Float) = 1
285-
// Amplitude mode
286-
_HeightTessAmplitude("Amplitude", Float) = 2.0 // in Centimeters
287-
_HeightTessCenter("Height Center", Range(0.0, 1.0)) = 0.5 // In texture space
288-
289-
// These parameters are for pixel displacement
290-
_HeightPoMAmplitude("Height Amplitude", Float) = 2.0 // In centimeters
291278

292279
_DetailMap("DetailMap", 2D) = "linearGrey" {}
293280
_DetailAlbedoScale("_DetailAlbedoScale", Range(0.0, 2.0)) = 1
@@ -300,7 +287,6 @@ Shader "Toon" {
300287
_AnisotropyMap("AnisotropyMap", 2D) = "white" {}
301288

302289
[HideInInspector] _DiffusionProfile("Obsolete, kept for migration purpose", Int) = 0
303-
[HideInInspector] _DiffusionProfileAsset("Diffusion Profile Asset", Vector) = (0, 0, 0, 0)
304290
[HideInInspector] _DiffusionProfileHash("Diffusion Profile Hash", Float) = 0
305291
_SubsurfaceMask("Subsurface Radius", Range(0.0, 1.0)) = 1.0
306292
_SubsurfaceMaskMap("Subsurface Radius Map", 2D) = "white" {}
@@ -327,25 +313,15 @@ Shader "Toon" {
327313
[Enum(Off, 0, From Ambient Occlusion, 1, From Bent Normals, 2)] _SpecularOcclusionMode("Specular Occlusion Mode", Int) = 1
328314

329315
[HDR] _EmissiveColor("EmissiveColor", Color) = (0, 0, 0)
330-
// Used only to serialize the LDR and HDR emissive color in the material UI,
331-
// in the shader only the _EmissiveColor should be used
332-
[HideInInspector] _EmissiveColorLDR("EmissiveColor LDR", Color) = (0, 0, 0)
333316
_EmissiveColorMap("EmissiveColorMap", 2D) = "white" {}
334317
[ToggleUI] _AlbedoAffectEmissive("Albedo Affect Emissive", Float) = 0.0
335-
[HideInInspector] _EmissiveIntensityUnit("Emissive Mode", Int) = 0
336-
[ToggleUI] _UseEmissiveIntensity("Use Emissive Intensity", Int) = 0
337-
_EmissiveIntensity("Emissive Intensity", Float) = 1
338318
_EmissiveExposureWeight("Emissive Pre Exposure", Range(0.0, 1.0)) = 1.0
339319

340320
_DistortionVectorMap("DistortionVectorMap", 2D) = "black" {}
341-
[ToggleUI] _DistortionEnable("Enable Distortion", Float) = 0.0
342-
[ToggleUI] _DistortionDepthTest("Distortion Depth Test Enable", Float) = 1.0
343-
[Enum(Add, 0, Multiply, 1, Replace, 2)] _DistortionBlendMode("Distortion Blend Mode", Int) = 0
344321
[HideInInspector] _DistortionSrcBlend("Distortion Blend Src", Int) = 0
345322
[HideInInspector] _DistortionDstBlend("Distortion Blend Dst", Int) = 0
346323
[HideInInspector] _DistortionBlurSrcBlend("Distortion Blur Blend Src", Int) = 0
347324
[HideInInspector] _DistortionBlurDstBlend("Distortion Blur Blend Dst", Int) = 0
348-
[HideInInspector] _DistortionBlurBlendMode("Distortion Blur Blend Mode", Int) = 0
349325
_DistortionScale("Distortion Scale", Float) = 1
350326
_DistortionVectorScale("Distortion Vector Scale", Float) = 2
351327
_DistortionVectorBias("Distortion Vector Bias", Float) = -1
@@ -354,25 +330,15 @@ Shader "Toon" {
354330
_DistortionBlurRemapMax("DistortionBlurRemapMax", Float) = 1.0
355331

356332
[ToggleUI] _UseShadowThreshold("_UseShadowThreshold", Float) = 0.0
357-
[ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
358333
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
359334
_AlphaCutoffShadow("_AlphaCutoffShadow", Range(0.0, 1.0)) = 0.5
360335
_AlphaCutoffPrepass("_AlphaCutoffPrepass", Range(0.0, 1.0)) = 0.5
361336
_AlphaCutoffPostpass("_AlphaCutoffPostpass", Range(0.0, 1.0)) = 0.5
362-
[ToggleUI] _TransparentDepthPrepassEnable("_TransparentDepthPrepassEnable", Float) = 0.0
363-
[ToggleUI] _TransparentBackfaceEnable("_TransparentBackfaceEnable", Float) = 0.0
364-
[ToggleUI] _TransparentDepthPostpassEnable("_TransparentDepthPostpassEnable", Float) = 0.0
365-
_TransparentSortPriority("_TransparentSortPriority", Float) = 0
366-
367337
// Transparency
368-
[Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Refraction Model", Int) = 0
369-
[Enum(Proxy, 1, HiZ, 2)]_SSRefractionProjectionModel("Refraction Projection Model", Int) = 0
370338
_Ior("Index Of Refraction", Range(1.0, 2.5)) = 1.0
371-
_ThicknessMultiplier("Thickness Multiplier", Float) = 1.0
372339
_TransmittanceColor("Transmittance Color", Color) = (1.0, 1.0, 1.0)
373340
_TransmittanceColorMap("TransmittanceColorMap", 2D) = "white" {}
374341
_ATDistance("Transmittance Absorption Distance", Float) = 1.0
375-
[ToggleUI] _TransparentWritingMotionVec("_TransparentWritingMotionVec", Float) = 0.0
376342

377343
// Stencil state
378344

@@ -390,49 +356,25 @@ Shader "Toon" {
390356
[HideInInspector] _StencilWriteMaskMV("_StencilWriteMaskMV", Int) = 128 // StencilBitMask.ObjectMotionVectors
391357
// Distortion vector pass
392358
[HideInInspector] _StencilRefDistortionVec("_StencilRefDistortionVec", Int) = 64 // StencilBitMask.DistortionVectors
393-
[HideInInspector] _StencilWriteMaskDistortionVec("_StencilWriteMaskDistortionVec", Int) = 64 // StencilBitMask.DistortionVectors
394359

395360
// Blending state
396-
[HideInInspector] _SurfaceType("__surfacetype", Float) = 0.0
397-
[HideInInspector] _BlendMode("__blendmode", Float) = 0.0
398361
[HideInInspector] _SrcBlend("__src", Float) = 1.0
399362
[HideInInspector] _DstBlend("__dst", Float) = 0.0
400363
[HideInInspector] _AlphaSrcBlend("__alphaSrc", Float) = 1.0
401364
[HideInInspector] _AlphaDstBlend("__alphaDst", Float) = 0.0
402365
[HideInInspector][ToggleUI] _ZWrite("__zw", Float) = 1.0
403-
[HideInInspector][ToggleUI] _TransparentZWrite("_TransparentZWrite", Float) = 0.0
404366
[HideInInspector] _CullMode("__cullmode", Float) = 2.0
405-
[HideInInspector] _CullModeForward("__cullmodeForward", Float) = 2.0 // This mode is dedicated to Forward to correctly handle backface then front face rendering thin transparent
406-
[HideInInspector] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default
407-
[HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
408367
[HideInInspector] _ZTestModeDistortion("_ZTestModeDistortion", Int) = 8
409368
[HideInInspector] _ZTestGBuffer("_ZTestGBuffer", Int) = 4
410369
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("Transparent ZTest", Int) = 4 // Less equal
411370

412-
[ToggleUI] _EnableFogOnTransparent("Enable Fog", Float) = 1.0
413-
[ToggleUI] _EnableBlendModePreserveSpecularLighting("Enable Blend Mode Preserve Specular Lighting", Float) = 1.0
414-
415371
[ToggleUI] _DoubleSidedEnable("Double sided enable", Float) = 0.0
416-
[Enum(Flip, 0, Mirror, 1, None, 2)] _DoubleSidedNormalMode("Double sided normal mode", Float) = 1
417372
[HideInInspector] _DoubleSidedConstants("_DoubleSidedConstants", Vector) = (1, 1, -1, 0)
418373

419-
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5)] _UVBase("UV Set for base", Float) = 0
420374
[Enum(WorldSpace, 0, ObjectSpace, 1)] _ObjectSpaceUVMapping("Mapping space", Float) = 0.0
421375
_TexWorldScale("Scale to apply on world coordinate", Float) = 1.0
422376
[HideInInspector] _InvTilingScale("Inverse tiling scale = 2 / (abs(_BaseColorMap_ST.x) + abs(_BaseColorMap_ST.y))", Float) = 1
423377
[HideInInspector] _UVMappingMask("_UVMappingMask", Color) = (1, 0, 0, 0)
424-
[Enum(TangentSpace, 0, ObjectSpace, 1)] _NormalMapSpace("NormalMap space", Float) = 0
425-
426-
// Following enum should be material feature flags (i.e bitfield), however due to Gbuffer encoding constrain many combination exclude each other
427-
// so we use this enum as "material ID" which can be interpreted as preset of bitfield of material feature
428-
// The only material feature flag that can be added in all cases is clear coat
429-
[Enum(Subsurface Scattering, 0, Standard, 1, Anisotropy, 2, Iridescence, 3, Specular Color, 4, Translucent, 5)] _MaterialID("MaterialId", Int) = 1 // MaterialId.Standard
430-
[ToggleUI] _TransmissionEnable("_TransmissionEnable", Float) = 1.0
431-
432-
[Enum(None, 0, Vertex displacement, 1, Pixel displacement, 2)] _DisplacementMode("DisplacementMode", Int) = 0
433-
[ToggleUI] _DisplacementLockObjectScale("displacement lock object scale", Float) = 1.0
434-
[ToggleUI] _DisplacementLockTilingScale("displacement lock tiling scale", Float) = 1.0
435-
[ToggleUI] _DepthOffsetEnable("Depth Offset View space", Float) = 0.0
436378

437379
[ToggleUI] _EnableGeometricSpecularAA("EnableGeometricSpecularAA", Float) = 0.0
438380
_SpecularAAScreenSpaceVariance("SpecularAAScreenSpaceVariance", Range(0.0, 1.0)) = 0.1
@@ -441,16 +383,12 @@ Shader "Toon" {
441383
_PPDMinSamples("Min sample for POM", Range(1.0, 64.0)) = 5
442384
_PPDMaxSamples("Max sample for POM", Range(1.0, 64.0)) = 15
443385
_PPDLodThreshold("Start lod to fade out the POM effect", Range(0.0, 16.0)) = 5
444-
_PPDPrimitiveLength("Primitive length for POM", Float) = 1
445-
_PPDPrimitiveWidth("Primitive width for POM", Float) = 1
446386
[HideInInspector] _InvPrimScale("Inverse primitive scale for non-planar POM", Vector) = (1, 1, 0, 0)
447387

448388
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail("UV Set for detail", Float) = 0
449389
[HideInInspector] _UVDetailsMappingMask("_UVDetailsMappingMask", Color) = (1, 0, 0, 0)
450390
[ToggleUI] _LinkDetailsWithBase("LinkDetailsWithBase", Float) = 1.0
451391

452-
[Enum(Use Emissive Color, 0, Use Emissive Mask, 1)] _EmissiveColorMode("Emissive color mode", Float) = 1
453-
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5)] _UVEmissive("UV Set for emissive", Float) = 0
454392
_TexWorldScaleEmissive("Scale to apply on world coordinate", Float) = 1.0
455393
[HideInInspector] _UVMappingMaskEmissive("_UVMappingMaskEmissive", Color) = (1, 0, 0, 0)
456394

@@ -464,10 +402,6 @@ Shader "Toon" {
464402
//////////// _MainTex("BaseMap", 2D) = "white" {}
465403
_Color("Color", Color) = (1,1,1,1)
466404
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
467-
468-
[ToggleUI] _SupportDecals("Support Decals", Float) = 1.0
469-
[ToggleUI] _ReceivesSSR("Receives SSR", Float) = 1.0
470-
[ToggleUI] _AddPrecomputedVelocity("AddPrecomputedVelocity", Float) = 0.0
471405
//////////////////////////////////////////////////////////////////////////////
472406
//////////////////// End of HDRP material default values. ////////////////////
473407
//////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)