source: GTP/trunk/App/Demos/Illum/IBRBillboardCloudTrees/Shark3D/demo_v5x0x7_t164x31u_enterpr_kwin32/src/res/levelutil/shader/prog/d3d9_hlsl/gen_shmap_indirect_texturing_d3d9_hlsl_ps2x0.s3d_shadercode @ 2330

Revision 2330, 1.7 KB checked in by igarcia, 17 years ago (diff)
Line 
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
14struct PS_INPUT
15{
16    float2 texCoord0: TEXCOORD0;
17    float2 texCoord1: TEXCOORD1;
18    float2 depthScr: TEXCOORD2;
19};
20
21///////////////////////////////////////////////////////////////////////////////
22// Pixelshader
23// Profile: 2x0
24
25sampler tex0: register(s0);
26sampler tex1: register(s1);
27
28float4 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///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.