📄 applyforceshader.nvp
字号:
/*********************************************************************NVMH2****
Path: C:\Dev\devrel\Nv_sdk_4\Dx8\NVEffectsBrowser\Effects\Dot3Bump_Dynamic
File: ApplyForceShader.nvp
Copyright (C) 1999, 2000 NVIDIA Corporation
This file is provided without support, instruction, or implied warranty of any
kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is
not liable under any circumstances for any damages or loss whatsoever arising
from the use or inability to use this file or items derived from it.
Comments:
This shader samples t1, biases its value to a signed number, and applies this
value multiplied by a scale factor to the t0 sample.
This is used to apply a "force" texture value to a "velocity" state texture
for nearest-neighbor height-based water simulations. The output pixel is
the new "velocity" value to replace the t0 sample in rendering to a new
texture which will replace the texture selected into t0.
A nearlty identical shader using a different scaling constant is used to
apply the "velocity" value to a "height" texture at each texel.
t1 comes in the range [0,1] but needs to hold signed values, so a value of
0.5 in t1 represents zero force. This is biased to a signed value in
computing the new velocity.
******************************************************************************/
#include "PixelConstants.h"
; Declare pixel shader version
ps.1.1
tex t0 // previous velocity
tex t1 // force at the texel in question
; Bias the force so that 0.5 input = no change in t0 value
; and 0.0 input means -0.5 * scale change in t0 value
; New velocity = force * scale + previous velocity
mad r0, t1_bias, c[PCN_MULTFACTOR_1], t0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -