当前位置:网站首页>unity 等高线创建方法
unity 等高线创建方法
2022-06-24 13:00:00 【小生云木】
unity 等高线创建方法
完整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
}
}
}
边栏推荐
- 快手实时数仓保障体系研发实践
- 在线文本实体抽取能力,助力应用解析海量文本数据
- The real project managers are all closed-loop masters!
- 【sdx62】WCN685X IPA注册失败问题分析及解决方案
- 杰理之无缝循环播放【篇】
- kotlin 协程通道
- Jericho may have some chips with fast music playing speed [chapter]
- Can a team do both projects and products?
- 2022年烟花爆竹生产单位安全生产管理人员考试题模拟考试题库模拟考试平台操作
- kotlin 接口 泛型 协变 逆变
猜你喜欢

每日一题day8-515. 在每个树行中找最大值
![[5g NR] 5g NR system architecture](/img/78/6db70c18887c7a3920843d1cb4bdf3.png)
[5g NR] 5g NR system architecture

Dragon lizard developer said: first time you got an electric shock, so you are such a dragon lizard community| Issue 8

HarmonyOS. two

万用表测量电阻图解及使用注意事项

#21Set经典案例

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

如何在物联网低代码平台中进行任务管理?

龙蜥开发者说:首次触电,原来你是这样的龙蜥社区? | 第 8 期

Tupu software is the digital twin of offshore wind power, striving to be the first
随机推荐
2022质量员-设备方向-通用基础(质量员)考试题及答案
The first open source MySQL HTAP database in China will be released soon, and the three highlights will be notified in advance
Prometheus pushgateway
In the era of knowledge economy, it will teach you to do well in knowledge management
一个团队可以既做项目又做产品吗?
Rasa 3.x 学习系列-非常荣幸成为 Rasa contributors 源码贡献者,和全世界的Rasa源码贡献者共建共享Rasa社区!
10 reduce common "tricks"
Detailed explanation of kotlin collaboration lanch
kotlin 协程通道
OpenHarmony 1
2022 coal mine gas drainage operation certificate examination questions and simulation examination
2022年煤炭生产经营单位(安全生产管理人员)考试题模拟考试平台操作
[sdx62] wcn685x IPA failure analysis and solution
Kotlin inheritance, class, overload
Kotlin coroutine context and scheduler
杰理之增加一个输入捕捉通道【篇】
SAP Marketing Cloud 功能概述(四)
返回新列表
The research on the report "market insight into China's database security capabilities, 2022" was officially launched
知识经济时代,教会你做好知识管理
