Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal/runtime render pass #2719

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Forgot to save here is the correct version of the shader
  • Loading branch information
Nzollner committed Dec 4, 2020
commit 9ef4ea0c911e18a94d17084a897ec97dc329f4f3
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,52 @@ Shader "Custom/RenderFeature/KawaseBlur"
Properties
{
_MainTex("Texture", 2D) = "white" {}
// _offset ("Offset", float) = 0.5
}

SubShader
{
Tags { "RenderType" = "Opaque" }
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalRenderPipeline" }

Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag

#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"

struct appdata
struct Attributes
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};

struct v2f
struct Varyings
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};

sampler2D _MainTex;
// sampler2D _CameraOpaqueTexture;
float4 _MainTex_TexelSize;
float4 _MainTex_ST;

float _offset;

v2f vert(appdata v)
Varyings vert(Attributes v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
Varyings o;
o.vertex = TransformObjectToHClip(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}

fixed4 frag(v2f input) : SV_Target
half4 frag(Varyings input) : SV_Target
{
float2 res = _MainTex_TexelSize.xy;
float i = _offset;

fixed4 col;
half4 col;
col.rgb = tex2D(_MainTex, input.uv).rgb;
col.rgb += tex2D(_MainTex, input.uv + float2(i, i) * res).rgb;
col.rgb += tex2D(_MainTex, input.uv + float2(i, -i) * res).rgb;
Expand All @@ -59,7 +58,7 @@ Shader "Custom/RenderFeature/KawaseBlur"

return col;
}
ENDCG
ENDHLSL
}
}
}