Grasshopper

algorithmic modeling for Rhino

http://en.wikipedia.org/wiki/Mandelbulb
Isosurface generated using Millipede.
Rendered in Brazil for Rhino.

(This is a mesh object but, ideally, you'd want to render this in a native isosurface renderer to achieve a high level of detail).

Views: 8911

Comment by Rieketh on February 13, 2013 at 8:26am

I know next to nothing about scripting, and so forgive me if I am way off here, but would it be possible to use this sort of definition with a few changes to the code to create something like say Roman Broccoli?

Comment by RWNB on February 4, 2013 at 8:02am
Comment by Ángel Linares on January 9, 2013 at 5:41pm

I've been messing around with GLSL shaders and processing this holidays and could be awesome efficient implement this code over a shader using GPU processing power...the problem is that I don't know how to implement or use shaders inside Grasshopper/Rhino...Anyone knows is that is possible?

Comment by taz on December 20, 2012 at 12:36pm

If you blur your eyes it kind of looks like a snowflake...

Comment by Yoann Mescam (Systemiq) on December 20, 2012 at 8:05am

Trying zooms with colors, these are just horizontal slices.

I will try later with meshes, if my computer is still alive...

z=0.29

power 23, iterations 12

Comment by Ángel Linares on December 20, 2012 at 5:08am

My laptop is going to crash this weekend :D

Comment by djordje on December 19, 2012 at 10:19am

Wonderful !!!

Comment by RWNB on December 19, 2012 at 10:10am

thanks vicente!


Comment by Marios Tsiliakos on December 19, 2012 at 9:49am

Thanks for sharing Vicente. You know that you're going to crash a lot of pc's today right?? 

Comment by Vicente Soler on December 19, 2012 at 9:38am

The definition is pretty simple. Most of it's complexity is to subdivide the mesh into several pieces so that my laptop doesn't end up running out of memory:

The first VB component is a timer, the last one bakes each mesh chunk into the document, the middle one calculates the isosurface values and has the following code:


Private Sub RunScript(ByVal x As List(Of Vector3d), ByVal y As Object, ByRef A As Object)
Dim nums As New list(Of Double)
For Each v As point3d In x
nums.add(mandelbulb(v))
Next
a = nums
End Sub
' custom additional code
Dim z As vector3d
Dim Iterations As Integer = 6
Dim Power As Integer = 8
Function mandelbulb(pos As vector3d) As Double
z = pos
Dim dr As Double = 1.0
Dim r As Double = 0.0
Dim int As Integer = 0
For i As Integer = 0 To iterations - 1r = z.Length
Dim theta As Double = Math.acos(z.Z / r)
Dim phi As Double = Math.atan2(z.Y, z.X)
dr = Math.pow(r, Power - 1.0) * Power * dr + 1.0
Dim zr As Double = Math.pow(r, Power)
theta = theta * Power
phi = phi * Power
Dim sintheta As Double = Math.sin(theta)
z.X = sintheta * Math.cos(phi)
z.Y = Math.sin(phi) * sintheta
z.Z = Math.cos(theta)
z = vector3d.Multiply(z, zr)
z = vector3d.Add(z, pos)
If r > 1.5 Then Exit For
Next
Return 0.5 * Math.log(r) * r / dr
End Function


I mainly got it from here: https://github.com/royvanrijn/mandelbulb.js, but I've seen almost the same code on several places.

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service