You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class ImageEffect_Scanner : PostEffectsBase{ |
|
public Shader scannerShader; |
|
private Material scannerMaterial; |
|
public Material material |
|
{ |
|
get |
|
{ |
|
scannerMaterial = CheckShaderAndCreateMaterial(scannerShader, scannerMaterial); |
|
return scannerMaterial; |
|
} |
|
} |
|
|
|
public float scannerScale = 1.0f; |
|
|
|
public float depthScale = 1.0f; |
|
|
|
public Texture2D mesh; |
|
public Vector2 st; |
|
public Color scannerColor = new Color(1,1,1,1); |
|
public float strength = 1.0f; |
|
public new void Start() { |
|
GetComponent<Camera>().depthTextureMode = DepthTextureMode.DepthNormals; |
|
} |
|
|
|
void OnRenderImage(RenderTexture src, RenderTexture dest) |
|
{ |
|
//GetComponent<Camera>().depthTextureMode = DepthTextureMode.DepthNormals; |
|
if (material != null) |
|
{ |
|
material.SetFloat("_ScannerScale", scannerScale); |
|
material.SetFloat("_DepthScale", depthScale); |
|
material.SetTexture("_ScannerTex", mesh); |
|
material.SetFloat("_TexX", st.x); |
|
material.SetFloat("_TexY", st.y); |
|
material.SetColor("_ScannerColor", scannerColor); |
|
material.SetFloat("_ScannerStrength", strength); |
|
Graphics.Blit(src, dest, material); |
|
} |
|
else |
|
{ |
|
Graphics.Blit(src, dest); |
|
} |
|
} |
|
}
|
|
|