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?