Jump to content

megamu

Limited Member
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • First Name
    ryce
  • Last Name
    gaba
  • Location
    buenos aires

HW | SW Information

  • OS
    Windows
  • GPU
    I5 7300 hq gtx 1060

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

megamu's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Oh this is great, I really appreciate your help. Mandelbulb works great on cd4 greater equial than r21. To use it on r20 i changed "access.InitWithWriteAccess(volume)" to "access.Init(volume)" I didn't know how to code volumebuilder, and i was researching on a thinking particles adaptation, this really helps. In these cases related to a procedural approach to c4d, do you think is the best case to use python/xpresso or there are other types of workflow inside cinema4d? do you have resources to share to go deeper on cinema4d python programming?
  2. TLDR: I'm exploring with fractals in C4d. is there any other alternative to create mandelbrot sets, in cinema4d? Hi i don't have Vectron, or Houdini. I tried to replicate this on python: import c4d from math import sqrt import random import numpy as np #Welcome to the world of Python def main(): maxiter = 5 #obj = doc.SearchObject("Cubo") obj = op[c4d.ID_USERDATA,1] #create user data parameter with link option and drop the object that you want to use #pointCount = obj.GetPointCount() pts = obj.GetAllPoints() ptCount = obj.GetPointCount() for x in range(ptCount): if(mandel(pts[x][0],pts[x][1],pts[x][2],maxiter)): obj.SetPoint(x,c4d.Vector(0,0,0)) else: obj.SetPoint(x,c4d.Vector(1,1,1)) #obj.SetPoint(x,c4d.Vector(random.randint(0,40),random.randint(0,40),random.randint(0,40))) #obj[c4d.ID_BASEOBJECT_REL_POSITION]= c4d.Vector(0,0,random.randint(0,1)) def mandel( x0,y0,z0,imax): x = x0 y = y0 z = z0 n =8 for i in range(imax): xnew = x * x - y * y +x0 ynew = 2* x * y + y0 r = sqrt(x*x +y*y + z*z) theta = np.arctan2(sqrt(x*x+y*y),z) phi = np.arctan2(y,x) xnew = pow(r,n)* np.sin(theta*n)* np.cos(phi *n)+x0 ynew = pow(r,n)* np.sin(theta*n)* np.cos(phi *n)+y0 znew = pow(r,n) * np.cos(theta*n) +z0 if(xnew * xnew + ynew * ynew +znew*znew> 8): return(i) x = xnew y = ynew z = znew return(imax) Using a cube polygon object as user data to my script. I used the mandelbrot formula to every point. To install numpy, i located the Cinema4d python files on: [C4Dfolder]\resource\modules\python\libs\win64\python27.vs2008.framework pythons versions may vary, and followed this: https://stackoverflow.com/questions/35700063/pip-install-python-2-7-windows-7 downloaded https://bootstrap.pypa.io/get-pip.py on python folder. Save the file as getpip.py Run it from cmd: python getpip.py install| and python -m pip install numpy
  3. is there any way to use spline, to model in 3d, using some three-dimensional grid as helper? I tried to use planar workspace but it doesn't work, I would need a grid that marks all the points of the space to use spline in a three-dimensional way, the front and side views don't work for me because it always ends up overlapping segments.
  4. When you program in Python the actions that will occur. How do you animate them in the timeline? I thought for example to make a user data with checkbox assigned to if blocks with events inside that are activated/deactivated according to ones choose in the timeline What ways do you use? sequencing (like in ableton)? finite state machines?
  5. Great, i will look for dynamic programming. Another thing I had trouble with was accessing the blending properties of a layer in a texture within python. I had to pass the values from python to the gradients through user data variables and connect them with xpresso.
  6. Hi, i'm new to c4d and 3d in general. I started learning xpresso nodes and python. I'm recreating this video with shaders and cloners, using xpresso nodes I created inside a python lfo (could have used the formula node) and connected it to the parameters of number of clones, shaders fallof linear position , strength, shader gradient, etc. When I wanted to replace several xpresso nodes with a python script (creating my own rangemapper function, real2vector) connected to my other lfo script, the animation got quite slow, giving very slow render times. My questions are: what are the ways to optimize python performance? does c4d have optimized python functions like xpresso? is running python inside an xpresso node very expensive? what is the least expensive way to run python scripts? Does this way of using the script run in every frame? I like xpresso but python is much easier for me to code. I'm using c4d r19. Is the runtime of python improved in the new versions? I'm redoing all, using only a null object with a python tag and api functions, i think this is going well. Is just a little bit slower than xpresso, but python is easier for me. import c4d import math #Welcome to the world of Python def lfo(cframe, frecuencia, amplitud=1): return 1-(((math.sin(cframe*frecuencia)*amplitud)+1)*0.5) def main(): #User Data obj = op.GetObject() UC = obj.GetUserDataContainer() frecuencia= obj[c4d.ID_USERDATA,2] amplitud= 50 #Current Frame cFrame = doc.GetTime().GetFrame(doc.GetFps()) #Objetos cloner = doc.SearchObject('Cloner') shader = doc.SearchObject('Shader') cube = doc.SearchObject('Cubito') random = doc.SearchObject('Random') #Oscilador osc = lfo(cFrame, frecuencia) #print osc #Move between -600,600 Shader shader[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X]= c4d.utils.RangeMap(osc,0,1,-600,600,False) #Shader Strength shader[c4d.ID_MG_BASEEFFECTOR_STRENGTH]= osc #Random Strength random[c4d.ID_MG_BASEEFFECTOR_STRENGTH]=osc #Cloner Count cloner[c4d.MG_GRID_RESOLUTION]= c4d.Vector(1+osc*50,1,1+osc*50)
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community