   HLSL Ambient Light Washes Out Texture
  I've been trying to wrap my head around Pixel Shaders and I'm at a point where I understand the logistics of the code but I've run into a problem with the ambient light value. When the "AmbientLightColor" is set to anything other than black it washes out the texture of the cube where the point light is hitting the surface. The side's and back's textures don't even show up, only the ambient color that is set is visible. The shader is a Phong reflection shader using a point light source and my question is: do I need to do another pass to add ambient light or is my shader calculating incorrectly?Here is the shader code:float4 PixelShaderFunctionWithTex(VertexShaderOutput input) : COLOR0{   // Get light direction for this fragment  float3 lightDir = normalize(input.WorldPos - LightPosition); // per pixel diffuse lighting  // Note: Non-uniform scaling not supported  float diffuseLighting = saturate(dot(input.Normal, -lightDir));  // Introduce fall-off of light intensity  diffuseLighting *= (LightDistanceSquared / dot(LightPosition - input.WorldPos, LightPosition - input.WorldPos));  // Using Blinn half angle modification for perofrmance over correctness  float3 h = normalize(normalize(CameraPos - input.WorldPos) - lightDir);  float specLighting = pow(saturate(dot(h, input.Normal)), SpecularPower);  float4 texel = tex2D(texsampler, input.TexCoords);  return float4(saturate(    AmbientLightColor +    (texel.xyz * DiffuseColor * LightDiffuseColor * diffuseLighting * 0.6) + // Use light diffuse vector as intensity multiplier    (SpecularColor * LightSpecularColor * specLighting * 0.5) // Use light specular vector as intensity multiplier    ), texel.w);  }Images to help explain my delima:In both images the point light is sitting right infront of the cube mesh.The first image shows the ambient light at almost white. You can see the texture doesn't shine through. In the second image the ambient light is set to dark gray (the color of the left side of the cube). You can see that when the ambient light is dark, the texture shines through but only where the point light shines on it. What I was shooting for was a bright light on the texture from the point light and the ambient light to affect the other sides that are not hit by the point light. Do I need to do another pass to add ambient light or is my shader calculating incorrectly?Thanks,Deeg
  Try this:return float4(saturate((texel.xyz * ( AmbientLightColor + DiffuseColor * LightDiffuseColor * diffuseLighting ) * 0.6) + // Use light diffuse vector as intensity multiplier(SpecularColor * LightSpecularColor * specLighting * 0.5) // Use light specular vector as intensity multiplier), texel.w);;  deathkrush you are the man! Thanks for your help. Now I need to understand what you've done here. You added the ambient to the diffuse before multiplying it to the pixel? Before I was adding it after my light claculations.Thanks again...   