pplans / ld41

Ludum Dare 41
1 stars 0 forks source link

fix outline shader #6

Open smatcher opened 6 years ago

smatcher commented 6 years ago

https://willweissman.wordpress.com/tutorials/shaders/unity-shaderlab-object-outlines/

smatcher commented 6 years ago

@pplans This diff fixes the issue, mix and match and only flip coords in gles

diff --git a/Assets/Shaders/ClippedPostOutline.shader b/Assets/Shaders/ClippedPostOutline.shader
index 424da5d..53a5ca6 100644
--- a/Assets/Shaders/ClippedPostOutline.shader
+++ b/Assets/Shaders/ClippedPostOutline.shader
@@ -83,7 +83,7 @@ Shader "Custom/Post Outline"

                        struct v2f
                        {
-                               float4 pos : SV_POSITION;
+                               float4 pos : POSITION;
                                float2 uvs : TEXCOORD0;
                        };

@@ -114,7 +114,7 @@ Shader "Custom/Post Outline"
                                for (int j = 0; j<NumberOfIterations; j += 1)
                                {
                                        //increase our output color by the pixels in the area
-                                       ColorIntensityInRadius += tex2D(_GrabTexture, float2(i.uvs.x,1 - i.uvs.y) + f
loat2(0, (j - NumberOfIterations / 2)*TX_y)).r / NumberOfIterations;
+                                       ColorIntensityInRadius += tex2D(_GrabTexture, float2(i.uvs.x,i.uvs.y) + float
2(0, (j - NumberOfIterations / 2)*TX_y)).r / NumberOfIterations;
                                }
                                //this is alpha blending, but we can't use HW blending unless we make a third pass, s
o this is probably cheaper.
                                half4 outcolor = ColorIntensityInRadius * half4(0,0,1,1) * 2 + (1 - ColorIntensityInR
adius)*tex2D(_SceneTex,float2(i.uvs.x,i.uvs.y));
diff --git a/Assets/Shaders/ClippedSimple.shader b/Assets/Shaders/ClippedSimple.shader
index 238e5a7..f17bfa5 100644
--- a/Assets/Shaders/ClippedSimple.shader
+++ b/Assets/Shaders/ClippedSimple.shader
@@ -20,7 +20,7 @@ Shader "Custom/ClippedSimple"

                struct VertexToFragment
        {
-               float4 pos:SV_POSITION;
+               float4 pos:POSITION;
                float4 worldPos:TEXCOORD0;
        };

diff --git a/Assets/Shaders/ClippedStandard.shader b/Assets/Shaders/ClippedStandard.shader
index 1996630..51d4ad7 100644
--- a/Assets/Shaders/ClippedStandard.shader
+++ b/Assets/Shaders/ClippedStandard.shader
@@ -73,7 +73,7 @@ Shader "Custom/ClippedStandard" {

         struct v2f {
             V2F_SHADOW_CASTER;
-            float4 worldPos : TEXCOORD0;
+            float4 worldPos : TEXCOORD2;
         };

         half _SeaWidth;