Mandelbox (Composition by psonice)

Author: psonice
License: MIT
Date: 2010.04.09
Compatibility: 10.5, 10.6
Categories:
Required plugins:
(none)

This is a 3d mandelbox plugin. It's rather awesome, both in coolness and hardware requirements ;) Use a SMALL window unless you have the latest and greatest GPU (I have a radeon 2600, and it gets near to smooth at around 320x240.

I'd love to say I invented it, but all I did was port it from HLSL to GLSL. I saw it in this sexy 1KB demo by Mad of Still: http://www.pouet.net/prod.php?which=54812 (source is in the download link, if you don't mind assembly.. the hlsl shader is in the data elements near the end of the source code). Mad found it on some fractal forum, so he didn't invent it either, but he does get some credit for making it run in 1kb :)

PreviewAttachmentSize
mandelbox2.qtz6.62 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: Mandelbox (Composition by psonice)

That is pretty fine coding - I shall have to give it a try in Quartz Crystal - very sci-fi looking :-) [cool coding].

What amazes me is how much simpler the vertex is , compared against the fragment shader, which is what is doing one whole lot of work.

psonice's picture
Re: Mandelbox (Composition by psonice)

The vertex shader does nothing at all... in fact the original 1k version from Still has no vertex shader.

gtoledo3's picture
Re: Mandelbox (Composition by psonice)

Sweet, can't wait to try it out.

Also, again, kudos on that cool mandelbrot with the zoom that you did awhile back. (...and of course, the clod, which I only was able to run once I upgraded to the nVidia Macbook Pro a few months back).

edit- Woah, almost brought my computer to a total freeze when I tried to resize it on the fly. :-)

It's too bad we can't get more stuff going like this in realtime, with decent rez.

psonice's picture
Re: Mandelbox (Composition by psonice)

First time I ran it, I had software opengl enabled by mistake. 0.06fps, with a small window. Can you imagine trying to actually do anything with the QC window at that speed?! I had to force quit, then QC insisted on opening the file when I relaunched.. had to edit the preferences plist to fix it :/

This is one incredible fractal though. Here's a pic of the kinds of shapes you get with a little tweaking:

http://www.interealtime.com/misc/mandelbox5.jpg

Looks like some crazy 3d city built in zero gravity :D

cybero's picture
Re: Mandelbox (Composition by psonice)

That explains it's startlingly relative simplicity.

Well I have managed to get a really excellent offline render from Quartz Crystal that looks tremendous - just uploading that to vimeo right now - BTW, it proved to be the only GLSL composition to obviously slow down everything when it was rendering in Quartz Crystal :-)

Vimeo URL ----> http://vimeo.com/10816603 - still converting.

psonice's picture
Re: Mandelbox (Composition by psonice)

