随笔分类 - shader
摘要:Shader "Unlit/NewUnlitShader" { Properties { _MainTex ("Texture", 2D) = "white" {} _Color("Tint", Color) = (1,1,1,1) _StencilComp("Stencil Comparison", Float) = 8 ...
阅读全文
摘要:效果 原理: 开启摄像机的深度模式,将深度保存到一张名为_CameraDepthTexture(Unity5.0之后才有)内置的纹理中. 如果深度在焦点范围内就用原图,否则就用模糊图。 Shader: C#代码
阅读全文
摘要://预览图 //原理 一个摄像机CullingMask设置只可见"Distortion"的Layer(需要自己手动加),输入到一张RenderTexture,其实就是用于确定哪里要扭曲。 另外一个摄像机CullingMask设置成对除了"Distortion"的Layer可见,并挂上后期效果脚本。
阅读全文
摘要://效果图 //Shader代码
阅读全文
摘要://效果预览 //Shader代码
阅读全文
摘要:Shader "Custom/FlowColor" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _FlowColor("Flow Color", Color) = (1,1,1,1) _FlowRange("Flow Range", Float) = 0.01 } SubShader { P...
阅读全文
摘要:Intrinsic Functions (DirectX HLSL) The following table lists the intrinsic functions available in HLSL. Each function has a brief description, and a l
阅读全文
摘要:Shader "Custom/RimColor" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _RimColor("Rim Color", Color) = (1,1,1,1) _RimRang("Rim Range",range(0,1)) = 0.1 } ...
阅读全文
摘要:把脚本挂在摄像机上 创建一个材质,再创建一个Shader
阅读全文
摘要:Shader "Custom/Snow" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _RimColor("Rim Color", Color) = (1,1,1,1) _SnowPower ("Snow Power",range(0,1)) = 0.2//边缘强度 ...
阅读全文
摘要:Shader "Custom/NewShader" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _RimColor("Rim Color", Color) = (1,1,1,1) _RimPower ("Rim power",range(0,5)) = 2//边缘强度...
阅读全文
摘要:效果 BurnToFadeOut.shader代码 Shader "BurnToFadeOut" { Properties { _StartColor ("Start Color", Color) = (1,1,1,1) _EndColor ("End Color", Color) = (1,1,1
阅读全文
摘要:先上效果,左边模糊 其实用的是Unity Stard Effect里的资源,一个脚本一个shader //脚本代码 using UnityEngine; using System.Collections; [ExecuteInEditMode] [AddComponentMenu("Image Ef
阅读全文
摘要:先上效果 Shader 脚本 搞法: 1、创建个材质命名成UITexture_Flow.mat,把上面的shader拖拽进去。 2、创建GameObject,挂上UITexture(不用修改的材质,原因是我代码里会去修改他的材质。为什么总是new 新的材质,原因是每个UITexture都要自己流动自
阅读全文
摘要:效果图1、先准备好一个变灰shader。代码如下Shader "Custom/Gray"{ Properties { _MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {} } SubShader { LOD 200 Tags { "Qu...
阅读全文
摘要:void Start () { const string MainTexVariableName = "_MainTex"; var renders = gameObject.GetComponentsInChildren(); var resMat = Resources.Load("Cha...
阅读全文
摘要:Shader "Custom/OutLine" {Properties { _Color ("Main Color", Color) = (.5,.5,.5,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1) _Outline ("Out...
阅读全文