0
$\begingroup$

I am writing a program to display 3-dimensional lattices (honeycombs) using raymarching and reflections. I made a simple cubic honeycomb to start. The usual method is to use a repetition operator, by taking the fractional part of the input point before feeding it to some other SDF:

float sceneSDF(vec3 pt) {
    return sdf(fract(pt));
}

I have an example here: Cubic honeycomb

However, for some other 3D lattices, like the rhombic dodecahedral lattice and hexagonal prism lattice, it's very difficult to use simple repetition operators. But, it is possible to achieve the desired effect using reflections. We simply make the faces of the polyhedron reflective, and multiply the reflected color by an "attenuation" value which decreases with each reflection bounce. The exact implementation I use is a bit more elaborate than that, however; that's why I have an example.

I have an example here: Cubic honeycomb using reflections

This achieves the desired effect, however leaves ugly borders between reflected images. I am fairly sure that this is due to the attenuation value being scaled discretely with each bounce, rather than continuously. Is there some sort of interpolation, or another way of remedying this?

$\endgroup$
1
  • $\begingroup$ Antialiasing techniques tend to smooth out reflections nicely as they reducing aliasing. A heavy handed solution to gather multiple samples at a high level would be to turn the "mainImage" function into a new function then write a new "mainImage" that calls the old one with adjusted UV coordinates for the samples, give each sample a weight and average. I did a quick test of this on the shader toy in the link you provided and the results were okay. I did the classic 5 samples evenly weighted. $\endgroup$
    – pmw1234
    Aug 15, 2023 at 15:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.