⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showblurriness.nvp

📁 游戏编程精华02-含有几十个游戏编程例子
💻 NVP
字号:
/************************************************************************
ShowBlurriness.nvp

This pixel shader repleaces DepthOfFielddBlend.nvp: it does no blending:
it simply shows the DoF interpolator
  
Copyright (C) 1999, 2000 NVIDIA Corporation
*************************************************************************/

; Declare pixel shader version 
ps.1.1

def c0, 0.0f, 0.0f, 0.0f, 0.5f
def c1, 0.0f, 0.0f, 0.0f, 1./3.f

; sample all the texture stages
tex t0
tex t1
tex t2

; first interpolate the interpolator: using t0 straight produces ghosting 
; since the DoF selection is always hi-res (ie, t0) even for the blurred parts.
; playing with various combinations of t0, t1, t2 shows that the following
; is reasonable (depth-changing edges never get really unblurred)
; and yet only takes a single instruction.
lrp r0.a, c0, t2.a, t0.a

; although the following also produces good results (but with a bit of ghosting
; and two instructions)
; r0.a = 0.666*(.5*t2.a + .5*t1.a) + 0.333 * t0.a)
;      = 0.333*(t0.a+t1.a+t2.a)
; lrp r0.a, c0, t2.a, t1.a
; lrp r0.a, c1, r0.a, t0.a	

mov r0.rgb, r0.a

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -