Title: A Question about the Menger fractal Post by: Imagyx on May 19, 2016, 12:26:26 PM Hi there :)
I'd like to know if it's possible to have the menger sponge with a low number of "holes" but sharp edges? In my image there's maxIterM = 3 because I don't want more holes in it. The problem is, that all "boxes" look like balls rather. Threshold, number of rays etc. is fine. I think I need to work with abs() instead of sqrt() here, but some experiments I made failed... The following code is from a thread in this forum from some years ago. I only changed the syntax to fit java. Code: void DE(V3D w0) {I think this relates to the sierpinsky triangle as well. I don't have sharp edges there either for a low iteration count. But I want them so bad :sad1: Thanks in advance for any help :) Code: void DE(V3D p) {Title: Re: A Question about the Menger fractal Post by: claude on May 19, 2016, 02:17:58 PM Hi!
Here's a DE function implemented in GLSL for a cube made out of the intersection of 6 planes: Code: float plane(vec3 normal, float d, vec3 p) {This should replace your "dist = (Math.sqrt(...)-2)". Might need some tweaks for cube size and origin. Your current dist is for a sphere. Title: Re: A Question about the Menger fractal Post by: Imagyx on May 19, 2016, 04:11:51 PM Thank you claude :)
This means cutting the spheres which were there by 6 planes,leaving cubes behind, right ? It looks fine for the first two but gets really noisy with higher iteration counts and I don't know why. I cannot tweak it with threshold or number of raysteps... Cube size and origin seem fine. So what else could be the problem there ? Title: Re: A Question about the Menger fractal Post by: claude on May 19, 2016, 06:18:16 PM It's more replacing the spheres with cubes rather than cutting.
The noise looks like aliasing from the high-frequency content, try supersampling (or rendering bigger and downscaling). Title: Re: A Question about the Menger fractal Post by: Imagyx on May 20, 2016, 10:24:14 AM Im not sure if there's not still something wrong in the process itself, anything I need to change in the code... Because if you look at the second image in the lower center, therefore a place nearest to the camera, there's some noise as well, that isn't appearing in the left, right or top parts of the "sponge". I'll experiment a bit more, hopefully with better results :dink: |