Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualeowdaoc

Posted 08 December 2012 - 08:15 PM

I have a simple model loaded and a point light source that I am trying to get to work correctly, but it's just not happening. I have probably spent around 12 hours over the past two days trying to figure out what is wrong, and I'm starting to get really frustrated, so I thought I would ask here as a last resort.

I have checked and double checked my lighting equation many times with at least 3 different sources. At the moment I am using constant lighting coefficient so that I know for a fact my object will be lit no matter what the distance. My light is EXPLICITLY fixed at the -30.0 position on the Z-axis, yet my object appears as if it is lit from a different direction. My camera is located at ( 0.0, 0.0, -20.0 ) so that I can verify the model is not swallowing the light, and it is not. The light is plenty far away from my model. I've changed the light/camera distance many times and have gotten the same result.

The entire front side of my object should be lit, instead it is lit from a different angle.

I use the DirectXMath library and I was VERY, VERY careful to store the const buffer matrices correctly and with the right alignment. I also made sure my HLSL byte alignment was correct by using float4. I use the row-major compiler options for HLSL so I do not need to use matrix transpose, and my code reflects that.

Please give my code a look and tell me where I've gone wrong, because I obviously cannot figure it out! Posted Image

Bugged lighting:
[attachment=12680:bug.jpg]

Matrix update function:
[attachment=12677:update.jpg]

Vertex shader:
[attachment=12678:vs.jpg]

Pixel shader:
[attachment=12679:ps.jpg]

#2eowdaoc

Posted 08 December 2012 - 08:05 PM

I have a simple model loaded and a point light source that I am trying to get to work correctly, but it's just not happening. I have probably spent around 12 hours over the past two days trying to figure out what is wrong, and I'm starting to get really frustrated, so I thought I would ask here as a last resort.

I have checked and double checked my lighting equation many times with at least 3 different sources. At the moment I am using constant lighting coefficient so that I know for a fact my object will be lit no matter what the distance. My light is EXPLICITLY fixed at the -30.0 position on the Z-axis, yet my object appears as if it is lit from a different direction. My camera is located at ( 0.0, 0.0, -20.0 ) so that I can verify the model is not swallowing the light, and it is not. The light is plenty far away from my model. I've changed the light/camera distance many times and have gotten the same result.

The entire front side of my object should be lit, instead it is lit from a different angle.

I use the DirectXMath library and I was VERY, VERY careful to store the const buffer matrices correctly and with the right alignment. I also made sure my HLSL byte alignment was correct by using float4. I use the row-major compiler options for HLSL so I do not need to use matrix transpose.

Please give my code a look and tell me where I've gone wrong, because I obviously cannot figure it out! Posted Image

Bugged lighting:
[attachment=12680:bug.jpg]

Matrix update function:
[attachment=12677:update.jpg]

Vertex shader:
[attachment=12678:vs.jpg]

Pixel shader:
[attachment=12679:ps.jpg]

#1eowdaoc

Posted 08 December 2012 - 08:03 PM

I have a simple model loaded and a point light source that I am trying to get to work correctly, but it's just not happening. I have probably spent around 12 hours over the past two days trying to figure out what is wrong, and I'm starting to get really frustrated, so I thought I would ask here as a last resort.

I have checked and double checked my lighting equation many times with at least 3 different sources. At the moment I am using constant lighting coefficient so that I know for a fact my object will be lit no matter what the distance. My light is EXPLICITLY fixed at the -30.0 position on the Z-axis, yet my object appears as if it is lit from a different direction. My camera is located at ( 0.0, 0.0, -20.0 ) so there should be an ample amount of room for the light to not be inside of the model. I've changed the light/camera distance many times and have gotten the same result.

The entire sphere of my object should be lit, instead you can obviously see that it is not.

I use the DirectXMath library and I was VERY, VERY careful to store the const buffer matrices correctly and with the right alignment. I also made sure my HLSL byte alignment was correct by using float4. I use the row-major compiler options for HLSL so I do not need to use matrix transpose.

Please give my code a look and tell me where I've gone wrong, because I obviously cannot figure it out! Posted Image

Bugged lighting:
[attachment=12680:bug.jpg]

Matrix update function:
[attachment=12677:update.jpg]

Vertex shader:
[attachment=12678:vs.jpg]

Pixel shader:
[attachment=12679:ps.jpg]

PARTNERS