rende Posted November 12, 2009 Share Posted November 12, 2009 (edited) http://www.skytopia.com/project/fractal/mandelbulb.html http://www.skytopia.com/project/fractal/2mandelbulb.html Just saw that and read through a bit of the forum thread linked off it and wondered if its possible to somehow plug that formula into a object node and get mantra to render similar 3d fractals? I'm really new with houdini so dont even know what to search for, or if its possible. I doubt you can generate the geometry with polygons (even a rough approximation)... it will have to be at render time right? edit: looks like that site just died from traffic. heres the thread: http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/ 3d vs 2d fractal: Edited November 12, 2009 by rende Quote Link to comment Share on other sites More sharing options...
itriix Posted November 12, 2009 Share Posted November 12, 2009 (edited) That's a great goal. I can't wait to see more. If I had more time right now i'd take a stab at it but i'm extremely busy at the moment with other projects. BUT, i'll leave you with a couple resources I'd highly suggest if you're interested in this kind of thing. There is a video from TTC (The Teaching Company) called CHAOS... It's about Chaos Theory. In there there are quite a few chapters on Fractals. Here's the link to it. Another is Arthur C. Clarke - The Colors of Infinity. Then one more is Fractals Mandelbrot Set - M-SET! (I think the other two might be over on YouTube.) Hope they are of some help... (not necessarily so much on the "how to do it in houdini") ways but it's definitely worth watching if you're interested in this kind of thing Also I know After Effects has a Mandelbrot function that you can use as an effect... You might be able to get more ideas from looking into the way they are using it. Cheers, Jonathan Edited November 12, 2009 by itriix Quote Link to comment Share on other sites More sharing options...
rende Posted November 12, 2009 Author Share Posted November 12, 2009 (edited) That's a great goal. I can't wait to see more. If I had more time right now i'd take a stab at it but i'm extremely busy at the moment with other projects. BUT, i'll leave you with a couple resources I'd highly suggest if you're interested in this kind of thing. There is a video from TTC (The Teaching Company) called CHAOS... It's about Chaos Theory. In there there are quite a few chapters on Fractals. Here's the link to it. Another is Arthur C. Clarke - The Colors of Infinity. Then one more is Fractals Mandelbrot Set - M-SET! (I think the other two might be over on YouTube.) Hope they are of some help... (not necessarily so much on the "how to do it in houdini") ways but it's definitely worth watching if you're interested in this kind of thing Also I know After Effects has a Mandelbrot function that you can use as an effect... You might be able to get more ideas from looking into the way they are using it. Cheers, Jonathan Thanks for the links. I've written a simple c++ mandelbrot generator ages ago while messing around with pixel plotting libraries and opengl. Just need to figure out how to apply the formula to a 3d container to trace against. Basicly in 2d you just run your screen x/y coord through the formula and you get a value you can use to print a color. Anyways, out of curiousity I slapped together a python sop and piped in a block of grids to see what will happen. Getting some very funky results, although its slow when you get to ridiculous point counts. python code: import math geo = hou.pwd().geometry() n = hou.Node.evalParm(hou.pwd(), "nlevel") for pt in geo.points(): pos = pt.attribValue("P") x = pos[0] y = pos[1] z = pos[2] r = math.sqrt(x*x + y*y + z*z ) theta = math.atan2(math.sqrt(x*x + y*y) , z) phi = math.atan2(y,x) newx = r**n * math.sin(theta*n) * math.cos(phi*n) newy = r**n * math.sin(theta*n) * math.sin(phi*n) newz = r**n * math.cos(theta*n) newpos = (newx, newy, newz) pt.setPosition(newpos) Edited November 12, 2009 by rende Quote Link to comment Share on other sites More sharing options...
itriix Posted November 13, 2009 Share Posted November 13, 2009 hey, i found another link that might be of very big interest to you Quote Link to comment Share on other sites More sharing options...
cellchuk Posted November 16, 2009 Share Posted November 16, 2009 hey rende, A friend passed me the skytopia... link a couple of days ago. I didn't even realize there was a post about it down here. I'm pretty interested in this stuff as well, As soon as I find some time, I'll start playin around with this. thanks for sharing the py code btw. keep it up Quote Link to comment Share on other sites More sharing options...
rende Posted November 17, 2009 Author Share Posted November 17, 2009 hey rende, A friend passed me the skytopia... link a couple of days ago. I didn't even realize there was a post about it down here. I'm pretty interested in this stuff as well, As soon as I find some time, I'll start playin around with this. thanks for sharing the py code btw. keep it up cool. Any ideas on how to generate the geometry? Closest i can think of is to march the points of a grid from the camera towards the surface, but that wont create backfaces etc.. and be very slow. Is there anything in the HDK that can help? Quote Link to comment Share on other sites More sharing options...
Div Posted November 27, 2009 Share Posted November 27, 2009 From what i've read on the several links, i think the best approach will be to use voxels in order to represent the formula... I don't know really how to do it, perhaps using a custom vex shader on a iso or sdf volume, cause i think that only mantra could generate the amount of geometry. Or maybe some custom dso... I'm very interested about what would be the differents approach you might think of guys... Quote Link to comment Share on other sites More sharing options...
Jeff Lait Posted November 27, 2009 Share Posted November 27, 2009 I also saw this and was intrigued. The simplest way to generate the geometry is just to use a Volume VOP on a blank volume to run a certain number of iterations. Then iso surface the result at the 1.0 contour to get the set at that iteration. The problem, obviously, is memory, running 500^3 to get a nice surface takes a fair bit. The better way is with a volume shader. To do this, I used a low iteration 200^3 version to get a rough shell for the set so I wouldn't have mantra marching over empty voxels. Then drop the mandelbulb vop generator in. Note I'm using the slow sin/atan formulation, you'll find a link in the original for a much faster way to compute the 8th power. The attached file uses the hdk surfacer example rather than convert as it is significantly faster. It also does lots of 500^3 volumes so be careful running it on memory constrained machines. The images are from using successfully smaller volumes to generate the samples in, thereby cutting away smaller pieces of the set. mandelbulb_B.hip mandelbulb.otl 2 Quote Link to comment Share on other sites More sharing options...
itriix Posted November 28, 2009 Share Posted November 28, 2009 I also saw this and was intrigued. Awesome! I can't wait to take a look at you're files. Jonathan Quote Link to comment Share on other sites More sharing options...
Jeff Lait Posted November 28, 2009 Share Posted November 28, 2009 I went to the work of wiring up the non-trig version of the formula and was frustrated when I got different results. I then realized my new results were correct, there was something different happening with the original version I had. The big clue is the lack of north/south symmetry in the above examples. Attached is mandelbulb otl with the mandelbulb8 version which does the power 8 version without any trig (and correctly) 5 iterations are used. I've also had enough time for some renders to complete. Treating as a volume with PBR enabled, environment + direct light, 13x13 sampling and 0.001 volume stepsize, I get the attached. (gamma corrected to 2.2) Rendering time is approximately forever (12-18 hours a frame), so for my fly-through I've reverted to ray tracing rather than PBR. mandelbulb.otl 1 Quote Link to comment Share on other sites More sharing options...
Div Posted November 28, 2009 Share Posted November 28, 2009 (edited) Thanks a lot for this Jeff... I was trying to do it with a vex surface shader and was stuck... I got nice results but not what i wanted... Thanks to your file i was able to correct my vex shader... And now it's working great !!! But now i've got some questions for you about how you achieve to replicate the formula inside houdini :: According to your file you add x to the newx variable and clamp that value. Daniel White's formula on his website is : newx = pow(r,n) * sin(theta*n) * cos(phi*n); and yours is : newx = clamp(pow(r,n) * sin(theta*n) * cos(phi*n) + x, -4, 4); I can figure out for the clamp value but how did you find that you'll have to add x to Daniel's formula... I will be very interested about knowing the way you find out. And i will look closely to your new otl, to find out how you do without the sin/atan formulation. I've attached my vex shader for those interested, but i think it's not as efficient as Jeff's files... To use it just create a volume sop with initial values set to {1,1,1} and size to {2,2,2}, and assign the 3dmandelbrot shader (otl) to it. As the basis for this shader is the vex volume cloud shader, don't forget to add shadows in order to see some detail... nd_3dmandelbrot.otl Edited November 28, 2009 by Div Quote Link to comment Share on other sites More sharing options...
Jeff Lait Posted November 28, 2009 Share Posted November 28, 2009 It is a bit confusing because two formulas are given, one for how to compute (x,y,z)^n and another for how to do the actual iteration. The iteration is always (nx,ny,nz) = (ox,ox,oy)^n + (x,y,z) written often as z = z^n + c where x,y,z are the original coordinates, the ox,oy,oz the previous iteration value, and nx,ny,nz the new iteration value. This is why my forumula, which does the full iteration, has the extra +x which isn't on the website where they are only talking about the (x,y,z)^n component. The clamping is something extra I did for higher iterations. When the point spirals out too far it will keep going to infinity. It does this very, very, quickly with power of 8 and you soon exceed numerical range and get NANs or INFs or other rubbish. To avoid this, I just clamp points when they reach a certain escape threshold. I picked 4 at random as being surely large enough that any point outside the (-4,-4,-4)x(4,4,4) box will surely never reconverge. I didn't see anything on the site as to a proper official value like there is for Mandelbrot sets. A more efficient idea is to not use a for loop, but a while loop, so you early-exit as soon as you spiral out so as to not have to do all the iterations for trivially rejected points. Quote Link to comment Share on other sites More sharing options...
itriix Posted November 28, 2009 Share Posted November 28, 2009 I've also had enough time for some renders to complete. Treating as a volume with PBR enabled, environment + direct light, 13x13 sampling and 0.001 volume stepsize, I get the attached. (gamma corrected to 2.2) Rendering time is approximately forever (12-18 hours a frame), so for my fly-through I've reverted to ray tracing rather than PBR. Beautiful! Once again thanks for sharing! Cheers, Jonathan Quote Link to comment Share on other sites More sharing options...
Jeff Lait Posted November 28, 2009 Share Posted November 28, 2009 The low quality fly through is done. No motion blur, 3x3 raytrace with a 0.01 stepsize. 3m30s per frame on the fast machines (53m on slow machines!) Running another render using a 0.001 stepsize to cut the noise which is running 2h per frame so far. mandelbulb_F.avi Quote Link to comment Share on other sites More sharing options...
vmuriel Posted November 29, 2009 Share Posted November 29, 2009 Great work Jeff. Quote Link to comment Share on other sites More sharing options...
rende Posted November 29, 2009 Author Share Posted November 29, 2009 (edited) awesome Thought this thread was dead so didn't check back for a while. Thanks for sharing Edited November 29, 2009 by rende Quote Link to comment Share on other sites More sharing options...
itriix Posted November 29, 2009 Share Posted November 29, 2009 (edited) Wow, very nice Jeff! The fly through is looking great. Thought about adding some color? Jonathan Edited November 29, 2009 by itriix Quote Link to comment Share on other sites More sharing options...
chumbuk Posted November 29, 2009 Share Posted November 29, 2009 megacool work Jeff, thanks for sharing!!! Quote Link to comment Share on other sites More sharing options...
Div Posted November 29, 2009 Share Posted November 29, 2009 Thanks a lot Jeff for all your explanations... Quote Link to comment Share on other sites More sharing options...
Jeff Lait Posted November 30, 2009 Share Posted November 30, 2009 Attached is the fly through using shorter volume step size, .001, you'll see that there is a lot less noise. Still hard to see the detail up close because the lighting gets to be so harsh. Also attached is a PBR render at 2560x1600 with .01 stepsize and 13x13 samples. I've tiled a 23x23 and 0.001 render and put it at lowest priority so I may get a better quality version in a week or two :> mandelbulb_G.avi 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.