Title: Escape From The Mandelbox Post by: sbowline on January 05, 2014, 04:37:47 AM Hi, all, this is my first posting. I've been writing some toy code for doing a voxel based renders of mandelboxes and am a bit confused about some things. Maybe some of you can help. The point of this exercise is to test and explore some fractal parameters in mandelbulber and then render my own voxels with the settings. First of all, I'm not sure I'm varying the constant across the domain properly. At first I was voxelizing across the cube domain -1,1 but wasn't getting anything near a match to what mandelbulber would compute. Setting the limits in mandelbulber to the cube -4,4 and voxelizing my domain accordingly seems to work pretty well. But this fractal doesn't behave like I was expecting (e.g. a kind of zoom) so narrowing the domain may not be doing what I assumed it would. Second, it's not clear to me how the termination condition and the colorization relate. I would normally assume that if the function did not diverge over the course of the iterations that the voxel was "in the set" and could be rendered, say, black. For the mandelbox I can get an entire volume of interesting iteration counts, but I'm not sure at all what would constitute a void or black voxel. Any help or suggestions are welcome! Here's a code fragment that might explain a little better than my words: C = (x*8.0 / DimX - 4.0, y*8.0 / DimY - 4.0, z*8.0 / DimZ - 4.0) Z = (0, 0, 0) r = 0. while r<1024. and iterations < 16: Z = boxFold (Z) Z = ballFold (Z) Z = compAdd (scalarMult (scale, Z), C) r = magnitude (Z) iterations = iterations + 1 if iterations<16: return iterations return 0 |