Programming 3D and RayTracing
From Ultrafractal Wiki
I'd like to turn the standard Mandelbrot (or any fractal for that matter) into a 3d "terrain" or "elevation" map with bailout values determining the value on the Z axis. I've seen how you can project a fractal onto a plane in 3D but given the constraints of the code it doesn't seem possible to me to have a the position of the pixel (rather than just its color) correlate to its bailout value. Does anyone have any thoughts on the matter. Additionally, are they any good tutorials to get started with ray tracing and 3D in UF?
Gratefully,
Hari Karam Singh
***
Concerning heightfields, as in what the old Fractint does, it is certainly possible to program a coloring formula that will do what you are looking for. Such a formula may already exist in the formula database, although I am not aware of it. You would need to work in 3D (pixel position and height value) and then project the 3D positions back onto the screen for coloring.
Ron Barnett
***
Thanks for the reply Ron.
It seemed to me, that in order to make a 3d map with the coloring formulas, you'd need access to another pixel's bailout than the one you have in pixel and bailout (or whatever the variables are). Given the 3d rotation of the plane of viewing needed to see the height, the pixel on the screen to which you'd be assigning the color no longer represents the one in the fractal whose value is being calculated (it represents the one resulting from the projection of the 3d plane of the fractal onto the viewing plane), thus you'd need to redo the iterative algorithm in the color formula unless you can access and assign other pixels' values. Does that sound right?
Alternatively, I thought maybe you could do it with a mapping transform but I couldn't find a way to access a pixel's bailout value from within these formulas...
Is it commonplace to recreate the fractal algorithm again in the coloring formula? Or is there a way to access another pixel's bailout value and other data from within the coloring formula?
Gratefully, Hari Karam
***
If you want a way to display a height field without all the complications of raytracing, try the painters algorithm, which is what I think Fractint does.
Ron Barnett
***
Hi Hari,
At the moment the various 3D formulas solve the problem of needing to know the values from adjacent pixels in one of two ways:
1. For every pixel calculated in the formula also calculate for at least two adjacent pixels. or 2. Render the entire view to an image buffer (either integer array or float array or arrays or screen image buffer(color array)) in the global section.
Method 1 is not optimum because you usually end up doing say 3 times as much calculation as normal, however if you're ray-tracing then once you have the coordinate of the main pixel you can restrict the checking of adjacent rays to ray-segments close to the main pixel.
Method 2 is more optimum in terms of amount of calculation but has the drawback that maximum image size is restricted by the available memory (with an absolute maximum of 2GB for an image array) also it does not lend itself well to disk rendering and is no good at all for network rendering.
bye Dave
