Welcome to Fractal Forums

Community => Meet & Greet => Topic started by: Derakon on November 24, 2009, 11:03:14 PM




Title: Yet another new person
Post by: Derakon on November 24, 2009, 11:03:14 PM
Hello! I'm here from Daniel White's (http://www.skytopia.com/project/fractal/mandelbulb.html) article on mandelbulbs, which seems to be getting a lot of traffic lately. I've always appreciated fractals aesthetically, but the furthest I've gone with making them myself was making a simple colorized 2D Mandelbrot. However, these 3D fractals are something else again, and they're enough to inspire me to come here and take a look around. My own focus is in general software development; I'm good at a lot of things but not great at anything, basically. So I'm pretty sure I understand broadly how fractals work, but I could be wrong. :)

I've seen the massive thread on 3D fractals (http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/) but haven't gotten around to reading it yet. Am I correct in my understanding that these fractals are generated by doing an inclusion/exclusion test for each 3D point in a given area, and generating a voxel if the point is in the volume? And then you get more detail by decreasing the distance between 3D points and/or increasing the number of iterations for each point.

My idea was to try to write a script for Blender (a 3D modeling program I use) to generate models of the fractals. This would make flybys trivial, and Blender has plenty of support for near material effects, though dynamically increasing zoom levels would be difficult. If you make a cube for each voxel, and then combine the cubes and remove interior faces, you can apply smoothing to create "landscapes" which should theoretically be amenable to inclusion in other 3D projects.

My second, impractical-due-to-cost idea was to make a 3D model of a fractal, and then find a 3D printing service to make a model that I could put on my desk. Painting it might be a bit tricky, though. :)

My third, impractical-due-to-time idea was to make a roguelike game set on a fractal, where the game gets more difficult as you increase your zoom level. That of course runs into problems like "how should equipment and enemies be fractal" but it's a neat concept to think of.


Title: Re: Yet another new person
Post by: cKleinhuis on November 24, 2009, 11:59:15 PM
welcome to the forum

basically you got the idea right ... create voxels for inside and do not create voxels for outside ... the main problem is to get it "really" smooth, and doing it by a scripting language could take ages for a simple model .. when you are using a distance estimator it is most likely to get a smoothed surface ... but still there is a lot of work for determining the right normals for the faces ...

enjoy your stay and inspire us !
 :angel1: O0


Title: Re: Yet another new person
Post by: Derakon on November 25, 2009, 12:30:09 AM
Yeah, I know scripting languages can be slow. Awhile back I wrote a dumb Perl script (http://derakon.dyndns.org/~chriswei/temp/mandelbrotscript.txt) to generate 2D Mandelbrot images; at 800x800 with 10 iterations per pixel it took 17 seconds on my computer.

Fortunately, there's a trick you can use with Python (which is the scripting language that Blender uses) to compile it to much faster code without losing the beauty of scripting languages. It's called Cython; basically it's just Python with predeclared types. I have a game project I'm working on that was running slowly during map generation; when I switched the vector class over to Cython I got a 35% speedup of the entire program -- I don't know how much faster the vector class itself got because it stopped showing up in my profiling reports. :)

For the 3D voxels -- do you try to create a 3D shell, or do you "fill" the interior with voxels? If the former, how do you detect if a given voxel is on the border? By examining the adjacencies? If the latter, how did Daniel White make his "inside the fractal" shots?

EDIT: did a bit more research, I'm guessing you create a 3D shell using something like the marching cubes algorithm. Fine by me; I've used marching squares in the past for 2D...


Title: Re: Yet another new person
Post by: Derakon on November 26, 2009, 06:38:13 PM
Whelp, I've written a Python script to make meshes of 3D fractals...and it's a bit limited. The big problem is that I have to calculate every single voxel in the volume I want to draw, even if it's going to be hidden from view from the camera's perspective. This puts a big limit on voxel size; I can't push it down small enough to get acceptable smoothness without generation taking ages (and making a mesh that Blender can't handle very well). The actual render time is great, mind you, but the images I'm getting aren't:

