冯乐乐的《Unity Shader入门精要》附带项目,其中部分shader已经修改测试
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.
 
 

35 lines
841 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ImageEffect_Distort : PostEffectsBase{
public Shader distortShader;
private Material distortMaterial;
public Material material
{
get
{
distortMaterial = CheckShaderAndCreateMaterial(distortShader, distortMaterial);
return distortMaterial;
}
}
public Texture NoiseTex;
[Range(0,1)]
public float DistortScale;
void OnRenderImage(RenderTexture src, RenderTexture dest)
{
//GetComponent<Camera>().depthTextureMode = DepthTextureMode.DepthNormals;
if (material != null)
{
//material.SetFloat("_ScannerScale", scannerScale);
material.SetTexture("_DistortTex", NoiseTex);
material.SetFloat("_DistortScale", DistortScale);
Graphics.Blit(src, dest, material);
}
else
{
Graphics.Blit(src, dest);
}
}
}