Skip to content

Commit

Permalink
Task/plane selection (#371)
Browse files Browse the repository at this point in the history
* fix #238

Toon-shaded plane cannot be selected

* [BRP] fix #238

---------

Co-authored-by: Hum9183 <[email protected]>
  • Loading branch information
H3idi-X and Hum9183 authored Aug 9, 2024
1 parent fb9929e commit 998f6ad
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 140 deletions.
163 changes: 82 additions & 81 deletions com.unity.toonshader/Runtime/Integrated/Shaders/UnityToon.shader
Original file line number Diff line number Diff line change
Expand Up @@ -1139,52 +1139,6 @@ Shader "Toon" {
"RenderType"="Opaque"
"RenderPipeline" = "UniversalPipeline"
}
Pass {
Name "Outline"
Tags {
"LightMode" = "SRPDefaultUnlit"
}
Cull [_SRPDefaultUnlitColMode]
ColorMask [_SPRDefaultUnlitColorMask]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref[_StencilNo]
Comp[_StencilComp]
Pass[_StencilOpPass]
Fail[_StencilOpFail]

}

HLSLPROGRAM
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag


//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO _IS_OUTLINE_CLIPPING_YES
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Outline is implemented in UniversalToonOutline.hlsl.
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"

//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#if UNITY_VERSION >= 202230 // Requires Universal RP 14.0.7
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#else
#pragma multi_compile _ DOTS_INSTANCING_ON
#endif

#ifdef UNIVERSAL_PIPELINE_CORE_INCLUDED
#include "../../UniversalRP/Shaders/UniversalToonInput.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonHead.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonOutline.hlsl"
#endif
ENDHLSL
}

//ToonCoreStart
Pass {
Expand Down Expand Up @@ -1300,6 +1254,53 @@ Shader "Toon" {

}

Pass {
Name "Outline"
Tags {
"LightMode" = "SRPDefaultUnlit"
}
Cull [_SRPDefaultUnlitColMode]
ColorMask [_SPRDefaultUnlitColorMask]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref[_StencilNo]
Comp[_StencilComp]
Pass[_StencilOpPass]
Fail[_StencilOpFail]

}

HLSLPROGRAM
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag


//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO _IS_OUTLINE_CLIPPING_YES
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Outline is implemented in UniversalToonOutline.hlsl.
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"

//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#if UNITY_VERSION >= 202230 // Requires Universal RP 14.0.7
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#else
#pragma multi_compile _ DOTS_INSTANCING_ON
#endif

#ifdef UNIVERSAL_PIPELINE_CORE_INCLUDED
#include "../../UniversalRP/Shaders/UniversalToonInput.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonHead.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonOutline.hlsl"
#endif
ENDHLSL
}

