Skip to main content
deleted 76 characters in body
Source Link

By looking at your code it seems that you are already rotating your object. The world matrix is a term used to describe the total transformation that you are applying to whatever you draw after that assignment. In order to "rotate the world", you'd have to change the position of your camera to follow a circular path for example. But by setting a rotation matrix as the World matrix of an effect, you are applying it to whatever is rendered with that effect activated.

The spotlightEdit You should rotate only if somehow its position changes. Innot normalise your code you are using lightDirection andobject's position (lightDirinput.Position3D) as it is a point, not a vector. As lightDirection appears to be constantYou should normalise the result, I guess your issue must be somewhere in your vertex shaderi. How are you computinge.: input.lightDir?normalize(input.Position3D - lightPoint);

By looking at your code it seems that you are already rotating your object. The world matrix is a term used to describe the total transformation that you are applying to whatever you draw after that assignment. In order to "rotate the world", you'd have to change the position of your camera to follow a circular path for example. But by setting a rotation matrix as the World matrix of an effect, you are applying it to whatever is rendered with that effect activated.

The spotlight should rotate only if somehow its position changes. In your code you are using lightDirection and lightDir. As lightDirection appears to be constant, I guess your issue must be somewhere in your vertex shader. How are you computing input.lightDir?

By looking at your code it seems that you are already rotating your object. The world matrix is a term used to describe the total transformation that you are applying to whatever you draw after that assignment. In order to "rotate the world", you'd have to change the position of your camera to follow a circular path for example. But by setting a rotation matrix as the World matrix of an effect, you are applying it to whatever is rendered with that effect activated.

Edit You should not normalise your object's position (input.Position3D) as it is a point, not a vector. You should normalise the result, i.e.: normalize(input.Position3D - lightPoint);

Source Link

By looking at your code it seems that you are already rotating your object. The world matrix is a term used to describe the total transformation that you are applying to whatever you draw after that assignment. In order to "rotate the world", you'd have to change the position of your camera to follow a circular path for example. But by setting a rotation matrix as the World matrix of an effect, you are applying it to whatever is rendered with that effect activated.

The spotlight should rotate only if somehow its position changes. In your code you are using lightDirection and lightDir. As lightDirection appears to be constant, I guess your issue must be somewhere in your vertex shader. How are you computing input.lightDir?