aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/media/SampleRenderer/4/shaders/fragment/fancy_cloth_diffuse.cg
blob: 7714a24e7797a989326da16951d7dcbb51897b26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <phong_lighting.cg>
#include <fragment_entry.cg>

DECLARE_TEXTURE(diffuseTexture)
DECLARE_TEXTURE(normalTexture)

SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
{
	half4 diffuseTextureColor = tex2D(diffuseTexture, params.texcoord0.xy);
	half4 normalTextureColor  = tex2D(normalTexture,  params.texcoord0.xy);
	
	SurfaceMaterial mout;
	mout.diffuseColor       = diffuseTextureColor.rgb;
	mout.alpha              = lerp(normalTextureColor.a, 1, params.texcoord1.r);
	mout.emissiveColor      = 0;
	mout.specularColor      = diffuseTextureColor.a;
	mout.specularPower      = 16;
	mout.tangentSpaceNormal = normalTextureColor.xyz*2-1;
	return mout;
}