Do alot of stuff
This commit is contained in:
@@ -15,7 +15,7 @@ float3 gCameraPosition : CameraPosition;
|
||||
bool gUseNormal : UseNormal;
|
||||
|
||||
|
||||
static const float3 gAmbient = float3(.03f, .03f, .03f);
|
||||
static const float3 gAmbient = float3(.025f, .025f, .025f);
|
||||
static const float gLightIntensity = 7.f;
|
||||
static const float PI = 3.14159f;
|
||||
static const float gSpecularReflectance = 1.f;
|
||||
@@ -61,6 +61,7 @@ VS_OUTPUT VS(VS_INPUT input){
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
float3 Phong(float ks, float exp, float3 l, float3 v, float3 n)
|
||||
{
|
||||
float3 reflected = reflect(l, n);
|
||||
@@ -92,8 +93,8 @@ float3 Shade(VS_OUTPUT input)
|
||||
float3x3 tangentSpaceAxis = float3x3(input.Tangent, binormal, input.Normal);
|
||||
|
||||
// Sample and transform normal map
|
||||
normal = float3(2.f * normalSample.x - 1.f,
|
||||
2.f * normalSample.y - 1.f,
|
||||
normal = float3(2.f * normalSample.x - 1.f,
|
||||
2.f * normalSample.y - 1.f,
|
||||
2.f * normalSample.z - 1.f);
|
||||
normal = mul(normal, tangentSpaceAxis);
|
||||
}
|
||||
@@ -110,15 +111,15 @@ float3 Shade(VS_OUTPUT input)
|
||||
float3 observedArea = float3(cosAngle, cosAngle, cosAngle);
|
||||
|
||||
// Combine lighting components
|
||||
float3 color = saturate(diffuse * observedArea + specular + gAmbient * cosAngle);
|
||||
float3 color = saturate((diffuse + specular + gAmbient) * observedArea);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
float4 PS(VS_OUTPUT input) : SV_TARGET{
|
||||
|
||||
float4 PS(VS_OUTPUT input) : SV_TARGET {
|
||||
return float4(Shade(input), 1.f);
|
||||
}
|
||||
|
||||
DepthStencilState gDepthStencilState
|
||||
{
|
||||
//enable
|
||||
@@ -133,6 +134,7 @@ DepthStencilState gDepthStencilState
|
||||
technique11 DefaultTechnique{
|
||||
pass P0 {
|
||||
SetDepthStencilState(gDepthStencilState, 0);
|
||||
SetRasterizerState(gRasterizerState);
|
||||
SetVertexShader( CompileShader( vs_5_0, VS() ) );
|
||||
SetGeometryShader( NULL );
|
||||
SetPixelShader( CompileShader( ps_5_0, PS() ) );
|
||||
|
||||
Reference in New Issue
Block a user