当前位置:网站首页>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
边栏推荐
- Definition and Basic Operations of Sequence Tables
- 安装多版本php(php5.6,php7.2)
- Can I make a TCP connection without accept?
- Characteristics and Development Prospects of Korea's Cyber Security System
- Oracle 字段自增
- Prometheus Operator 通过additional 添加target
- 加工制造业智慧采购系统解决方案:助力企业实现全流程采购一体化协同
- 小满nestjs(第三章 前置知识装饰器)
- 鲜花线上销售管理系统的设计与实现
- 【分享】入驻集简云开发者平台,如何使用Session Auth配置授权?
猜你喜欢
source install/setup.bash时出现错误
Toronto Research Chemicals加米霉素-d4说明书
matlab 神经网络 ANN 分类
获取数组最后一项别再用array.length-1了
hdu 2094 产生冠军(STL map || 拓扑 || STL set)
What to do if Windows 11 can't find Internet Explorer
明明加了唯一索引,为什么还是产生重复数据?
力扣15-三数之和——HashSet&双指针法
字节一面:TCP 和 UDP 可以使用同一个端口吗?
Prometheus Operator 通过additional 添加target
随机推荐
【kali-权限提升】(4.2.6)社会工程学工具包(中):中间人攻击工具Ettercap
How to deal with keys when Redis is large?
[Deep learning] pix2pix GAN theory and code implementation
Next second data: the transformation of the modern data stack brought about by the integration of lake and warehouse has begun
小满nestjs(第四章 前置知识装饰器-实现一个GET请求)
LeetCode每日一题(321. Create Maximum Number)
【Jmeter】分布式搭建
华为云创新中心助力启泰智能 补齐中小模具企业数字化能力短板
安科瑞支持以太网通讯、profibus通讯嵌入式电能表APM指导性技术要求-Susie 周
【分享】入驻集简云开发者平台,如何使用Session Auth配置授权?
Number of daffodils within a thousand
axi4c
为什么数字钱包需要引入小程序生态
Ankerui supports Ethernet communication, profibus communication embedded energy meter APM guiding technical requirements-Susie Week
真香|持一建证书央企可破格录取
6 g underwater channel modeling were summarized based on optical communication
中英文说明书丨Abbkine细胞迁移分析试剂盒
Prometheus Operator 通过additional 添加target
韩国网络安全体系特征与发展前景
MySQL Notes-06 Basic SQL Operations