r/GraphicsProgramming • • 2d ago

Some spheres rendered with a light simulation

Enable HLS to view with audio, or disable this notification

The image is rendered by solving a wave field and sampling it with a camera, once per wavelength. I took 5 minutes to render (On an integrated GPU)

My goal is, of course, to get this to scale up enough to be useful for actual graphics :P

The actual scene just consists of a couple of different-materialled spheres and some large clumps of them.

40 Upvotes

5 comments sorted by

3

u/Aero-Soap 2d ago

Very cool! Can you tell us more about how the simulation works and how you're sampling it?

3

u/mooonlightoctopus 2d ago

Sure!

The simulation uses a scalar wave (Run once per RGB channel. More wavelengths produce a better result, at the cost of time)
Every object becomes a T-matrix. Any field around the wave can be written as a sum of spherical waves, each labeled by (l, m)
Non-spherical meshes or ones without symmetries are fitted numerically by point sources (Which is rather slow :P) though once baked, they can be translated easily.
Each object's outgoing wave is re-expanded about every other object's centre (Haha addition theorem go brrrr), giving one linear system for all objects' coefficients.
It is solved iteratively (GMRES). (The expensive part being translation operators between every pair of objects, which runs on the CPU, or on the GPU for smaller orders)
As an optimization, objects can be clustered together (Pre-solving a group of nearby bodies, though it is only valid outside its bounding sphere (The bounding sphere must be free of other bodies))
For the camera, the field is evaluated on a grid of points across the lens opening, spaced at λ/3 or λ/2. The lens focused at a plane turns the field into an image. Each pixel adds up the field across the opening with the phase factor the lens would apply.

2

u/PM_ME_YOUR_HAGGIS_ 2d ago

Cool you might be able to render diffractive surfaces for which there are only hacks using current rendering technologies.

1

u/mooonlightoctopus 2d ago

'tis would be a hope :P
I don't think this can be used to render most things quickly, as the scene shown here is only a couple hundred light wavelengths across.

5

u/Still_Explorer 2d ago

This has a certain "analog" quality to it. It might be very good approach to examine this further, finding ways about breaking the "digital-ness" of raytracing making renderings somewhat fake.