Cinema 4D Tutorial - Mandelbrot Set Rig

Published: 02 November 2020
on channel: Pappy's Tutorials
1,688
76

In this tutorial I will explain how to use a Python node in an Xpresso tag to create a rig for generating and zooming a 3D Mandelbrot Set.

Index:
The Basics: 1:42
The Basics User Controls: 6:33
About the Mandelbrot Set: 16:19
Mandelbrot Code and Simple Interface: 20:20
Mandelbrot Improved Interface: 44:07
Mandelbrot Timeline Exponential Zoom: 59:46
Mandelbrot Zoom Rectangle: 1:08:19
Last Few Details (save tag preset, etc.): 1:24:17


Ben Sparks explains the Mandelbrot Set on Numberphile
   • What's so special about the Mandelbro...  

Images from the Mandelbrot Set
http://www.cuug.ab.ca/dewara/mandelbr...

Mandelbrot Set explorer
http://www.jakebakermaths.org.uk/math...

My tutorial originally ended with the time zoom, but I was inspired to add the rectangle zoom after watching this tutorial by Marc O'Donnel.
Its a good tutorial on creating a Mandelbrot .png file for a material
   • Cinema4D Tutorial - Python Mandelbrot...  

#----------------Here's the final Python code----------------
Mandelbrot Set Zoom Xpresso Python node
by: Pappy Bedard
You Tube Channel:    / @pappystutorials  

import c4d
from math import sqrt

def get_count(c, thresh, max_steps):
z = complex(0,0) #z.real z.imag
count = 1
while count<max_steps and sqrt(z.real*z.real + z.imag*z.imag)<thresh:
z = z*z + c
count += 1
return count

def main():
npt = Obj.GetPointCount()

s = Obj.GetRad()
canvasrad = max([s.x,s.y,s.z])
MandelRad = 2.0
px = Mpx
py = Mpy

BaseScale = MandelRad/canvasrad
Scale = BaseScale*MScale

#this section only needed for zoom rectangle
if ZoomRectOn:
NewScale = Scale * ZoomRectSize/(canvasrad*2)
Newpx = ZoomRectPos.x*Scale + px
Newpy = ZoomRectPos.z*Scale + py
Scale = NewScale
px = Newpx
py = Newpy
Tag[c4d.ID_USERDATA,4] = NewScale/BaseScale
Tag[c4d.ID_USERDATA,5] = Newpx
Tag[c4d.ID_USERDATA,6] = Newpy
Tag[c4d.ID_USERDATA,14] = False

for i in range(npt):
pt = Obj.GetPoint(i)
x = pt.x*Scale + px
y = pt.z*Scale + py
h = get_count(complex(x,y), 2.0, MaxSteps)/float(MaxSteps) *Height
Obj.SetPoint(i,c4d.Vector(pt.x,h,pt.z))


Watch video Cinema 4D Tutorial - Mandelbrot Set Rig online without registration, duration hours minute second in high quality. This video was added by user Pappy's Tutorials 02 November 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,68 once and liked it 7 people.