shader基础教程
来源:互联网 发布:淘宝直播预告已过期 编辑:程序博客网 时间:2024/06/18 06:04
Shader "Custom/Test11-07" {
SubShader {
pass
{
CGPROGRAM
#pragma vertex vert //顶点函数
#pragma fragment frag //片段函数
struct v2f//结构体
{
fixed4 col:COLOR;
float4 pos:POSITION;
};
void vert(in float2 objpos:POSITION,out fixed4 col:COLOR,out float4 pos:POSITION)//切记 col 要放在pos之前
{
pos=float4(objpos,1,1);
col=pos;
if(objpos.x<0)
{
col=fixed4(1,0,0,1);
}
else
{
col=fixed4(0,0,1,1);
}
}
void frag(inout fixed4 col5:COLOR)//需要填写inout 否则进行颜色输出
{
//col=fixed4(1,0,0,1);
//v.col=col;
//return v.col;
}
ENDCG
}
}
}
SubShader {
pass
{
CGPROGRAM
#pragma vertex vert //顶点函数
#pragma fragment frag //片段函数
struct v2f//结构体
{
fixed4 col:COLOR;
float4 pos:POSITION;
};
void vert(in float2 objpos:POSITION,out fixed4 col:COLOR,out float4 pos:POSITION)//切记 col 要放在pos之前
{
pos=float4(objpos,1,1);
col=pos;
if(objpos.x<0)
{
col=fixed4(1,0,0,1);
}
else
{
col=fixed4(0,0,1,1);
}
}
void frag(inout fixed4 col5:COLOR)//需要填写inout 否则进行颜色输出
{
//col=fixed4(1,0,0,1);
//v.col=col;
//return v.col;
}
ENDCG
}
}
}
阅读全文
0 0
- shader基础教程
- Unity3D Shader基础教程
- [unity 基础教程]给着色器shader添加透明属性
- shader
- shader
- shader
- Shader
- Shader
- shader
- shader
- shader
- Shader
- shader
- Shader
- shader
- Shader
- shader
- Shader
- 面向对象程序设计上机练习一(函数重载)
- [Redis学习笔记]-Redis命令
- xml解析---Java解析xml文件 /江格式解析
- OKhttp模版
- JAVA中字符串比较equals()和equalsIgnoreCase()的区别
- shader基础教程
- LINQ 查询
- drawable与mipmap的区别(android资源文件放置位置)
- 简单登录 MVP
- 面向对象程序设计上机练习二(函数模板)
- Linux如何修改文件权限
- 使用TCP协议连续传输大量数据时,是否会丢包,应如何避免
- 1046
- Luogu 3807(Lucas定理)