Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => Mandelbulb Implementation => Topic started by: spooky on December 29, 2009, 09:21:45 PM




Title: My first Mandelbulb
Post by: spooky on December 29, 2009, 09:21:45 PM
Dear all,

My first Mandelbulb... Ok, it's not that nice but... I did it myself  ;D ... in C#. I implemented the shader based on a ray-casting strategy and using a Lambertian approach. In this image there is one single light and no ambient lighting.

The second image has less iterations, less noise, but less accurate of course... obviously it does not like Daniel White's images  :dink:
Spooky.


Title: Re: My first Mandelbulb
Post by: spooky on January 03, 2010, 08:42:17 PM
I added Phong shading for the specular highlights, implemented rotation matrix, added several user interface functionality and ported the computation part in C++...


Title: Re: My first Mandelbulb
Post by: Buddhi on January 03, 2010, 09:57:27 PM
Wow! Program with user interface!  :alien: I have never made any GUI for Mandelbulbs  :D and all parameters I'm changing in source code (I hate building interfaces)

... but now I'm preparing something for Linux GTK+, but it will take lot of work, because there is around 50 parameters for interfacing and lots of modes.

Spooky, when you will have some version for tests I can be tester :) Very interesting for me is performance of C# language because it operates on virtual environment.


Title: Re: My first Mandelbulb
Post by: spooky on January 03, 2010, 10:27:12 PM
Hello Budhi,

Thanks for the nice words... actually, I was like changing all these parameters in the source code when I realized that I will gain some time with the UI  ;D I still need to add the Z rotation angle but I would like to concentrate on shading now, particularly ambient occlusion, which is substantially more complex than diffuse or specular shading. Also, I still need to try a better way to compute the normals using 4 samples instead of 2 like now.
As for the test, no prob, I can prepare a setup for you but this will run under Windows, so I don't know for Linux  ??? Porting into C++ the hardcore routines gave a ~30% performance increase which is much less than I expected  ::)


Title: Re: My first Mandelbulb
Post by: gaston3d on January 04, 2010, 07:33:42 PM
... Very interesting for me is performance of C# language because it operates on virtual environment.

actually .NET application (.exe) contains Common Intermediate Language (CIL/MSIL) and is compiled to machine code by Just-In-Time compiler at runtime.
then C# (and any other Framework 'managed' language) in theory sholud be as fast as standard compiled code.
additionally .NET applications are cross-platform (i think it's good justification for performance drop down in some scenarios. any?)
i tested my raytracer (Windows Forms MDI) on Linux with Mono and works fine.


Title: Re: My first Mandelbulb
Post by: spooky on January 05, 2010, 10:22:36 PM
Well, as for speed, the next stage would be CUDA... I got up to 30 x acceleration factors sometimes ;D
Anyway, I finally implemented ambient occlusion, which is surprisingly simple using a brute force approach (Nvidia proposes an algorithm which is way faster, but not exact and quite more complex). I used an helix mapping of the sphere to "fire" rays from each point of the (visible) Mandelbulb and compute how many don't bounce on the object and go into "space" which is supposed to be "white"  :D

The picture below shows the first result, I added a small fraction of Lambertian diffuse shading... it seems to add a bunch of details but it is still not very good (looks like Xray imaging), maybe just tweaking the parameters maybe enough now ???


Title: Re: My first Mandelbulb
Post by: spooky on January 06, 2010, 10:10:50 PM
And yet another one rendered using the cosine of Ambient Occlusion rays and tweaking a bit the parms, looks now better...