当前位置:网站首页>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
边栏推荐
- 鲜花线上销售管理系统的设计与实现
- LeetCode每日一题(321. Create Maximum Number)
- 软件测试技术之如何编写测试用例(6)
- Beat the interviewer, the CURD system can also make technical content
- Haven't tried line art videos this year??
- WPF中加载并使用图像资源
- C语言之实现倒置字符串的两种方法
- Can I make a TCP connection without accept?
- 字节二面问的MySQL,差点没答好
- Reverse Analysis of Unknown Cryptographic Protocol Based on Network Data Flow
猜你喜欢

hdu 2094 产生冠军(STL map || 拓扑 || STL set)

【kali-权限提升】(4.2.7)社会工程学工具包:权限维持创建后门、清除痕迹
![[Free column] APK dynamic reverse application of Android security [Three Smali injection methods]](/img/11/39a25d86c9486bb5201659bbbeaa36.png)
[Free column] APK dynamic reverse application of Android security [Three Smali injection methods]

How to fix Windows 11 not finding files

线性表的定义和基本操作

Visual studio 2022 debugging skills introduction

prometheus学习3Grafana部署及基本使用

小满nestjs(第三章 前置知识装饰器)

顺序表的定义和基本操作

IS31FL3737B general 12 x 12 LED drive 40 QFN I2C 42 ma
随机推荐
基于网络数据流的未知密码协议逆向分析
数据分散情况的统计图-盒须图
DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
获取数组最后一项别再用array.length-1了
An overall security understanding and method of cyberspace based on connection and security entropy
6 g underwater channel modeling were summarized based on optical communication
Oracle 字段自增
matlab 神经网络 ANN 分类
[Free column] Xposed plug-in development for Android security [from scratch] tutorial
奥特曼卡牌隐藏的百亿市场
3D感知(二):单目3D物体检测
【图文并茂】如何进行Win7系统的重装
【kali-密码攻击】(5.1.1)密码在线破解:Hydra(图形界面)
漏洞复现-redis未授权getshell
ClickHouse一种高性能分布式join查询模型(Colocate Join)
Overview of Security Analysis Technology for Smart Home Devices
获取一段程序运行的时间
新起之秀 DPU,正在掀起数据中心变革!
Reverse Analysis of Unknown Cryptographic Protocol Based on Network Data Flow
IS31FL3737B general 12 x 12 LED drive 40 QFN I2C 42 ma