Pass
{
Name "ShadowCaster"
Expand Down Expand Up @@ -1425,41 +1426,6 @@ Shader "Toon" {
Tags {
"RenderType"="Opaque"
}
Pass {
Name "Outline"
Tags {
"LightMode"="ForwardBase"
}
Cull[_SRPDefaultUnlitColMode]
ColorMask[_SPRDefaultUnlitColorMask]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref[_StencilNo]
Comp[_StencilComp]
Pass[_StencilOpPass]
Fail[_StencilOpFail]

}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
//#pragma fragmentoption ARB_precision_hint_fastest
//#pragma multi_compile_shadowcaster
//#pragma multi_compile_fog
#pragma only_renderers d3d9 d3d11 glcore gles gles3 playstation xboxone xboxseries vulkan metal switch

#pragma target 3.0
//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Unity Toon Shader 0.5.0
#pragma multi_compile _ _DISABLE_OUTLINE
//The outline process goes to UTS_Outline.cginc.
#include "../../Legacy/Shaders/UCTS_Outline.cginc"
ENDCG
}
//ToonCoreStart
Pass {
Name "FORWARD"
Expand Down Expand Up @@ -1516,6 +1482,41 @@ Shader "Toon" {

ENDCG
}
Pass {
Name "Outline"
Tags {
"LightMode"="ForwardBase"
}
Cull[_SRPDefaultUnlitColMode]
ColorMask[_SPRDefaultUnlitColorMask]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref[_StencilNo]
Comp[_StencilComp]
Pass[_StencilOpPass]
Fail[_StencilOpFail]

}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
//#pragma fragmentoption ARB_precision_hint_fastest
//#pragma multi_compile_shadowcaster
//#pragma multi_compile_fog
#pragma only_renderers d3d9 d3d11 glcore gles gles3 playstation xboxone xboxseries vulkan metal switch

#pragma target 3.0
//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Unity Toon Shader 0.5.0
#pragma multi_compile _ _DISABLE_OUTLINE
//The outline process goes to UTS_Outline.cginc.
#include "../../Legacy/Shaders/UCTS_Outline.cginc"
ENDCG
}
Pass {
Name "FORWARD_DELTA"
Tags {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1193,53 +1193,6 @@ Shader "Toon(Tessellation)" {
"RenderType"="Opaque"
"RenderPipeline" = "UniversalPipeline"
}
Pass {
Name "Outline"
Tags {
"LightMode" = "SRPDefaultUnlit"
}
Cull [_SRPDefaultUnlitColMode]
ColorMask [_SPRDefaultUnlitColorMask]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref[_StencilNo]
Comp[_StencilComp]
Pass[_StencilOpPass]
Fail[_StencilOpFail]

}

HLSLPROGRAM
#pragma target 2.0

#pragma vertex vert
#pragma fragment frag


//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO _IS_OUTLINE_CLIPPING_YES
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Outline is implemented in UniversalToonOutline.hlsl.
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"

//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#if UNITY_VERSION >= 202230 // Requires Universal RP 14.0.7
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#else
#pragma multi_compile _ DOTS_INSTANCING_ON
#endif

#ifdef UNIVERSAL_PIPELINE_CORE_INCLUDED
#include "../../UniversalRP/Shaders/UniversalToonInput.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonHead.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonOutline.hlsl"
#endif
ENDHLSL
}

//ToonCoreStart
Pass {
Expand Down Expand Up @@ -1355,6 +1308,53 @@ Shader "Toon(Tessellation)" {

}

Pass {
Name "Outline"
Tags {
"LightMode" = "SRPDefaultUnlit"
}
Cull [_SRPDefaultUnlitColMode]
ColorMask [_SPRDefaultUnlitColorMask]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref[_StencilNo]
Comp[_StencilComp]
Pass[_StencilOpPass]
Fail[_StencilOpFail]

}

HLSLPROGRAM
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag


//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO _IS_OUTLINE_CLIPPING_YES
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Outline is implemented in UniversalToonOutline.hlsl.
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"

//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#if UNITY_VERSION >= 202230 // Requires Universal RP 14.0.7
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#else
#pragma multi_compile _ DOTS_INSTANCING_ON
#endif

#ifdef UNIVERSAL_PIPELINE_CORE_INCLUDED
#include "../../UniversalRP/Shaders/UniversalToonInput.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonHead.hlsl"
#include "../../UniversalRP/Shaders/UniversalToonOutline.hlsl"
#endif
ENDHLSL
}

Pass
{
Name "ShadowCaster"
Expand Down Expand Up @@ -1497,29 +1497,22 @@ Shader "Toon(Tessellation)" {

}
CGPROGRAM
#define TESSELLATION_ON
#pragma target 5.0
#pragma vertex tess_VertexInput
#pragma hull hs_VertexInput
#pragma domain ds_surf
#pragma vertex vert
#pragma fragment frag
#ifdef TESSELLATION_ON
#include "../../Legacy/Shaders/UCTS_Tess.cginc"
#endif
#include "UnityCG.cginc"
//#pragma fragmentoption ARB_precision_hint_fastest
//#pragma multi_compile_shadowcaster
//#pragma multi_compile_fog
#pragma only_renderers d3d9 d3d11 glcore gles gles3 playstation xboxone xboxseries vulkan metal switch

//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO
#pragma target 3.0
//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Unity Toon Shader 0.5.0
#pragma multi_compile _ _DISABLE_OUTLINE
//The outline process goes to UTS_Outline.cginc.
#include "../../Legacy/Shaders/UCTS_Outline_Tess.cginc"

#include "../../Legacy/Shaders/UCTS_Outline.cginc"
ENDCG
}
//ToonCoreStart
Expand Down Expand Up @@ -1585,6 +1578,47 @@ Shader "Toon(Tessellation)" {

ENDCG
}
Pass {
Name "Outline"
Tags {
"LightMode"="ForwardBase"
}
Cull[_SRPDefaultUnlitColMode]
ColorMask[_SPRDefaultUnlitColorMask]
Blend SrcAlpha OneMinusSrcAlpha
Stencil
{
Ref[_StencilNo]
Comp[_StencilComp]
Pass[_StencilOpPass]
Fail[_StencilOpFail]

}
CGPROGRAM
#define TESSELLATION_ON
#pragma target 5.0
#pragma vertex tess_VertexInput
#pragma hull hs_VertexInput
#pragma domain ds_surf
#pragma fragment frag
#ifdef TESSELLATION_ON
#include "../../Legacy/Shaders/UCTS_Tess.cginc"
#endif
#include "UnityCG.cginc"
//#pragma fragmentoption ARB_precision_hint_fastest
//#pragma multi_compile_shadowcaster
//#pragma multi_compile_fog
#pragma only_renderers d3d9 d3d11 glcore gles gles3 playstation xboxone xboxseries vulkan metal switch

//V.2.0.4
#pragma multi_compile _IS_OUTLINE_CLIPPING_NO
#pragma multi_compile _OUTLINE_NML _OUTLINE_POS
// Unity Toon Shader 0.5.0
#pragma multi_compile _ _DISABLE_OUTLINE
//The outline process goes to UTS_Outline.cginc.
#include "../../Legacy/Shaders/UCTS_Outline_Tess.cginc"
ENDCG
}
Pass {
Name "FORWARD_DELTA"
Tags {
Expand Down

0 comments on commit 998f6ad

Please sign in to comment.