Skip to content

backface culling#204

Merged
koide3 merged 4 commits into
masterfrom
culling
Jun 13, 2026
Merged

backface culling#204
koide3 merged 4 commits into
masterfrom
culling

Conversation

@koide3

@koide3 koide3 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a user-toggleable “backface culling” feature to the LightViewer pipeline, exposed through C++ (sync/async) and the Python bindings, and implemented in the default rainbow shader via fragment discards based on view-space normals.

Changes:

  • Expose enable_backface_culling(), disable_backface_culling(), and backface_culling_enabled() on LightViewerContext (plus async wrappers) and bind them to Python.
  • Add a GLCanvas flag, plumbing it into the shader uniform backface_culling_enabled.
  • Update rainbow.vert/.frag to compute a view-space normal and discard fragments deemed back-facing when the feature is enabled.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/python/guik.cpp Adds Python bindings for backface-culling toggles/query on LightViewerContext.
src/guik/viewer/light_viewer_context.cpp Implements LightViewerContext backface-culling toggles/query by delegating to GLCanvas.
src/guik/viewer/async_light_viewer_context.cpp Adds async invocations for partial rendering + backface-culling toggles.
src/guik/gl_canvas.cpp Stores backface-culling state and forwards it to shaders via a uniform.
include/guik/viewer/light_viewer_context.hpp Declares the new LightViewerContext backface-culling API.
include/guik/viewer/async_light_viewer_context.hpp Declares async backface-culling + partial-rendering API.
include/guik/gl_canvas.hpp Declares GLCanvas backface-culling API/state.
data/shader/rainbow.vert Computes view-space normal when backface culling is enabled.
data/shader/rainbow.frag Discards fragments based on the view-space normal when enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread data/shader/rainbow.vert Outdated
Comment on lines +88 to +92
if (backface_culling_enabled && length(frag_normal) > 0.1) {
frag_normal_view = normalize((view_matrix * vec4(frag_normal, 0.0)).xyz);
} else {
frag_normal_view = vec3(0.0, 0.0, 0.0);
}
@koide3 koide3 merged commit 9ebb93a into master Jun 13, 2026
10 checks passed
@koide3 koide3 deleted the culling branch June 13, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants