当前位置:网站首页>Unity2D_线框材质
Unity2D_线框材质
2022-08-09 19:20:00 【不可_收_圾】
一.这个好像是以UV分隔
Shader "Custom/Wireframe"
{
Properties
{
_Color("Color",Color) = (1.0,1.0,1.0,1.0)
_EdgeColor("Edge Color",Color) = (1.0,1.0,1.0,1.0)
_Width("Width",Range(0,1)) = 0.2
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
}
Blend SrcAlpha OneMinusSrcAlpha
LOD 200
Cull Front
zWrite off
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#include "UnityCG.cginc"
struct a2v {
half4 uv : TEXCOORD0;
half4 vertex : POSITION;
};
struct v2f {
half4 pos : SV_POSITION;
half4 uv : TEXCOORD0;
};
fixed4 _Color;
fixed4 _EdgeColor;
float _Width;
v2f vert(a2v v)
{
v2f o;
o.uv = v.uv;
o.pos = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag(v2f i) : COLOR
{
fixed4 col;
float lx = step(_Width, i.uv.x);
float ly = step(_Width, i.uv.y);
float hx = step(i.uv.x, 1.0 - _Width);
float hy = step(i.uv.y, 1.0 - _Width);
col = lerp(_EdgeColor, _Color, lx * ly * hx * hy);
return col;
}
ENDCG
}
Blend SrcAlpha OneMinusSrcAlpha
LOD 200
Cull Back
zWrite off
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#include "UnityCG.cginc"
struct a2v
{
half4 uv : TEXCOORD0;
half4 vertex : POSITION;
};
struct v2f
{
half4 pos : SV_POSITION;
half4 uv : TEXCOORD0;
};
fixed4 _Color;
fixed4 _EdgeColor;
float _Width;
v2f vert(a2v v)
{
v2f o;
o.uv = v.uv;
o.pos = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag(v2f i) : COLOR
{
fixed4 col;
float lx = step(_Width, i.uv.x);
float ly = step(_Width, i.uv.y);
float hx = step(i.uv.x, 1.0 - _Width);
float hy = step(i.uv.y, 1.0 - _Width);
col = lerp(_EdgeColor, _Color, lx * ly * hx * hy);
return col;
}
ENDCG
}
}
FallBack "Diffuse"
}
二.以顶点连线分隔
在Unity资源商店里就有:UCLA Wireframe Shader
参考:Unity Shader物体线框https://www.cnblogs.com/Haha1999/p/15662830.html
边栏推荐
- Laravel之队列「建议收藏」
- php安装make出现“collect2:error:ldreturned1exitstatus
- 小满nestjs(第四章 前置知识装饰器-实现一个GET请求)
- Laravel DB批量更新的方法
- leetcode二叉搜索树与双向链表
- Week 8 Deep learning for object detection
- How to deal with keys when Redis is large?
- 没有 accept,我可以建立 TCP 连接吗?
- 小满nestjs(第三章 前置知识装饰器)
- DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
猜你喜欢
Acrel5000web能耗系统在某学院的应用-Susie 周
纸业供应链协同管理系统:重构纸业智慧供应网络,支撑企业数字化转型升级
matlab 神经网络 ANN 分类
企业数据打通有什么好处?不同行业怎么解决数据打通难题?
Can I make a TCP connection without accept?
Prometheus Operator 自定义监控添加redis explorer
《评估、创建和使用知识图谱的限制》2022最新230页博士论文,根特大学
DSPE-PEG-Silane,DSPE-PEG-SIL,磷脂-聚乙二醇-硅烷修饰二氧化硅颗粒用
What are the benefits of enterprise data integration?How do different industries solve the problem of data access?
小满nestjs(第五章 nestjs cli)
随机推荐
顺序表的定义和基本操作
Js查找字符串中出现最多次数的字母和单词
痛击面试官 CURD系统也能做出技术含量
下秒数据:湖仓一体带来的现代数据堆栈变革开始了
Toronto Research Chemicals加米霉素-d4说明书
【kali-密码攻击】(5.1.1)密码在线破解:Hydra(图形界面)
中英文说明书丨Abbkine细胞迁移分析试剂盒
visual studio 2022调试技巧介绍
PyTorch框架的 torch.cat()函数
[Free column] Xposed plug-in development for Android security [from scratch] tutorial
Redis 大的情况下,key 要如何处理?
2.3 监督学习-2
Prometheus Operator 通过additional 添加target
DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
小满nestjs(第四章 前置知识装饰器-实现一个GET请求)
6 g underwater channel modeling were summarized based on optical communication
buuctf (Adventure 2)
如何从800万数据中快速捞出自己想要的数据?
Oracle 字段自增
力扣383-赎金信——哈希映射数组法