Skip to content

Add Screen-Space Ambient Occlusion and infinite ground plane support#1

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/add-ssao-and-ground-plane
Draft

Add Screen-Space Ambient Occlusion and infinite ground plane support#1
Copilot wants to merge 5 commits intomasterfrom
copilot/add-ssao-and-ground-plane

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 20, 2026

Implements SSAO using screen-space derivatives for single-pass occlusion and adds support for invisible ground planes that display only AO shadows.

Changes

Shader (shaders/phong_with_wireframe_ssao.frag)

  • Single-pass SSAO using dFdx/dFdy derivatives
  • Circular sampling pattern (configurable 1-16 samples)
  • AO applied only to ambient term, preserving direct lighting
  • GLSL 1.40 compatible (float uniforms, no defaults)

Python API (python/OffscreenRenderer.py)

  • Mesh: conditional SSAO shader loading via use_ssao parameter
  • MeshRenderer.enableSSAO(enabled, radius, bias, samples): global SSAO control
  • MeshRenderer.addInfiniteGroundPlane(z, size, color, only_show_ao): creates large planes displaying AO only
  • Float/boolean conversions for shader uniform compatibility

Build (src/python_bindings/CMakeLists.txt)

  • pybind11 v2.6.1 → v2.11.1 for Python 3.12 compatibility

Example (python/MeshDemo.ipynb)

  • SSAO demonstration with parameter tuning
  • Invisible ground plane demonstration

Usage

renderer = ogl.MeshRenderer(800, 600)
renderer.setMesh(vertices, faces, normals, colors)

# Enable SSAO
renderer.enableSSAO(enabled=True, radius=0.5, bias=0.025, samples=16)

# Add invisible ground plane showing only AO shadows
renderer.addInfiniteGroundPlane(z=0.0, size=1000.0, only_show_ao=True)

renderer.render()
renderer.save('output.png')

Limitations

  • Derivative-based approach provides approximation, not true geometric occlusion
  • No bilateral blur pass (may appear noisy)
  • Maximum 16 samples per fragment

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Implement Screen-Space Ambient Occlusion in this codebase. Add an option to add an infinite invisible ground plane at z=0 that will only display ambient occlusion. Add an example how to enable ssao in MeshDemo.ipynb


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 20, 2026 01:14
Co-authored-by: Roipo <14091463+Roipo@users.noreply.github.com>
Co-authored-by: Roipo <14091463+Roipo@users.noreply.github.com>
Co-authored-by: Roipo <14091463+Roipo@users.noreply.github.com>
…de quality

Co-authored-by: Roipo <14091463+Roipo@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement screen-space ambient occlusion feature Add Screen-Space Ambient Occlusion and infinite ground plane support Jan 20, 2026
Copilot AI requested a review from Roipo January 20, 2026 01:27
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