blob: a706e45cde778f0166fc685ea22de8b505b82425 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// fragment shader that takes in a diffuse texture and some material parameters.
#include <phong_lighting.cg>
#include <fragment_entry.cg>
DECLARE_TEXTURE(diffuseTexture)
BEGIN_CBUFFER(cbMaterialDiffuse)
CONST_TYPE float4 diffuseColor;
CONST_TYPE float3 emissiveColor;
CONST_TYPE float3 specularColor;
CONST_TYPE float specularPower;
END_CBUFFER(cbMaterialDiffuse)
SurfaceMaterial computeSurfaceMaterial(const FragmentParameters params)
{
half4 diffuseTextureColor = (half4)tex2D(diffuseTexture, params.texcoord0.xy);
SurfaceMaterial mout;
mout.diffuseColor = diffuseTextureColor.rgb * (half3)diffuseColor.rgb;
mout.alpha = diffuseTextureColor.a * (half)diffuseColor.a;
//float3 eyeToSurf = normalize(g_eyePosition-params.worldSpacePosition);
//mout.emissiveColor = 1-pow(saturate(dot(normalize(g_eyePosition-params.worldSpacePosition),2)), params.worldSpaceNormal);//emissiveColor * saturate(dot(-g_eyeDirection, params.worldSpaceNormal));
mout.emissiveColor = (half3)emissiveColor;
mout.specularColor = (half3)specularColor;
mout.specularPower = (half)specularPower;
mout.tangentSpaceNormal = half3(0,0,1);
return mout;
}
|