Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial/Tutorial/Media/DeferredShadingMedia/DeferredShading/material/hlsl/nm_notex_ps.hlsl @ 25

Last change on this file since 25 was 25, checked in by nicolasc, 17 years ago

added Media and Config

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/******************************************************************************
2Copyright (c) W.J. van der Laan
3
4Permission is hereby granted, free of charge, to any person obtaining a copy of
5this software  and associated documentation files (the "Software"), to deal in
6the Software without restriction, including without limitation the rights to use,
7copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8Software, and to permit persons to whom the Software is furnished to do so, subject
9to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all copies
12or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE
19SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20******************************************************************************/
21/** Deferred shading framework
22        // W.J. :wumpus: van der Laan 2005 //
23       
24        Material shader: Single colour normal mapped
25*/
26sampler Tex0: register(s0);
27
28struct OUTPUT
29{
30        float4 color0 : COLOR0; // Diffuse color + ?
31        float4 color1 : COLOR1; // Normal + depth
32};
33
34float3 colour;
35float specularity;
36
37OUTPUT main(
38        float3 normal: TEXCOORD0,
39        float4 texCoord0: TEXCOORD1,
40        float depth: TEXCOORD2,
41        float3 tangent: TEXCOORD3,
42        float3 binormal: TEXCOORD4
43)
44{
45        OUTPUT output;
46        // Frame for normal mapping
47        float3x3 rotation = float3x3(tangent, binormal, normal);
48        float3 texnormal = (tex2D(Tex0, texCoord0)-0.5)*2;
49       
50        output.color0.rgb = colour;
51        output.color0.a = specularity;
52        output.color1.xyz = normalize(mul(texnormal,rotation)); // Do normalisation here, saves an operation per light
53        output.color1.w = depth;
54       
55        return output;
56}
Note: See TracBrowser for help on using the repository browser.