(http://derakon.dyndns.org/~chriswei/temp/3dfractal2.png)
(http://derakon.dyndns.org/~chriswei/temp/3dfractal2b.png)

The banding I'm getting is, I suspect, due to a bug causing the program to generate redundant faces, which confuses Blender's rendering.

This mesh took over 4 hours to generate, and about 45 seconds to render. And it doesn't look all that great. I calculated 27,000,000 voxels in the range ([0, 1], [0, 1], [0, 1]) for the eighth-order Mandelbulb (at least, it should be the eighth-order Mandelbulb; I grant there's not much resemblance...).

I guess the next step is to switch to a direct raytracing approach. Any suggestions for good resources for learning to make your own raytracer? I know there are existing programs for this kind of thing, but that's not really what I'm after here.


Title: Re: Yet another new person
Post by: twinbee on December 04, 2009, 04:53:35 PM
Quote
For the 3D voxels -- do you try to create a 3D shell, or do you "fill" the interior with voxels? If the former, how do you detect if a given voxel is on the border? By examining the adjacencies? If the latter, how did Daniel White make his "inside the fractal" shots?

For my approach, I use the 'shell' approach, yes. To create the inside, I simply reverse the definition of 'inside', so that the inside is the outside and vice versa.


Title: Re: Yet another new person
Post by: kram1032 on December 04, 2009, 08:41:11 PM
twinbee:
could you by that also define the "inside" to only be the hull and the "outside" to be the inside and the outside? - just a strange thought^^

Derakon: I wonder why you don't just use Blender's new voxels?
This I guess is the IDEAL excuse to learn them :)
And it's most likely way faster than using cubes or a single mesh hull...

If you use cubes, I hope, you also use instances?

And while they add more faces to it, maybe spheres would be a better variant?
Or could it work to use planes which point into the direction of the Set at that point?


Title: Re: Yet another new person
Post by: twinbee on December 11, 2009, 09:38:43 PM
Quote
could you by that also define the "inside" to only be the hull and the "outside" to be the inside and the outside?
In theory, I suppose one could yes. You would need to find the surface normal. The inside would then be defined as the volume within a certain distance from the surface point, and at the normal's angle.


Title: Re: Yet another new person
Post by: xenodreambuie on December 12, 2009, 01:06:52 AM
Quote from: Derakon
Whelp, I've written a Python script to make meshes of 3D fractals...and it's a bit limited. The big problem is that I have to calculate every single voxel in the volume I want to draw, even if it's going to be hidden from view from the camera's perspective. This puts a big limit on voxel size; I can't push it down small enough to get acceptable smoothness without generation taking ages (and making a mesh that Blender can't handle very well). The actual render time is great, mind you, but the images I'm getting aren't:

The banding I'm getting is, I suspect, due to a bug causing the program to generate redundant faces, which confuses Blender's rendering.


When you use binary voxels to create a mesh, it results in exactly that kind of banded quantization. The only practical way to improve it is to use a filter on the mesh (or possibly a mesh generation method that has built in relaxation). An ordinary smoothing filter won't do, as it erases detail and shrinks the mesh. Google mesh denoising. Many of the early methods only work well if you have greyscale data, and are crap for binary. Bilateral filtering works well enough, and also two step filters.


Title: Re: Yet another new person
Post by: Nahee_Enterprises on January 06, 2010, 04:20:45 PM
    Hello!  I'm here from Daniel White's (http://www.skytopia.com/project/fractal/mandelbulb.html) article on mandelbulbs.....
    I've always appreciated fractals aesthetically, but the furthest I've gone with making them myself was making a simple colorized 2D Mandelbrot.

    Whelp, I've written a Python script to make meshes of 3D fractals.....
    and it's a bit limited.  The big problem is that I have to calculate every single voxel in the volume I want to draw.....

Greetings, and a belated Welcome to this particular Forum !!!     :D

That is an interesting experiment using Python script to make your 3-D fractals.