Added more models
Fixed issue with material only parts of meshs not being rendered
This commit is contained in:
@ -10,7 +10,8 @@ cbuffer ConstantBuffer
|
||||
float4 specularCoefficient; // The specular reflection cooefficient
|
||||
float shininess; // The shininess factor
|
||||
float opacity; // The opacity (transparency) of the material. 0 = fully transparent, 1 = fully opaque
|
||||
float2 padding;
|
||||
float validTexture;
|
||||
float padding;
|
||||
}
|
||||
|
||||
Texture2D Texture;
|
||||
@ -60,8 +61,18 @@ float4 PShader(PixelShaderInput input) : SV_TARGET
|
||||
// Calculate ambient lighting
|
||||
float4 ambientLight = ambientColor * diffuseCoefficient;
|
||||
|
||||
// Combine all components
|
||||
float4 color = saturate((ambientLight + diffuse + specular) * Texture.Sample(ss, input.TexCoord));
|
||||
// Combine all components
|
||||
float4 color;
|
||||
// Check if the texture is valid before trying to sample it, some meshes use materials to color them and dont export an image texture file even though the color value is stored with the vertex
|
||||
if (validTexture == 1)
|
||||
{
|
||||
color = saturate((ambientLight + diffuse + specular) * Texture.Sample(ss, input.TexCoord));
|
||||
}
|
||||
else
|
||||
{
|
||||
color = saturate((ambientLight + diffuse + specular) * float4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
if (opacity < 1.0f)
|
||||
{
|
||||
color.a = opacity;
|
||||
|
Reference in New Issue
Block a user