Advertisement

Normals are not correct, causing issues with shading

Started by March 29, 2020 08:49 AM
1 comment, last by fleabay 4 years, 7 months ago

This is my model, if the light gets a color for example red then the white parts become red, the texture isn't visible cus it takes the color of the light or its black.

When i display only my normals they look like in the above image and I'm guessing they are not correct, I have tried to flip them ny switching the z coordinate with the y coordinate, I have also tried to invert them by putting a minus in front of the normal, or only the z axis or only the y axis but the problem still remains.

I'm in c++ directX but if you know openGL I'm sure that could help too.

There could also be something wrong with my specular calculation, it looks like this:

}//SPECULAR

//POINTLightDirection points TOWARDS GEOMETRY

float3 r = reflect(-pointlightdirection.xyz, input.normal);

//POINT TOWARDS VIEWER

float3 v = normalize(cameraposition.xyz - pointlightposition.xyz);



float4 specularpointlight = float4(0, 0, 0, 0);



if (diffuseFactor > 0)

{

 specularpointlight = ((pointlight * specularproperties) * pow(saturate(dot(r, v)), intensities.x)) * attenuationFactor;

Does the model have correct UV's?

It looks like maybe you are using object space normals. Tangent space normals are most likely what you want.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

This topic is closed to new replies.

Advertisement