Logo by reallybigname - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit us on facebook
 
*
Welcome, Guest. Please login or register. March 28, 2024, 10:17:26 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: My Mandelbulb needs Tips  (Read 5839 times)
0 Members and 1 Guest are viewing this topic.
zee
Guest
« on: January 18, 2010, 04:39:19 PM »

Hello,

I'm trying to write a C# program that renders the 3D Mandelbulb but it looks not fine...
I hope you can give me some hints to advance my program. I wrote an own ray-tracing code with calculating shadows. But you can see that I have some problems and I don't why it looks so bad... My target will be to generate a picture like http://www.skytopia.com/project/fractal/new/q85/mandelbulb-small.jpg or http://www.skytopia.com/project/fractal/new/q85/Power8side-small.jpg

I see some problem sources:

- The Mandelbulb Object is too rough (I use 400³-800³ voxels for the 400² pixels)
- The normals are wrong or bad calculated
- The lighting is wrong (I use the dot product of the normal vector and vector of the ray to the light source)
- There are only effects missing?

Can you tell me what's right and where are sources of errors or something is missing?


* raytracing1.png (126.87 KB, 398x398 - viewed 1001 times.)
« Last Edit: January 18, 2010, 04:40:50 PM by zee » Logged
zee
Guest
« Reply #1 on: January 18, 2010, 07:54:03 PM »

Or maybe I have problems in calculating the Mandelbulb? In this render I use:

infinity = 8
zero = 0.0001
max iterations = 50

There is some antialiasing to flatten the surface and I added some specularity but dont know if its right...


* raytracing2.png (145.19 KB, 396x397 - viewed 994 times.)
« Last Edit: January 18, 2010, 07:58:16 PM by zee » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #2 on: January 18, 2010, 08:08:13 PM »

keep cool, the shape looks right

and for what are you using the distance estimator ? if you are using straight voxel based display system, you do not need a distance estimator ( extra cost )
it would be enough to test if its inside or outside, a distance estimator must be used, when you want REAL smoothed surfaces, because you can use the tangent
of the DE to estimate a normal for a point ....

so, and i do not know what you mean by antialiasing. how to antialias a voxel field ?!?!??!?!?!?!?

 police
Logged

---

divide and conquer - iterate and rule - chaos is No random!
kram1032
Fractal Senior
******
Posts: 1863


« Reply #3 on: January 18, 2010, 08:28:21 PM »

I guess, the same way as a pixel-field?

you calculate "sub-voxels" and take their average (that would be the simplest approach^^) rather than using steppy direct blocks...
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #4 on: January 18, 2010, 08:50:29 PM »

but that would be smoothing, it would be more a "virtual" finer resolution, with smaller steps
Logged

---

divide and conquer - iterate and rule - chaos is No random!
zee
Guest
« Reply #5 on: January 18, 2010, 08:56:39 PM »

I'm sorry, after thinking about it I noticed that its only smoothing...

I don't know something about the distance estimator but I'm happy to know what DE stands for because I didnt understand the half of the "calculating normals"-thread. Is there a page to read something about that?

I don't understand the whole Text by David Makin (http://www.fractalforums.com/mandelbulb-implementation/calculating-normals/msg8794/#msg8794)

Maybe you can help me with some pseudocode or explain how deleft, decenter, ... look like
« Last Edit: January 18, 2010, 09:33:18 PM by zee » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #6 on: January 18, 2010, 09:36:11 PM »

so, a little introduction:

when coloring 2d fractals like the mandelbrots, first and intuitive way of coloring was to use the iteration depth,
this results in the well known bands ....

people wanted to have "smooth" transition between the bands, and one way of achieving that is to use a distance
estimator, that gives you a floating point value which tells you how far the set could be away, this is working
quite good for 2d coloring

when it comes to 3d objects, this method can be used to determine the normal for a point, since it gives a real number
as distance estimation, and hence it is a analyitcal function it can "easily" be derived to use it as a tangent on the
surface, calculating the normal from a tangent can also be quite demanding, but since the normal needs to point
perpendicular from the surface, it can easily be extracted

here is a nice master thesis describing fractal coloring methods

http://www.violetindustries.com/gallery.php?cat=techniques
Logged

---

divide and conquer - iterate and rule - chaos is No random!
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #7 on: January 19, 2010, 12:56:32 AM »

I'm sorry, after thinking about it I noticed that its only smoothing...

I don't know something about the distance estimator but I'm happy to know what DE stands for because I didnt understand the half of the "calculating normals"-thread. Is there a page to read something about that?

I don't understand the whole Text by David Makin (http://www.fractalforums.com/mandelbulb-implementation/calculating-normals/msg8794/#msg8794)

Maybe you can help me with some pseudocode or explain how deleft, decenter, ... look like

OK, just to repeat it:

