Urgent.News

What's breaking now, across thousands of outlets.

Tech

A Hexagonal Aperture Would Break Every Diffuse Surface in My Renderer

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…

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.

Upon 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.

Both 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.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Engine Is Finally Becoming an Engine

There's a strange moment in framework development when the individual pieces start becoming something larger. You spend months building libraries. You design APIs. You work on configuration.

  • KiwiEngine embodies an engine, not just libraries
  • WebEngine as nexus for standard lifecycle and integration patterns
  • Kiwi CLI streamlines project creation and application building

More from Saturday 26 September →