1- //Unity Toon Shader
1+ //Unity Toon Shader
22
33Shader "Toon(Tessellation)" {
44 Properties {
@@ -259,26 +259,13 @@ Shader "Toon(Tessellation)" {
259259 _NormalScale( "_NormalScale" , Range (0.0 , 8.0 )) = 1
260260
261261 _BentNormalMap( "_BentNormalMap" , 2D ) = "bump" {}
262- _BentNormalMapOS( "_BentNormalMapOS" , 2D ) = "white" {}
263262
264263 _HeightMap( "HeightMap" , 2D ) = "black" {}
265- // Caution: Default value of _HeightAmplitude must be (_HeightMax - _HeightMin) * 0.01
266- // 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.
264+ // Caution: Default value of _HeightAmplitude must stay in sync with authored displacement data.
267265 [HideInInspector ] _HeightAmplitude( "Height Amplitude" , Float ) = 0.02 // In world units. This will be computed in the UI.
268266 [HideInInspector ] _HeightCenter( "Height Center" , Range (0.0 , 1.0 )) = 0.5 // In texture space
269267
270- [Enum (MinMax, 0 , Amplitude, 1 )] _HeightMapParametrization( "Heightmap Parametrization" , Int ) = 0
271- // These parameters are for vertex displacement/Tessellation
272268 _HeightOffset( "Height Offset" , Float ) = 0
273- // MinMax mode
274- _HeightMin( "Heightmap Min" , Float ) = -1
275- _HeightMax( "Heightmap Max" , Float ) = 1
276- // Amplitude mode
277- _HeightTessAmplitude( "Amplitude" , Float ) = 2.0 // in Centimeters
278- _HeightTessCenter( "Height Center" , Range (0.0 , 1.0 )) = 0.5 // In texture space
279-
280- // These parameters are for pixel displacement
281- _HeightPoMAmplitude( "Height Amplitude" , Float ) = 2.0 // In centimeters
282269
283270 _DetailMap( "DetailMap" , 2D ) = "linearGrey" {}
284271 _DetailAlbedoScale( "_DetailAlbedoScale" , Range (0.0 , 2.0 )) = 1
@@ -291,7 +278,6 @@ Shader "Toon(Tessellation)" {
291278 _AnisotropyMap( "AnisotropyMap" , 2D ) = "white" {}
292279
293280 [HideInInspector ] _DiffusionProfile( "Obsolete, kept for migration purpose" , Int ) = 0
294- [HideInInspector ] _DiffusionProfileAsset( "Diffusion Profile Asset" , Vector ) = (0 , 0 , 0 , 0 )
295281 [HideInInspector ] _DiffusionProfileHash( "Diffusion Profile Hash" , Float ) = 0
296282 _SubsurfaceMask( "Subsurface Radius" , Range (0.0 , 1.0 )) = 1.0
297283 _SubsurfaceMaskMap( "Subsurface Radius Map" , 2D ) = "white" {}
@@ -318,25 +304,15 @@ Shader "Toon(Tessellation)" {
318304 [Enum (Off, 0 , From Ambient Occlusion, 1 , From Bent Normals, 2 )] _SpecularOcclusionMode( "Specular Occlusion Mode" , Int ) = 1
319305
320306 [HDR ] _EmissiveColor( "EmissiveColor" , Color ) = (0 , 0 , 0 )
321- // Used only to serialize the LDR and HDR emissive color in the material UI,
322- // in the shader only the _EmissiveColor should be used
323- [HideInInspector ] _EmissiveColorLDR( "EmissiveColor LDR" , Color ) = (0 , 0 , 0 )
324307 _EmissiveColorMap( "EmissiveColorMap" , 2D ) = "white" {}
325308 [ToggleUI ] _AlbedoAffectEmissive( "Albedo Affect Emissive" , Float ) = 0.0
326- [HideInInspector ] _EmissiveIntensityUnit( "Emissive Mode" , Int ) = 0
327- [ToggleUI ] _UseEmissiveIntensity( "Use Emissive Intensity" , Int ) = 0
328- _EmissiveIntensity( "Emissive Intensity" , Float ) = 1
329309 _EmissiveExposureWeight( "Emissive Pre Exposure" , Range (0.0 , 1.0 )) = 1.0
330310
331311 _DistortionVectorMap( "DistortionVectorMap" , 2D ) = "black" {}
332- [ToggleUI ] _DistortionEnable( "Enable Distortion" , Float ) = 0.0
333- [ToggleUI ] _DistortionDepthTest( "Distortion Depth Test Enable" , Float ) = 1.0
334- [Enum (Add, 0 , Multiply, 1 , Replace, 2 )] _DistortionBlendMode( "Distortion Blend Mode" , Int ) = 0
335312 [HideInInspector ] _DistortionSrcBlend( "Distortion Blend Src" , Int ) = 0
336313 [HideInInspector ] _DistortionDstBlend( "Distortion Blend Dst" , Int ) = 0
337314 [HideInInspector ] _DistortionBlurSrcBlend( "Distortion Blur Blend Src" , Int ) = 0
338315 [HideInInspector ] _DistortionBlurDstBlend( "Distortion Blur Blend Dst" , Int ) = 0
339- [HideInInspector ] _DistortionBlurBlendMode( "Distortion Blur Blend Mode" , Int ) = 0
340316 _DistortionScale( "Distortion Scale" , Float ) = 1
341317 _DistortionVectorScale( "Distortion Vector Scale" , Float ) = 2
342318 _DistortionVectorBias( "Distortion Vector Bias" , Float ) = -1
@@ -345,25 +321,15 @@ Shader "Toon(Tessellation)" {
345321 _DistortionBlurRemapMax( "DistortionBlurRemapMax" , Float ) = 1.0
346322
347323 [ToggleUI ] _UseShadowThreshold( "_UseShadowThreshold" , Float ) = 0.0
348- [ToggleUI ] _AlphaCutoffEnable( "Alpha Cutoff Enable" , Float ) = 0.0
349324 _AlphaCutoff( "Alpha Cutoff" , Range (0.0 , 1.0 )) = 0.5
350325 _AlphaCutoffShadow( "_AlphaCutoffShadow" , Range (0.0 , 1.0 )) = 0.5
351326 _AlphaCutoffPrepass( "_AlphaCutoffPrepass" , Range (0.0 , 1.0 )) = 0.5
352327 _AlphaCutoffPostpass( "_AlphaCutoffPostpass" , Range (0.0 , 1.0 )) = 0.5
353- [ToggleUI ] _TransparentDepthPrepassEnable( "_TransparentDepthPrepassEnable" , Float ) = 0.0
354- [ToggleUI ] _TransparentBackfaceEnable( "_TransparentBackfaceEnable" , Float ) = 0.0
355- [ToggleUI ] _TransparentDepthPostpassEnable( "_TransparentDepthPostpassEnable" , Float ) = 0.0
356- _TransparentSortPriority( "_TransparentSortPriority" , Float ) = 0
357-
358328 // Transparency
359- [Enum (None, 0 , Box, 1 , Sphere, 2 , Thin, 3 )]_RefractionModel( "Refraction Model" , Int ) = 0
360- [Enum (Proxy, 1 , HiZ, 2 )]_SSRefractionProjectionModel( "Refraction Projection Model" , Int ) = 0
361329 _Ior( "Index Of Refraction" , Range (1.0 , 2.5 )) = 1.0
362- _ThicknessMultiplier( "Thickness Multiplier" , Float ) = 1.0
363330 _TransmittanceColor( "Transmittance Color" , Color ) = (1.0 , 1.0 , 1.0 )
364331 _TransmittanceColorMap( "TransmittanceColorMap" , 2D ) = "white" {}
365332 _ATDistance( "Transmittance Absorption Distance" , Float ) = 1.0
366- [ToggleUI ] _TransparentWritingMotionVec( "_TransparentWritingMotionVec" , Float ) = 0.0
367333
368334 // Stencil state
369335
@@ -381,11 +347,8 @@ Shader "Toon(Tessellation)" {
381347 [HideInInspector ] _StencilWriteMaskMV( "_StencilWriteMaskMV" , Int ) = 128 // StencilBitMask.ObjectMotionVectors
382348 // Distortion vector pass
383349 [HideInInspector ] _StencilRefDistortionVec( "_StencilRefDistortionVec" , Int ) = 64 // StencilBitMask.DistortionVectors
384- [HideInInspector ] _StencilWriteMaskDistortionVec( "_StencilWriteMaskDistortionVec" , Int ) = 64 // StencilBitMask.DistortionVectors
385350
386351 // Blending state
387- [HideInInspector ] _SurfaceType( "__surfacetype" , Float ) = 0.0
388- [HideInInspector ] _BlendMode( "__blendmode" , Float ) = 0.0
389352 [HideInInspector ] _SrcBlend( "__src" , Float ) = 1.0
390353 [HideInInspector ] _DstBlend( "__dst" , Float ) = 0.0
391354 [HideInInspector ] _AlphaSrcBlend( "__alphaSrc" , Float ) = 1.0
@@ -399,14 +362,9 @@ Shader "Toon(Tessellation)" {
399362 [HideInInspector ] _ZTestGBuffer( "_ZTestGBuffer" , Int ) = 4
400363 [Enum (UnityEngine.Rendering.CompareFunction)] _ZTestTransparent( "Transparent ZTest" , Int ) = 4 // Less equal
401364
402- [ToggleUI ] _EnableFogOnTransparent( "Enable Fog" , Float ) = 1.0
403- [ToggleUI ] _EnableBlendModePreserveSpecularLighting( "Enable Blend Mode Preserve Specular Lighting" , Float ) = 1.0
404-
405365 [ToggleUI ] _DoubleSidedEnable( "Double sided enable" , Float ) = 0.0
406- [Enum (Flip, 0 , Mirror, 1 , None, 2 )] _DoubleSidedNormalMode( "Double sided normal mode" , Float ) = 1
407366 [HideInInspector ] _DoubleSidedConstants( "_DoubleSidedConstants" , Vector ) = (1 , 1 , -1 , 0 )
408367
409- [Enum (UV0, 0 , UV1, 1 , UV2, 2 , UV3, 3 , Planar, 4 , Triplanar, 5 )] _UVBase( "UV Set for base" , Float ) = 0
410368 [Enum (WorldSpace, 0 , ObjectSpace, 1 )] _ObjectSpaceUVMapping( "Mapping space" , Float ) = 0.0
411369 _TexWorldScale( "Scale to apply on world coordinate" , Float ) = 1.0
412370 [HideInInspector ] _InvTilingScale( "Inverse tiling scale = 2 / (abs(_BaseColorMap_ST.x) + abs(_BaseColorMap_ST.y))" , Float ) = 1
@@ -425,16 +383,12 @@ Shader "Toon(Tessellation)" {
425383 _PPDMinSamples( "Min sample for POM" , Range (1.0 , 64.0 )) = 5
426384 _PPDMaxSamples( "Max sample for POM" , Range (1.0 , 64.0 )) = 15
427385 _PPDLodThreshold( "Start lod to fade out the POM effect" , Range (0.0 , 16.0 )) = 5
428- _PPDPrimitiveLength( "Primitive length for POM" , Float ) = 1
429- _PPDPrimitiveWidth( "Primitive width for POM" , Float ) = 1
430386 [HideInInspector ] _InvPrimScale( "Inverse primitive scale for non-planar POM" , Vector ) = (1 , 1 , 0 , 0 )
431387
432388 [Enum (UV0, 0 , UV1, 1 , UV2, 2 , UV3, 3 )] _UVDetail( "UV Set for detail" , Float ) = 0
433389 [HideInInspector ] _UVDetailsMappingMask( "_UVDetailsMappingMask" , Color ) = (1 , 0 , 0 , 0 )
434390 [ToggleUI ] _LinkDetailsWithBase( "LinkDetailsWithBase" , Float ) = 1.0
435391
436- [Enum (Use Emissive Color, 0 , Use Emissive Mask, 1 )] _EmissiveColorMode( "Emissive color mode" , Float ) = 1
437- [Enum (UV0, 0 , UV1, 1 , UV2, 2 , UV3, 3 , Planar, 4 , Triplanar, 5 )] _UVEmissive( "UV Set for emissive" , Float ) = 0
438392 _TexWorldScaleEmissive( "Scale to apply on world coordinate" , Float ) = 1.0
439393 [HideInInspector ] _UVMappingMaskEmissive( "_UVMappingMaskEmissive" , Color ) = (1 , 0 , 0 , 0 )
440394
@@ -456,10 +410,6 @@ Shader "Toon(Tessellation)" {
456410 // HACK: GI Baking system relies on some properties existing in the shader ("_MainTex", "_Cutoff" and "_Color") for opacity handling, so we need to store our version of those parameters in the hard-coded name the GI baking system recognizes.
457411 //////////// _MainTex("BaseMap", 2D) = "white" {}
458412 _Cutoff( "Alpha Cutoff" , Range (0.0 , 1.0 )) = 0.5
459-
460- [ToggleUI ] _SupportDecals( "Support Decals" , Float ) = 1.0
461- [ToggleUI ] _ReceivesSSR( "Receives SSR" , Float ) = 1.0
462- [ToggleUI ] _AddPrecomputedVelocity( "AddPrecomputedVelocity" , Float ) = 0.0
463413 //////////////////////////////////////////////////////////////////////////////
464414 //////////////////// End of HDRP material default values. ////////////////////
465415 //////////////////////////////////////////////////////////////////////////////
0 commit comments