
Shader 基础
RocketJ
Unity Create World
展开
-
贴图阴影shader(扁平)
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'Shader "Custom/Sprites/DefaultShadowFlatten"{ Properties { [HideInInspector]_MainTex("Main Tex", 2D) = "white" {} _RadiusX("_RadiusX", Range(0, 2)) = 1 _RadiusY("_RadiusY"原创 2022-03-03 09:32:33 · 150 阅读 · 0 评论 -
贴图阴影shader(模糊渐变)
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'Shader "Custom/Sprites/DefaultShadowIndistinct"{ Properties { [HideInInspector]_MainTex("Main Tex", 2D) = "white" {} _RadiusX("_RadiusX", Range(0, 2)) = 1 _RadiusY("_Radiu原创 2022-03-03 08:57:00 · 384 阅读 · 0 评论 -
贴图阴影shader
Shader "Custom/Sprites/DefaultShadow"{ Properties { [HideInInspector]_MainTex("Main Tex", 2D) = "white" {} _Alpha("_Alpha", Range(0, 1)) = 0.8 _Offset("Offset", vector) = (0, 0, 0, 0) } CGINCLUDE #include "UnityCG.cginc" sampler2D _Mai原创 2022-03-03 08:54:07 · 215 阅读 · 0 评论 -
Shader属性
[HideInInspector]在显示面板隐藏属性[NoScaleOffset]材质面板不显示UV偏移[Normal]表明贴图为法线贴图[HDR]表示贴图是HDR贴图[Gamma]表示float/vector变量在UI里为sRGB[PerRendererData]表示贴图的属性来自MaterialPropertyBlockColor颜色Int整数Float浮点数Vector四维数2D纹理3D纹理Cube立方体纹理...原创 2022-01-26 14:32:51 · 1153 阅读 · 0 评论 -
Shader Time
原创 2022-01-12 15:02:28 · 205 阅读 · 0 评论 -
Unity 血条Shader(一)
按角色血量改变血条 Shader "Unlit/HpBarShader"{ Properties { [NoScaleoffset]_MainTex ("Texture", 2D) = "white" {} _Health ("Health", Range(0, 1)) = 1 } SubShader { Tags { "RenderType"="Opaque" } Pass {原创 2021-08-05 16:08:42 · 740 阅读 · 0 评论 -
Unity 代码修改和获取shader参数值
获取Obj的渲染器Renderer,然后获取材质Material:1、修改 Shader 中参数的值:material.SetFloat(“参数名”,值);material.SetColor(“参数名”,颜色值);material.SetTexture(“参数名”,贴图);2、获取 Shader 中参数的值:material.GetFloat(“参数名”);material.GetColor(“参数名”);material.GetTexture(“参数名”);...原创 2020-06-30 14:45:38 · 6501 阅读 · 0 评论 -
Unity shader添加修改通道(以颜色为例)
1、添加颜色参数,修改shader;2、编辑器查看添加,参数;3、代码修改shader颜色原创 2020-06-30 14:51:26 · 1194 阅读 · 2 评论