Thanks for answering GClements,
- Are you applying the same transformation for both passes?
Yes, as you can see in the pseudocode below.
- Are you applying the transformation to the model-view matrix (in both cases)?
Yes, as you can see in the pseudocode below.
- In the second pass, you have to transform the vertices to both the light space (to determine the coordinates for the shadow map lookup) and the camera space; is the transformation being applied to both?
I’m not sure about this. I’m only doing what you see in the pseudocode below. Maybe this is my problem?
- Is the transformation being taken into account when computing the bounds of the shadow map? Or is it pushing the object outside of those bounds?
I’m not sure about this. I’m only doing what you see in the pseudocode below. Maybe this is my problem?
Here are some additional details about the problem. I don’t know if it makes any difference but we are using: https://developer.nvidia.com/gpugems/gpugems3/part-ii-light-and-shadows/chapter-10-parallel-split-shadow-maps-programmable-gpus
Pseudocode
Custom Mesh class:
class MyMesh : Mesh
{
public Transformation t = new Identity();
public MyMesh(Point3D[] vertices, Triangle[] triangles) : base(vertices, triangles)
{
}
protected override void Draw(Params data)
{
data.RenderContext.PushModelView();
data.RenderContext.MultMatrixModelView(t);
base.Render(data);
data.RenderContext.PopModelView();
}
protected override void DrawForShadow(Params data)
{
data.RenderContext.PushModelView();
data.RenderContext.MultMatrixModelView(t);
base.DrawForShadow(data);
data.RenderContext.PopModelView();
}
protected override void DrawEdges(Params data)
{
data.RenderContext.PushModelView();
data.RenderContext.MultMatrixModelView(t);
base.DrawEdges(data);
data.RenderContext.PopModelView();
}
}
Scene objects setup:
MyMesh m = MyMesh.CreateBox(100, 200, 200);
m.t = new Translation(0, 20, -10) * new Rotation(PI/10, xAxis);
scene.Add(m, Aquamarine);
Mesh m1 = Mesh.CreateCylinder(40, 100, 16);
m1.Translate(-20,-40,0);
scene.Add(m1, Orange);
Image 1) ‘t’ is identity

Image 2) ‘t’ is a roto-translation transformation. The arrow indicates the wrong shadow map.
