1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
2 | //
|
---|
3 | // ## ######
|
---|
4 | // ###### ###
|
---|
5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
6 | // ########## # # #
|
---|
7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
8 | // ######### # # # All rights reserved.
|
---|
9 | // ## ##########
|
---|
10 | // ##
|
---|
11 | //
|
---|
12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
13 |
|
---|
14 | struct PS_INPUT
|
---|
15 | {
|
---|
16 | float2 texCoord0: TEXCOORD0;
|
---|
17 | float2 texCoord1: TEXCOORD1;
|
---|
18 | float2 depthScr: TEXCOORD2;
|
---|
19 | };
|
---|
20 |
|
---|
21 | ///////////////////////////////////////////////////////////////////////////////
|
---|
22 | // Pixelshader
|
---|
23 | // Profile: 2x0
|
---|
24 |
|
---|
25 | sampler tex0: register(s0);
|
---|
26 | sampler tex1: register(s1);
|
---|
27 |
|
---|
28 | float4 main(PS_INPUT input): COLOR0
|
---|
29 | {
|
---|
30 |
|
---|
31 | float sourceTextureSize = 16.0;
|
---|
32 | float sqrtNumSamples = 4.0;
|
---|
33 | float epsilonX = -0.35;
|
---|
34 | float epsilonY = -0.06;
|
---|
35 |
|
---|
36 | float2 epsilon = float2(epsilonX, epsilonY);
|
---|
37 | float4 value = tex2D(tex0, input.texCoord1).xyzw;
|
---|
38 | float2 coords = float2(0.0, 1.0) - abs(input.texCoord0 - ( value.xy - epsilon ) );
|
---|
39 |
|
---|
40 | float2 depthScr = input.depthScr;
|
---|
41 |
|
---|
42 | //if (value.w != 0.0)
|
---|
43 | //{
|
---|
44 | float2 newcoord = (float2(1.0, 1.0) - value.zw) + ((coords * sourceTextureSize) / sqrtNumSamples);
|
---|
45 | float fragDepth = clamp(depthScr.x / depthScr.y, 0, 1);
|
---|
46 | //if (tex2D(tex1, newcoord).w != 0.0)
|
---|
47 | //{
|
---|
48 | // return fragDepth.x;
|
---|
49 | //}
|
---|
50 | //else
|
---|
51 | //{
|
---|
52 | // //discard;
|
---|
53 | // clip(-1.0);
|
---|
54 | //}
|
---|
55 | //}
|
---|
56 | //else
|
---|
57 | //{
|
---|
58 | // //discard;
|
---|
59 | // clip(-1.0);
|
---|
60 | //}
|
---|
61 |
|
---|
62 | return fragDepth.x * tex2D(tex1, input.texCoord0).w * value.w;
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 | ///////////////////////////////////////////////////////////////////////////////
|
---|