Shader "UnderStandPRR"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
 
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
 
#include "UnityCG.cginc"
 
struct appdata
{
float4 vertex : POSITION;
};
 
struct v2f
{
float4 vertex : SV_POSITION;
};
 
sampler2D _MainTex;
float4 _MainTex_ST;
 
v2f vert (appdata v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
 
fixed4 frag (v2f i) : SV_Target
{
// i.vertex.xy are pixel coordinates 
// i.vertex.z is depth value 
// i.vertex.w is SV_POSITION w - z value (Perspective interpolation)
return  fixed4(i.vertex.x * (_ScreenParams.z - 1), i.vertex.y * (_ScreenParams.w - 1), i.vertex.z, i.vertex.w);
}
ENDCG
}
}
}

UnderStand Perspective Rasterization, SV_POSITION(gl_FragCoord) to Pixel, SV mean Systems Value的更多相关文章

  1. OpenGL.Tutorial16_ShadowMapping

    1. 2. In Tutorial 15 we learnt how to create lightmaps, which encompasses(包含) static lighting. While ...

  2. (转)Shadow Mapping

    原文:丢失,十分抱歉,这篇是在笔记上发现的.SmaEngine 阴影和级联部分是模仿UE的结构设计   This tutorial will cover how to implement shadow ...

  3. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制 代码工程地址: https://gi ...

  4. How do I learn mathematics for machine learning?

    https://www.quora.com/How-do-I-learn-mathematics-for-machine-learning   How do I learn mathematics f ...

  5. Shadow Map阴影贴图技术之探 【转】

    这两天勉勉强强把一个shadowmap的demo做出来了.参考资料多,苦头可不少.Shadow Map技术是目前与Shadow Volume技术并行的传统阴影渲染技术,而且在游戏领域可谓占很大优势.本 ...

  6. 引擎设计跟踪(九.14.3.3) Deferred shading的一些小细节

    1.ambient light 之前的shader里面, 方向光会加上ambient 的计算. 但是如果没有方向光, 就没有ambient. 这是把全局方向光改为点光源之后发现的, 因为透明物体的fo ...

  7. (转)Introductory guide to Generative Adversarial Networks (GANs) and their promise!

    Introductory guide to Generative Adversarial Networks (GANs) and their promise! Introduction Neural ...

  8. Glow 效果材质

    转自:http://blog.csdn.net/panda1234lee/article/details/60960846 算法较简单,首先来看 Base color 部分: 就是将对事先准备好的三张 ...

  9. Puppet's Commands 3.7

    Puppet's Commands Puppet’s command line interface consists of a single puppet command with many subc ...

随机推荐

  1. Java 输入

    1.使用Scanner 使用时需要引入包import java.util.Scanner;首先定义Scanner对象 Scanner sc = new Scanner(System.in);如果要输入 ...

  2. 多线程与Socket编程

    一.死锁 定义: 指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去.此时称系统处于死锁状态或系统产生了死锁,这些永远在互相等待的进程称为死锁 ...

  3. json解析异常 - net.sf.json.JSONException: java.lang.reflect.InvocationTargetException

    注:在项目中, 我使用原生的ajax请求数据的时候, JSONObject没能帮我解析, 当却不给我报错, 我是在junit单元测试中测试的时候, 发现的.发现好多时候, 特别是通过ajax请求, 不 ...

  4. Jquery全选与反选checkbox(代码示例)

    今天在公司要实现操作权限的功能,需要根据左边的树,选择一项,判断右边的操作权限,例如,增加,修改,删除,查看等按钮的显示与隐藏: 这个功能实现思路如下: 1.操作权限:增加.修改等按钮的ID和Text ...

  5. google code 上传源码

    在使用google code 的时候 做个备份, git clone https://wushuangzilong@code.google.com/p/maplebanana-proxy/ git c ...

  6. 关于jQuery,$(":button") 中的冒号是什么意思?

    $(":button") 表示匹配所有的按钮.$("input:checked")表示匹配所有选中的被选中元素(复选框.单选框等,不包括select中的opti ...

  7. Android简单例子——AlertDialog

    最近学习了一段时间的Android,在网上找了些小的Demo,自己模拟这做了下,首先谢谢那些提供例子的朋友 今天主要学习的是简单的Dialog的使用(实现退出对话框)和自定义对话框 1.实现退出对话框 ...

  8. python中文问题汇总

    1.中文路径 #-*-coding:utf-8-*- path=ur'E:\accumulate\Python\语法\08输入和输出\1.txt' #python内部使用的是unicode,不加前缀u ...

  9. SQL,学习基础2

    列=字段, 记录=实体  事物日志文件(用来记录数据库的增删情况,扩展名LDF) 数据库文件(但是只有一个是主数据库文件(即用它来启动的),其余为次数据库文件)mdf 数据类型: 整形(整数)——in ...

  10. Win32中GDI+应用(三)---Graphics类

    在我理解看来,Graphics是一个device context和你的drawing conetent之间的一个中介.它存储了device context的相关属性,以及drawing content ...