Here's what it looks like:
https://pasteboard.co/J3m0391.png

Either my shadow map code is off, or my mesh is off in the normals/tangent area. I feel like the tangent is wrong and I don't know much about it.
Here's my triangle generation code:
Code: Select all
void MyTriangleCollector3::processTriangle(btVector3* tris, int partId, int triangleIndex) {
for (int k = 0; k < 3; ++k) {
Vertex v;
btVector3& tri = tris[k];
v.pos = Ogre::Vector3(tri.getX(), tri.getY(), tri.getZ());
v.tex.x = (v.pos.x + mWidth / 2) / mWidth;
v.tex.y = (v.pos.z + mHeight / 2) / mHeight;
btVector3 normal = (tris[0] - tris[1]).cross(tris[0] - tris[2]);
normal.safeNormalize();
v.normal = Ogre::Vector3(normal.getX(), normal.getY(), normal.getZ());
v.tangent = Ogre::Vector3(0,0, 1).crossProduct(v.normal);
mIndicesOut.push_back(mVerticesOut.size());
mVerticesOut.push_back(v);
}
}
If that looks OK, then it must be the shadow code, I got it from the staticshadowmap demo, not sure what I may have missed.