Quote:Original post by remigius
It looks like you're using your light as a Point light, since you're using the light's coordinates to set up your light vector. If your light is indeed a point light, you should change the W component (the 4th one) of the light vector you pass into Matrix.Shadow(..) to 1, like this:Dim LightPosition As New Vector4(.Lights(0).XPosition, .Lights(0).YPosition, .Lights(0).ZPosition, 1)
A W component of 0 indicates a directional light, whereas a W value of 1 indicates a point light. If your light is a directional light, it doesn't really have a position and you'll have to supply a vector describing the xyz directions of the light to the Matrix.Shadow(..) method.
I hope this helps, as I can see nothing else wrong with your code.
Thanks it does but it isn't quite right. When I rotate cube the shadow rotates with it like a beacon of light. The shadow should simply stay put but obviously change it's shape as the faces of the cube that face the light change. If I move the multiply before the shadow calulation it doesn't move at all?
i.e.
shadow doesnt rotate