mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
ifcviewer: edge enhancement post-pass
Adds a per-frame depth-laplacian pass that darkens pixels at sharp depth discontinuities — silhouettes, overlapping-surface boundaries, section-cut edges. Catches the wall-against-wall and slab-against- ceiling cases that the cavity hint in the lighting shader misses. Implementation: - New edge_depth_fbo_ / edge_depth_tex_ — single-sample D24S8 the size of the window. After the main draw, blit the default FB depth into it (handles MSAA resolve in the same call). - Fullscreen triangle generated from gl_VertexID, samples four cardinal neighbours, computes |4c - n - s - e - w| on linearized depth. Linearization branches between perspective and ortho via u_is_ortho. Threshold scales with depth so distant edges still register. - Output is multiplicatively blended (GL_DST_COLOR, GL_ZERO) so colours just darken; no separate composite step. - Runs before the pivot/section/axis gizmos so they aren't outlined themselves. HiZ pyramid build still runs after, unchanged. Per-frame cost is one MSAA depth blit + one fullscreen pass with five depth samples. Sub-millisecond at 1080p on a mid GPU. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -289,6 +289,11 @@ private:
|
||||
void renderPivotIndicator();
|
||||
void renderSectionPlanes();
|
||||
void buildSectionPlaneGizmo();
|
||||
// Post-process edge enhancement: resolve MSAA depth into a single-
|
||||
// sample texture, then run a fullscreen pass that detects sharp
|
||||
// depth-laplacian peaks and darkens the colour buffer there. Catches
|
||||
// silhouettes and overlapping-surface boundaries as faint dark lines.
|
||||
void renderEdgePass();
|
||||
// Returns the index of the section plane whose arrow gizmo is under
|
||||
// (x, y), or -1 if none. Screen-space line-segment distance test.
|
||||
int hitTestSectionGizmo(int x, int y) const;
|
||||
@@ -548,6 +553,16 @@ private:
|
||||
int plane_arrow_offset_ = 0;
|
||||
int plane_arrow_count_ = 0;
|
||||
|
||||
// Edge-enhancement pass resources. edge_depth_tex_ is a single-sample
|
||||
// resolve target the size of the window; we blit the default FB depth
|
||||
// into it each frame, then sample it from the fullscreen edge shader.
|
||||
GLuint edge_program_ = 0;
|
||||
GLuint edge_depth_fbo_ = 0;
|
||||
GLuint edge_depth_tex_ = 0;
|
||||
GLuint edge_vao_ = 0; // empty VAO for fullscreen-triangle draw
|
||||
int edge_w_ = 0;
|
||||
int edge_h_ = 0;
|
||||
|
||||
// FPS smoothing
|
||||
int frame_count_ = 0;
|
||||
float accumulated_time_ = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user