Logo by jwm-art - 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: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. April 16, 2024, 07:58:49 PM


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 ... 3 4 [5]   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: the simpliest naive bruteforce code for mandelbulb  (Read 14704 times)
0 Members and 2 Guests are viewing this topic.
richardrosenman
Conqueror
*******
Posts: 104



WWW
« Reply #60 on: March 30, 2012, 05:57:16 PM »

Thanks for those tips, Jason & David!

I will be working with my code this weekend and adding your suggestions. I have already implemented the orbit trap shading and yes, it is quite a bit nicer than before. Thank you for that! I'll post an example asap. wink

Can I ask about your light sourcing and specularity? Any good suggestions for code examples / theory for this? I know there must be a ton on here but I'm looking for a *really* simply explanation. Do surface normals need to be calculated for specularity?

Asimes: Yours is coming along nicely too. Let's try to figure out the rotation together as this is something I also need to put in next... Nothing like a couple of newbies (one being an artist who can't think in numbers) trying to figure out computational algebra and trigonometry together... wink

-Rich
« Last Edit: March 30, 2012, 06:12:42 PM by richardrosenman » Logged

David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #61 on: March 30, 2012, 10:03:31 PM »

Bailout of 4 is fine for the DE method from this thread.  Larger than 4 tends to smooth out the surface and will lose details.



That's simply incorrect unless you're not using enough iterations to actually reach a consistent DE value as the solid surface - of course if you're using a particular iteration level as the solid surface then that's a different matter but will never give the consistent detail that using the DE as the solid threshold will achieve.
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #62 on: March 30, 2012, 10:18:19 PM »


Can I ask about your light sourcing and specularity? Any good suggestions for code examples / theory for this? I know there must be a ton on here but I'm looking for a *really* simply explanation. Do surface normals need to be calculated for specularity?


Normals are required both for diffuse and specular if implementing such....the guy to ask about lighting is lycium:

http://www.fractalforums.com/index.php?action=profile;u=87

He's always correcting me anyway (my textbooks are a little old).
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #63 on: March 30, 2012, 10:26:02 PM »

That's simply incorrect unless you're not using enough iterations to actually reach a consistent DE value as the solid surface - of course if you're using a particular iteration level as the solid surface then that's a different matter but will never give the consistent detail that using the DE as the solid threshold will achieve.

Just to add that to get more detail *and* more accuracy even when using a given iteration boundary as the "solid" surface then it's still better to increase the bailout but to keep the detail you have to increase the "solid" iteration level appropriately.
This means that for z^2+c to use a bailout of 16 (for sqrt(x^2+y^2+z^2) compared to using 2 then you need to increase the surface iteration count by just 2 since 1 extra iteration is required for a bailout of 4 (==2^2), and 2 for 16 (==(2^2)^2), 3 for 64 etc. - so for the suggestion I gave (32) then increasing the surface iteration threshold by 3 would actually result in more detail *and* more accurate DE at the cost of around 3 iterations per loop.
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #64 on: March 31, 2012, 01:21:09 AM »

Can I ask about your light sourcing and specularity? Any good suggestions for code examples / theory for this? I know there must be a ton on here but I'm looking for a *really* simply explanation. Do surface normals need to be calculated for specularity?

The Phong model is very common and is probably a good staring point: http://en.wikipedia.org/wiki/Phong_reflection_model
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #65 on: March 31, 2012, 04:35:27 PM »

Softology, mixing the orbit color with the ray marcher looks great, thanks.

I'm beginning to think that my sketch is just not set up for rotation. The part of the sketch that still somewhat alien to me is the "dr" part. However, it seems to only be affected by 'z', maybe if I had it be affected by 'y' it would give me a top down point of view but I don't know about arbitrary rotation. Any suggestions?
Logged
asimes
Fractal Lover
**
Posts: 212



asimes
WWW
« Reply #66 on: April 01, 2012, 07:06:20 AM »

I finally figured out how to view it from a 90 degree rotated angle (now it seems obvious). I just swap the 'y' and 'z' values for the Mandelbulb code as the initialization to 'ny' and 'nz' as well as when adding to them during the while loop. Still not sure about arbitrary rotations, would I need to shoot the rays separately from the 'x', 'y', 'z' triple loop or is there a clever way to include it?

Here's a result (purely ray marching, no orbit trap color):

Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #67 on: April 01, 2012, 01:10:33 PM »

congratulation  grin
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #68 on: April 01, 2012, 02:57:39 PM »

Softology, mixing the orbit color with the ray marcher looks great, thanks.

I'm beginning to think that my sketch is just not set up for rotation. The part of the sketch that still somewhat alien to me is the "dr" part. However, it seems to only be affected by 'z', maybe if I had it be affected by 'y' it would give me a top down point of view but I don't know about arbitrary rotation. Any suggestions?

For complete implementation of rotation you need to consider a viewpoint firing rays through each pixel of the screen (a flat plane) the centre of which is a fixed distance from the viewpoint and such that the plane is perpendicular to the central ray.
Then to change views you can simply transform each "pixels" coordinate from the position in the flat (screen) plane e.g. (+/-0.5,+/-0.5) or (
+/-1,+/-1) to a coordinate in 3D space based on the location of the viewpoint and the location/orientation of the viewing plane.
For each pixel you then have the viewpoint (vx,vy,vz) and the pixel's coordinate (px,py,pz) so for that pixel you compute (px-vx,py-vy,pz-vz) and then normalise this vector which gives a unit direction vector say (dx,dy,dz) for stepping along the ray.
The start position for the ray-stepping could be the viewpoint but often a near-cutting plane is used and in such a case you simply intersect the ray that starts at (ox,oy,oz) in direction (dx,dy,dz) with this near cutting plane and use the resultant point as the start point for stepping for that pixel.
Of course the above is for perspective projection and the closer the viewing plane (screen) is to the viewpoint then the widerthe field of view (or the smaller the camera with respect to the fractal if you prefer).
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Pages: 1 ... 3 4 [5]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
I arrive, and I come with code. Meet & Greet CraigM 3 1610 Last post January 16, 2009, 12:13:07 PM
by Cyclops
some code Mandelbulb 3d Jesse 7 3052 Last post August 15, 2011, 10:27:15 PM
by Jesse
Break the code Fractal Humor KRAFTWERK 11 7137 Last post November 25, 2011, 05:27:04 PM
by cKleinhuis
Mandelbulb Source Code? Programming neosettler 5 5503 Last post April 14, 2015, 11:38:51 AM
by DarkBeam
Set S of S: Simpliest location, eXtreme Depth. Images Showcase (Rate My Fractal) SeryZone 4 1474 Last post October 31, 2014, 08:52:09 PM
by SeryZone

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.151 seconds with 24 queries. (Pretty URLs adds 0.011s, 2q)