builtin_shaders-5.3.4f1学习-Unlit/Texture
// Unlit shader. Simplest possible textured shader.
// - no lighting
// - no lightmap support
// - no per-material color Shader "Unlit/Texture" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
} SubShader {
Tags { "RenderType"="Opaque" }
LOD 100 Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog #include "UnityCG.cginc" struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
}; struct v2f {
float4 vertex : SV_POSITION;
half2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
}; sampler2D _MainTex;
float4 _MainTex_ST; v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
} fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.texcoord);
UNITY_APPLY_FOG(i.fogCoord, col);
UNITY_OPAQUE_ALPHA(col.a);
return col;
}
ENDCG
}
} }
SV_Target 与Color略有区别,大体相同,有可能是两者的位置前者是中心位置,后者不是,有0.5像素的偏移,这个以后确认下
Fog相关的几个函数
UnityCG.cginc中的解释
// multi_compile_fog Will compile fog variants.
// UNITY_FOG_COORDS(texcoordindex) Declares the fog data interpolator.
// UNITY_TRANSFER_FOG(outputStruct,clipspacePos) Outputs fog data from the vertex shader.
// UNITY_APPLY_FOG(fogData,col) Applies fog to color "col". Automatically applies black fog when in forward-additive pass.
// Can also use UNITY_APPLY_FOG_COLOR to supply your own fog color.
builtin_shaders-5.3.4f1学习-Unlit/Texture的更多相关文章
- builtin_shaders-5.3.4f1学习-Sprites-Default
Shader "Sprites/Default" { Properties { [PerRendererData] _MainTex ("Sprite Texture&q ...
- Unity3D WebCamTexture 调用外部摄像头
http://www.itnose.net/detail/6259004.html 一:Unity 中使用WebCamTexture 调用摄像头实现拍照和摄像. using UnityEngine; ...
- Unity镜子效果的实现(无需镜子Shader)
Unity镜子效果制作教程 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- 心分享. ...
- WikiBooks/Cg Programming
https://en.wikibooks.org/wiki/Cg_Programming Basics Minimal Shader(about shaders, materials, and gam ...
- unity, standard shader消耗两个draw call
假设场景中只放一个球,关掉阴影和skybox,球体使用Unlit/Texture shader,则draw call数为2(背景占一个draw call,球占一个draw call). 相同情况下若将 ...
- What is _MainTex_ST ?
[What is _MainTex_ST ?] 在Unity自带的Unlit/Texture中,有引用到float4 _MainTex_ST,如下: // Unlit shader. Simplest ...
- Unity 官方自带的例子笔记 - Space Shooter
首先 买过一本叫 Unity3D开发的书,开篇第一个例子就是大家经常碰见的打飞机的例子,写完后我觉得不好玩.后来买了一本 Unity 官方例子说明的书,第一个例子也是打飞机,但是写完后发现蛮酷的,首先 ...
- unity 内置shader
几个有用的Unity 内置shader: (一)Standard RenderingMode:Opaque为实体渲染,更改Color的透明通道不会有影响:Cutout会把图片的透明通道显示出来,非严格 ...
- Unity制作出《超级马里奥》的2D和3D混合效果
现在来做点别的东西.Nintendo Switch上刚推出的<超级马里奥>中,有一些关卡混合了2D和3D的画面,这种效果十分让人印象深刻.如何在Unity中实现这个效果呢? 正常情况下,摄 ...
随机推荐
- HBase GC日志
HBase依靠ZooKeeper来感知集群成员及其存活性.假设一个server暂停了非常长时间,它将无法给ZooKeeper quorum发送心跳信息,其他server会觉得这台server已死亡.这 ...
- EasyDarwin开源流媒体服务器提供的TS切片/HLS直播打包库
EasyHLS Github:https://github.com/EasyDarwin/EasyHLS EasyHLS是什么? EasyHLS是EasyDarwin开源流媒体社区开发的一款HLS打 ...
- javaweb开发之jsp
一.WEB应用的目录结构 通常我们是在IDE中创建web应用程序,IDE自动为我们实现了WEB的目录结构,下面来看如何徒手创建一个WEB程序. 首先来看一下Tomcat自带的一个web应用的目录结构 ...
- cc 和gcc编译器
从名字上看,老的unix系统的CC程式叫做C Compiler.但GCC这个名字按GNU的说法叫做Gnu Compiler Collection.因为gcc包含非常多编译器(C, C++, Objec ...
- codeforces A. Point on Spiral 解题报告
题目链接:http://codeforces.com/problemset/problem/279/A 题目意思:给出一个坐标点(x, y),问当从(0, 0) 开始到达该点转过的拐角有多少个.(拐角 ...
- suishou
sageException: Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn you ...
- Springboot框架中request.getInputStream()获取不到上传的文件流
Springboot框架中用下面的代码,使用request.getInputStream()获取不到上传的文件流 @PostMapping("/upload_img") publi ...
- coeforces 665D D. Simple Subset(最大团orsb题)
题目链接: D. Simple Subset time limit per test 1 second memory limit per test 256 megabytes input standa ...
- ubuntu 下编译安装ceph
git clone --recursive https://github.com/ceph/ceph.git cd ceph/ sudo apt-get install libtool sud ...
- 「USACO16OPEN」「LuoguP3146」248(区间dp
题目描述 Bessie likes downloading games to play on her cell phone, even though she doesfind the small to ...