当前位置:网站首页>Unit contour creation method
Unit contour creation method
2022-06-24 14:10:00 【Xiaosheng yunmu】
unity Contour creation method
complete shader
Shader "SongShaderDemo/ContourLineOne"
{
Properties
{
_MainTex("Texture", 2D) = "white" {
}
_Linewide("Linewide",Range(0,5)) = 1
_ContourLine("ContourLine",Int) = 10
_Color("color",Color) = (1,1,1,1)
}
SubShader
{
Tags {
"RenderType" = "Transparent" "Queue" = "Transparent"}
LOD 100
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
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;
float3 worldPos : TEXCOORD1;
};
CBUFFER_START(UnityPerMaterial)
sampler2D _MainTex;
float4 _MainTex_ST;
fixed _Linewide;
fixed _ContourLine;
fixed4 _Color;
CBUFFER_END
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
float3 curWorldpos = mul(unity_ObjectToWorld, v.vertex).xyz;
o.worldPos = curWorldpos;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv);
if (i.worldPos.y%_ContourLine < _Linewide || _ContourLine - (i.worldPos.y%_ContourLine) < _Linewide)
{
return _Color;
}
else
{
return col;
}
}
ENDCG
}
}
}
边栏推荐
- Convolution kernel and characteristic graph visualization
- 2022质量员-设备方向-通用基础(质量员)考试题及答案
- 在线文本实体抽取能力,助力应用解析海量文本数据
- 居家办公更要高效-自动化办公完美提升摸鱼时间 | 社区征文
- Jericho may have some chips with fast music playing speed [chapter]
- kotlin 共享可变状态和并发性
- 数商云:加强供应商管理,助推航空运输企业与供应商高效协同
- 2022年氟化工艺考试模拟100题及答案
- npm包【详解】(内含npm包的开发、发布、安装、更新、搜索、卸载、查看、版本号更新规则、package.json详解等)
- Solution of channel management system for food and beverage industry: realize channel digital marketing layout
猜你喜欢

Autorf: learn the radiation field of 3D objects from single view (CVPR 2022)

杰理之串口接收 IO 需要设置数字功能【篇】

AutoRF:从单视角观察中学习3D物体辐射场(CVPR 2022)

居家办公更要高效-自动化办公完美提升摸鱼时间 | 社区征文

Convolution kernel and characteristic graph visualization

快手实时数仓保障体系研发实践

markdown/LaTeX中在字母下方输入圆点的方法

谷歌WayMo提出R4D: 采用参考目标做远程距离估计

【R语言数据科学】(十四):随机变量和基本统计量

HarmonyOS. two
随机推荐
P2PDB 白皮书
Rasa 3. X learning series - it is a great honor to be a source code contributor of Rasa contributors, and to build and share the rasa community with rasa source code contributors all over the world!
unity 等高线创建方法
Dragon lizard developer said: first time you got an electric shock, so you are such a dragon lizard community| Issue 8
Jupiter notebook operation
真正的项目经理强者,都是闭环高手!
The project manager needs to look at six characteristics to build a team
Kotlin composite suspend function
Harmony os. (2)
2022年质量员-设备方向-岗位技能(质量员)复训题库及在线模拟考试
SAP Marketing Cloud 功能概述(三)
杰理之开了多种解码格式插卡到播放等待的时间长【篇】
Convolution kernel and characteristic graph visualization
Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]
杰理之红外滤波【篇】
卷积核、特征图可视化
**Unity中莫名其妙得小问题-灯光和天空盒
Jupyter notebook操作
**Puzzling little problem in unity - light and sky box
Solution of channel management system for food and beverage industry: realize channel digital marketing layout
