Duplicate faces when rendering HL1 BSP map? Created 3 years ago2021-06-13 18:44:55 UTC by kalenclark kalenclark

Created 3 years ago2021-06-13 18:44:55 UTC by kalenclark kalenclark

Posted 3 years ago2021-06-13 18:44:55 UTC Post #345698
I have been working on rendering a simple map for a couple of days and I encountered this problem,
tried figuring out what causing this problem but failed, please help me :(

THE PROBLEM:
Some vertices are running loop twice ( duplicate quad )
https://drive.google.com/file/d/18omWDEi2jYlKgo7ZnW4_eArVKrLARi20/view?usp=sharing

The map to render and RenderDoc file for diagnose:
https://drive.google.com/drive/folders/1R_7hqJh4XbmYSDQzMEid5R32jfTIP7Mt?usp=sharing

The code for getting vertex ids for rendering:
// m_pXXX - Pointer to specific lump data
for (size_t i = 0; i < m_FaceNum; ++i)
{
    for (size_t j = 0; j < m_pFaces[i].edgeNum; ++j)
    {
        Int32 edgeID = m_pSurfaceEdge[m_pFaces[i].firstEdgeId + j];

        if (edgeID > 0)
            IDs.push_back(m_pEdges[edgeID].first);
        else
            IDs.push_back(m_pEdges[-edgeID].second);
    }
}
Posted 3 years ago2021-06-13 22:41:36 UTC Post #345699
That's due to how sky brushes are compiled - it's not a bug in your code. Apparently sky brush surfaces are turned into double-sided faces - which is why several faces in your map are on opposite sides of the same plane, using the same vertices but in reverse order. Another quirk is that, unlike with other brushes, the tools also produce faces for the 'outside' surfaces of those sky brushes. Maybe there's a good reason for this behavior, I'm not sure.
Posted 3 years ago2021-06-14 05:56:30 UTC Post #345700
Maybe I'll still need to figure out its render mechanism,
thx for your reply~
You must be logged in to post a response.