yeah. Whole OS running at 1fps! (I'm doing a quick 720p render with different parameters for the fractal.. 6 hours remaining. I'll sleep now and upload in the morning...

(is there anything that can be done about the OS stalling this is causing btw? it makes the machine unusable while it's rendering!)

cybero's picture
Re: Mandelbox (Composition by psonice)

Well, I'm not entirely sure , but perhaps the command line only option might give us a little more leeway, but I'm inclined to think that it will entirely be a matter of having a little Mac Mini or better as dedicated rendering machine, which makes me wonder... is there any advantage to be had in running RAM disks or perhaps employing distributed rendering, dedicated scratch disks ?

Mandlebox [by psonice] - Offline Render from cybero on Vimeo.

Very reminiscent of sci fi games. Love it. Thanks for sharing psonice.

Just found out that with a little tweaking it can really fly in Quartz Crystal:-)

cwright's picture
Re: Mandelbox (Composition by psonice)

psonice wrote:
(is there anything that can be done about the OS stalling this is causing btw? it makes the machine unusable while it's rendering!)

I ran shark, and it looks like a huge amount of time is spent in custom-compiled LLVM things (probably for the shader?) -- however, there was also some Intel stuff in the backtraces, indicating a non-software renderer (eek).

If it's at least partially running on the GPU, it'll run into the problem of having GPUs run loopy code. GPUs can't be interrupted like the CPU can, so if they're busy doing something the OS can't say "hey, I need to redraw the UI!" -- it has to wait. This is tricky to solve -- either the shaders need to get split into pieces (harming performance and increasing driver and execution complexity a lot), or they should run entirely in software (so they live on the CPU, and get interrupted when they're annoying).

psonice's picture
Re: Mandelbox (Composition by psonice)

Interesting. Is the LLVM stuff the compiler itself, or something compiled by LLVM? It could be that it's running in software of your machine (it needs a PS3.0 capable card, so anything labelled intel is likely to roll over and play dead).

It definitely will cause the GPU to stall though, it's a pretty heavy shader with a ton of loops. Software emulation is a bad idea though, it goes veeerrrry slow. I got 0.06 fps with a small window.

cwright's picture
Re: Mandelbox (Composition by psonice)

re llvm: both? llvm is used to compile shaders (and will thus generate weird output in shark -- just addresses with no useful instructions), but llvm itself doing the compiling doesn't show up (I'm somewhat speculating here, as I don't know the details, and would imagine the shader should only get compiled once at startup anyway). I honestly have no idea why intel's in the backtrace at all -- I totally agree with you that anything other than fixed-function polys will make that GPU die. My concern is that that could be a bug in QuartzCrystal (it's supposed to make a software-only context so as not to interrupt everything, except when paging heavily, which can't be avoided.

software emulation would absolutely suck, but it has the benefit of being interruptable -- if it was working in pure software, it'd take 7 million years to finish, but the perk is that you can keep using your machine for those 7 million years :)

usefuldesign.au's picture
Re: Mandelbox (Composition by psonice)

cwright wrote:
psonice wrote:
(is there anything that can be done about the OS stalling this is causing btw? it makes the machine unusable while it's rendering!)
If it's at least partially running on the GPU, it'll run into the problem of having GPUs run loopy code. GPUs can't be interrupted like the CPU can, so if they're busy doing something the OS can't say "hey, I need to redraw the UI!" -- it has to wait. This is tricky to solve -- either the shaders need to get split into pieces (harming performance and increasing driver and execution complexity a lot), or they should run entirely in software (so they live on the CPU, and get interrupted when they're annoying).

What happens in a Mac with multiple GPU cards? Can software determine one card for the rendering application and another for the UI and other apps.* Would you need two monitors to split the tasks or could it be done all inside Quartz Crystal?

  • presently MBP firmware or OS precludes running both cards at same time so I guess I'm talking about Mac Pros exclusively.

cwright's picture
Re: Mandelbox (Composition by psonice)

in theory, an app such as QuartzCrystal could use the second GPU, but generally the UI will be running on both (since both will have displays plugged in). The more worrying point I was bringing up was that QuartzCrystal is supposed to be using only software rendering (for consistency, since there are a huge number of GPU bugs that cause inconsistent results). Since it's stalling everything, it looks like the GPU's getting utilized somewhere anyway, which I'd consider a bug.

usefuldesign.au's picture
Re: Mandelbox (Composition by psonice)

Yeah right, I get that now. I was just thinking from multitasking pov would be good to have one GPU assigned to exclusively assist Quartz Crystal and one doing everything else but I didn't realise GPU generates bugs for quartz crystal that CPU doesn't. What's the difference between the QC editor and QCrystal that it bugs out.

(Aside from the fact the QCrystal does super-sampling and anti-aliasing which I've learnt has some dimensioning issues for some patches not using unit dimensioning)

gtoledo3's picture
Re: Mandelbox (Composition by psonice)

I believe Chris is talking about flat out QC bugs that make it so that stuff in QC looks different depending on GPU. For instance, some things look way different on my IntelX3100 compared to my nVidia9400/9600 computer. I see the most difference in color and Core Image. The only common ground between computers would be to render using just the CPU.

gtoledo3's picture
Re: Mandelbox (Composition by psonice)

You might want to try out that Mandelbulb composition that was posted... I was rendering that some around Christmas time, and had many of the same issues. That one flat out froze my computer at certain points in the render when doing HD, and occasionally when writing image sequences I would get no output (blank images, when doing large sizes with AA).

Also, this is mildly interesting...writing Mandelbox to a png sequence reveals that the black is actually alpha black.

cwright's picture
Re: Mandelbox (Composition by psonice)

bzzt. not QC bugs -- GPU bugs.

  • ATI X1600 incorrectly alpha blends
  • ATI X1600 vram leaks with point sprites
  • GMA945, 950, X3100 don't honor point attenuation
  • GeForce 9400 dual-colorcorrection on 10.6.2
  • and much much more!

psonice's picture
Re: Mandelbox (Composition by psonice)

Yeah, there's a LOT more than that.

Re. the crystal rendering - it WAS rendering very fast for CPU. Well, this is kind of an extreme case either way, so I think there's no huge hurry to fix it at least :)

My video of it. No idea what happened in the first second. Wait a minute or so, and it starts zooming in. The way it clips is pretty cool.

psonice's picture
Re: Mandelbox (Composition by psonice)

Made an interactive version. Mouse controlled, move mouse to look around, left button to move forwards, right button for back (and if anyone still has their mouse set to 1-button, it's your own fault :D)

I've not figured out how to do "full" look-around, but it's kind of half-way there.

PreviewAttachmentSize
mandelbox3.qtz8.94 KB

toneburst's picture
Re: Mandelbox (Composition by psonice)

That is pretty amazing. Doesn't look like other renderings of the Mandelbrot set I've seen though. It's almost like a negative of the usual look of these things. It's also a lot 'blockier' that other Mandelbrot set renderings I've seen. Very intriguing. I do like the way it gets clipped, too. I'm guessing it's using some form of raycasting. I don't have time to look at the moment, but maybe there's a mechanism for anti-aliasing by casting multiple rays. If so, you could make it run faster by casting fewer rays per-pixel, at the expense of more jagged edges. Just a thought..

a|x