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).
Tags:
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?
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?
If you blur your eyes it kind of looks like a snowflake...
My laptop is going to crash this weekend :D
Wonderful !!!
thanks vicente!
Thanks for sharing Vicente. You know that you're going to crash a lot of pc's today right??
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.
Welcome to
Grasshopper
© 2024 Created by Scott Davidson. Powered by