source:
data/branches/Shader_HS18/programs/Example/Cg/PosterizeFP.cg
@
12091
| Last change on this file since 12091 was 12083, checked in by wiesep, 7 years ago | |
|---|---|
| File size: 372 bytes | |
| Rev | Line | |
|---|---|---|
| [12083] | 1 | sampler2D RT : register(s0); |
| 2 | ||
| 3 | float4 Posterize_ps (float4 pos : POSITION, float2 iTexCoord : TEXCOORD0) : COLOR | |
| 4 | { | |
| 5 | ||
| 6 | float nColors = 8; | |
| 7 | float gamma = 0.6; | |
| 8 | ||
| 9 | float4 texCol = tex2D(RT, iTexCoord); | |
| 10 | float3 tc = texCol.xyz; | |
| 11 | tc = pow(tc, gamma); | |
| 12 | tc = tc * nColors; | |
| 13 | tc = floor(tc); | |
| 14 | tc = tc / nColors; | |
| 15 | tc = pow(tc,1.0/gamma); | |
| 16 | return float4(tc,texCol.w); | |
| 17 | } |
Note: See TracBrowser
for help on using the repository browser.










