-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
1038a67
commit d83576e
Showing
10 changed files
with
154 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
Assets/ShadowVolume/Example/ImageEffect/Resources/TestImageEffect.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Shader "Hidden/ShadowVolume/TestImageEffect" | ||
{ | ||
Properties | ||
{ | ||
_MainTex ("Texture", 2D) = "white" {} | ||
} | ||
SubShader | ||
{ | ||
Tags { "RenderType"="Opaque" } | ||
LOD 100 | ||
|
||
Pass | ||
{ | ||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag | ||
|
||
#include "UnityCG.cginc" | ||
|
||
struct appdata | ||
{ | ||
float4 vertex : POSITION; | ||
float2 uv : TEXCOORD0; | ||
}; | ||
|
||
struct v2f | ||
{ | ||
float2 uv : TEXCOORD0; | ||
float4 vertex : SV_POSITION; | ||
}; | ||
|
||
sampler2D _MainTex; | ||
float4 _MainTex_ST; | ||
|
||
v2f vert (appdata v) | ||
{ | ||
v2f o; | ||
o.vertex = UnityObjectToClipPos(v.vertex); | ||
o.uv = TRANSFORM_TEX(v.uv, _MainTex); | ||
return o; | ||
} | ||
|
||
fixed4 frag (v2f i) : SV_Target | ||
{ | ||
fixed4 col = tex2D(_MainTex, i.uv); | ||
col.rgb = saturate((col.rgb - 0.5) * 1.35 + 0.5); | ||
return col; | ||
} | ||
ENDCG | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Assets/ShadowVolume/Example/ImageEffect/Resources/TestImageEffect.shader.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
Assets/ShadowVolume/Example/ImageEffect/TestImageEffect.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
[ExecuteInEditMode] | ||
[ImageEffectAllowedInSceneView] | ||
public class TestImageEffect : ShadowVolumeImageEffect | ||
{ | ||
private Material _mtrl = null; | ||
private Material Mtrl | ||
{ | ||
get | ||
{ | ||
if(_mtrl == null) | ||
{ | ||
_mtrl = new Material(Shader.Find("Hidden/ShadowVolume/TestImageEffect")); | ||
} | ||
return _mtrl; | ||
} | ||
} | ||
|
||
protected virtual void OnRenderImage(RenderTexture source, RenderTexture destination) | ||
{ | ||
Graphics.Blit(source, destination, Mtrl); | ||
} | ||
|
||
private void Update() | ||
{ | ||
// Do nothing | ||
} | ||
|
||
private void OnDestroy() | ||
{ | ||
if (_mtrl != null) | ||
{ | ||
DestroyImmediate(_mtrl); | ||
_mtrl = null; | ||
} | ||
} | ||
|
||
public override void DrawImageEffect(RenderTexture source, RenderTexture destination) | ||
{ | ||
OnRenderImage(source, destination); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Assets/ShadowVolume/Example/ImageEffect/TestImageEffect.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters