Hi lolz123 -
That's wonderful news! Thanks for revisiting LTBL, and thanks again to eXpl0it3r for helping out as well.
A couple quick notes I have from working with LTBL1, in case it helps with LTBL2.
1. Transparent hulls visible seam:
When you use transparent hulls, you can see a visible seam between the main umbra and the shadow fins. I'm pretty sure I tracked this down to being a problem of the fin tris (created by function MaskShadow) overlapping with the main umbra created in that same function. The overlap results in the dark seam due to rendering the overlapping alpha-blended geometry.
Transparent hulls are a pretty important feature, as without them the shadows appear completely black, rather than using the ambient color. So I ended up using hull transparency to work around this.
2. Static QuadTree crash:
There was a crash associated with the Static QuadTree related to these functions:
StaticQuadTree::StaticQuadTree(const AABB &rootRegion)
: m_created(false)
{
m_pRootNode.reset(new QuadTreeNode(rootRegion, 0));
m_created = true;
}
void StaticQuadTree::Create(const AABB &rootRegion)
{
m_pRootNode.reset(new QuadTreeNode(rootRegion, 0));
m_created = true;
}
There are two versions of the QuadTreeNode constructor. The one used above does not pass in a QuadTree pointer. So the root node of the StaticQuadTree has an uninitialized m_pQuadTree pointer.
This causes a crash later when Update is called on the StaticQuadTree's root node.
My solution was to change the above code to:
StaticQuadTree::StaticQuadTree(const AABB &rootRegion)
: m_created(false)
{
m_pRootNode.reset(new QuadTreeNode(rootRegion, 0, NULL, this));
m_created = true;
}
void StaticQuadTree::Create(const AABB &rootRegion)
{
m_pRootNode.reset(new QuadTreeNode(rootRegion, 0, NULL, this));
m_created = true;
}
3. Offset shadows
If the view dims don't match the screen dims, the shadows are drawn in the wrong place.
This is solved by making this change in LightSystem::SetUp
void LightSystem::SetUp(const AABB ®ion)
{
// Create the quad trees
m_lightTree.Create(region);
m_hullTree.Create(region);
m_emissiveTree.Create(region);
// Base RT size off of window resolution
// *** CHANGE THIS LINE
// sf::Vector2u viewSizeui(m_pWin->getSize());
// *** TO THIS
sf::Vector2u viewSizeui;
// - adding 0.1f for float imprecision so we don't round down to the lower unsigned int.
viewSizeui.x = (unsigned int)(m_viewAABB.GetDims().x + 0.1f);
viewSizeui.y = (unsigned int)(m_viewAABB.GetDims().y + 0.1f);
For this to work, you must also set the m_viewAABB before setup is called.
4. Window resizing support
LTBL doesn't handle window resizing. It would need to hook into the resize event, and recreate the m_compositionTexture at the appropriate size. I believe this is also necessary for view size changes.
______
I very much appreciate the work you've done with LTBL.