*****************
If our found point is vp+alpha*vcentre has distance estimate decentre from inside where vp is the viewpoint, alpha is the distance stepped and vcentre is the direction vector then I get the 4 adjacent distance estimates at vp+alpha*vleft, vp+alpha*vright, vp+alpha*vtop, vp+alpha*vbottom which gives me 5 points at vp+(alpha+decentre)*vcentre, vp+(alpha+deleft)*vleft etc. and then use the 4 triangles from the 5 points to compute the normals by summing the 4 unnormalised normals and normalising the result. Note that I do do some limited extra ray stepping (backwards) if the adjacent points are found to be truly "inside" in order to get a valid DE value obviously adjusting the calculations accordingly. I do all 4 adjacent points to allow restriction of the extra ray-stepping which means that occaissionally one or more adjacent point values are invalid. The 4 adjacent rays I use by default are at 1/2 pixel offsets.
If not using UF, or if using a global buffer in UF then it would perhaps be slightly more optimum to use whole pixel offsets for the adjacent rays.
This method is vastly superior to using the actual surface found method Smiley
*****************

Now I'll try to explain.
1. We have a viewpoint, vp - this is a 3D coordinate and all the viewing rays start here.
2. We have a unit direction vector, vcentre, for the ray through the current pixel.
3. We have the distance along the ray from the viewpoint at which "solid" has been found, this is alpha (scalar).
4. For this point on the ray for the current pixel (i.e. the point at vp+alpha*vcentre) then the distance estimate was decentre (scalar).
5. Now we take 4 adjacent rays to the ray through the current pixel - how adjacent could be chosen but I use the rays at 1/2 pixel offsets - i.e. one ray above, one left, one right and one below with unit direction vectors vabove, vleft, vright and vbelow
6. For the 4 adjacent rays we iterate at vp+alpha*vabove, vp+alpha*vleft, vp+alpha*vright and vp+alpha*vbelow in order to give us distance estimates at each of these points as deabove, deleft, deright and debelow
7. We now assume that all the distance estimates are 100% accurate *and along the rays* so we have 5 surface points, the central point at vp+(alpha+decentre)*vcentre and the four adjacent points at vp+(alpha+deabove)*vabove, vp+(alpha+deleft)*vleft, vp+(alpha+deright)*vright and vp+(alpha+debelow)*vbelow
8. These 5 points give us 4 triangles (in a diamond shape) to give us four normals in the usual way which we can average to give the normal at the central point.

Edit: Just to stress that for the 4 adjacent rays we do *not* do any ray-tracing, the alpha scale for those is the alpha for where we found the central pixel.

« Last Edit: January 19, 2010, 01:00:46 AM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #8 on: January 19, 2010, 01:26:32 AM »

@dave so, why you need a derivative of the DE ?!?
Logged

---

divide and conquer - iterate and rule - chaos is No random!
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #9 on: January 19, 2010, 01:55:30 AM »

@dave so, why you need a derivative of the DE ?!?

huh?? For analytical DE the derivative is used to calculate the DE value itself.
The above is only for finding the normal once you've ray-stepped using DE to find the solid point (it works using either analytical DE or delta DE).
« Last Edit: January 19, 2010, 01:57:02 AM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #10 on: January 19, 2010, 02:03:55 AM »

ah, sorry, i thought DE could be used to extract the normal by, using the derivative of the DE, but i see, since it
is one dimensional, it is not possible to extract a normal out of it cheesy
Logged

---

divide and conquer - iterate and rule - chaos is No random!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #11 on: January 19, 2010, 02:06:16 AM »

@dave i do hope you reuse the intermediate pixels for adjacent ones cheesy
when using 1/2 step size cheesy
« Last Edit: January 19, 2010, 02:10:44 AM by Trifox » Logged

---

divide and conquer - iterate and rule - chaos is No random!
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #12 on: January 19, 2010, 02:12:41 AM »

@dave i do hope you reuse the intermediate pixels for adjacent ones cheesy


You can't do that for 2? reasons:

1. In UF you can't pass data to adjacent pixels unless you write the render to a buffer in the global section which means it wouldn't network render properly and you also couldn't render large print quality images.

also

2. I *suspect* you can't do that at all because the "alpha" value from the central pixel is different for each pixel - I know that the true location of the solid boundary should be fixed but I think everything probably needs to be done based on the alpha and DE found for the central pixel (because even when close the DE values are not 100% accurate).

Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #13 on: January 19, 2010, 02:32:08 AM »

ok, i see, and the network rendering possibility and the early screen updates is what i love about your implementation

Logged

---

divide and conquer - iterate and rule - chaos is No random!
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Tips for creating fractals? Mandelbulb 3d tin34543 3 1788 Last post February 05, 2012, 05:00:34 PM
by tin34543
Tips 'n' Tricks on dIFS anyone? Mandelbulb 3d Madman 10 3861 Last post March 28, 2012, 07:29:24 PM
by Alef
Found a cave painting - tips? Images Showcase (Rate My Fractal) Franatical 3 886 Last post April 06, 2013, 05:08:42 AM
by zonepatcher
Cube out of triangle pyramids with parameters and tips Structure Synth Gallery barcud 0 1071 Last post February 15, 2016, 09:41:59 PM
by barcud

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.277 seconds with 26 queries. (Pretty URLs adds 0.01s, 2q)