{
  "id": 10017826,
  "title": "A Hexagonal Aperture Would Break Every Diffuse Surface in My Renderer",
  "url": "https://urgent.news/2026/09/26/a-hexagonal-aperture-would-break-every-diffuse-surface-in-my-renderer",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-26T16:28:46.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/ibukunsanni/a-hexagonal-aperture-would-break-every-diffuse-surface-in-my-renderer-3874"
  },
  "original_language": "en",
  "account": "My experiments with raytracing have led me to implement defocus blur, which produced bokeh-like images resembling those found in photographs. To test the effect, I used two passes of the same scene, one with a circular aperture and the other with a hexagonal one. The process involved rejection-sampling a square until a point fell within the unit disk, which was the reason behind the circular shape.\n\nUpon noticing that every diffuse surface in my renderer suffered when I switched to a hexagonal aperture, I decided to modify the code. I replaced the rejection test with a new one that checked for points inside a regular hexagon inscribed within the unit circle. The hexagon had its corners at the radius of one, with flat edges at the apothem (sqrt(3)/2 ≈ 0.866). The modified code introduced new checks to ensure the sampled points fit within the hexagonal shape.\n\nBoth the lens sampler and the diffuse BSDF wrapper relied on this unit disk sampler, which led me to question why these components were coupled. The lens and BSDF both relied on a point inside a unit disk; however, when I altered the hexagonal aperture, the diffuse surfaces suffered. This made me wonder if the coupling between the lens and BSDF was necessary or if it was simply a result of testing.",
  "summary": "I have experimented with a lot of features on my raytracing journey. I played with reflections, implemented shadows, and lost braincells getting scenes to render. Finally, I implemented defocus blur. My defocus blur, focused on the near plane The image reminded me of the bokeh you see in photos. Sometimes they aren't always round. Not a render. Photo from \"Bokeh Effect in Photography: A Guide to…",
  "key_points": [
    "Hexagonal aperture causes diffuse surfaces to suffer.",
    "Rejection test replaced with new check for hexagon.",
    "Coupling between lens and BSDF questioned."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}