• 3 Votes
    3 Posts
    1k Views
    A
    @Dunhou Thanks, I'm having a lot of fun making TP run like a train, I'm trying to optimize the code by vectorizing some functions and gain new FPS. I will keep this post updated on developments as much as possible
  • 3D -> 2D and back with perspective

    General Talk programming
    4
    4
    0 Votes
    4 Posts
    1k Views
    CJtheTigerC
    Good morning Ilia, Thanks for your detailed response even though this is out of support scope! Let me explain what I meant by this: involve more computations than I'd like it to Using ProjectPointOnLine() the calculations by the script are as follows: Transform 3D points to 2D screen space using WS(). Calculate my desired new point in screen space. Transform the new point to 3D world space by projecting the new point onto the 3D line using ProjectPointOnLine(). Transform the new point back from 3D world space to 2D screen space using WS(). Do more things using these correct 2D coordinates of the new point. The issue of this topic is addressed by step 3 but to further work properly with the point in 2D space I also need step 4. I in fact do not only need the 2D coordinates but the z component as well. I feel like there must be a mathematical formula to get the correct Z value without transforming all three vector components back and forth in steps 3 and 4. So the issue I have with the "hacky" solution is purely to reduce the amount of performed calculations to a bare minimum which to be completely honest is just a means to satisfy this itch of mine to optimize as much as possible. It's part of what makes programming fun to me. Also it would really be interesting to grasp the mathematical concept behind this. As someone who taught himself 3D programming by reading a bunch of game dev tutorials 15 years ago this is super interesting. But enough rambling. Regarding your question: Why can't you first do your computations in screen space and only then use the ProjectPointOnLine() function? In my example the script I'm currently working on takes the new point as a base and creates some more points around that which are not on the line so I can't use ProjectPointOnLine() for those. For that the new point must have the correct coordinates already so I can derive the other new points correctly, otherwise their position in the world will be skewed as well. The frustum concept is something I'll have to take some time to fully understand how I can utilize that. Thanks for the hint. Have a nice weekend, Daniel
  • how can I draw volumetric clouds in R25 ?

    General Talk programming
    2
    0 Votes
    2 Posts
    700 Views
    i_mazlovI
    Hi Klaus, Please excuse the delayed answer. Are you asking from the developer's point of view or from the user's perspective? The Physical Sky object is still there in R25, so is the "Cloud Tool". It was probably removed from the top menu, but you can still access it using Commander (Tools -> Commander or Shift+C): Cheers, Ilia [image: 1704903921815-9121f34b-5996-49fd-b502-8f4342f7879e-image.png]
  • Python Linting in VSCode?

    General Talk programming
    3
    2
    0 Votes
    3 Posts
    1k Views
    CJtheTigerC
    Hi @m_adam, I coincidentally followed the steps on there when I installed the VS Code extension way back. It's pretty straight forward. PyLint in VS Code immediately ramped up my CPU usage so I got rid of that extension. But maybe there's a trick that someone else knows about that could help me out. I'm always open for suggestions and alternatives. What IDE are you using if I may ask? Did you setup anything special to make life easier? Best regards, Daniel
  • 0 Votes
    3 Posts
    958 Views
    aghiad322A
    Thanks a lot @i_mazlov that's exactly what i needed. however on one of the options for the dropdown i have a single Text input that spans across the whole attribute manager, now after i added the "STATICTEXT { SCALE_V; }" it eats up half the space in the image below [image: 1703269667505-screenshot-2023-12-22-211432.png] i tried to give it a Description id and treat it as any other parameter and hiding it using "c4d.DESC_HIDE", below is the layout of the whole tab GROUP ADVANCED_TAB { SCALE_V; STRING CUSTOM_TXT_PARAMETER{ ANIM OFF; CUSTOMGUI MULTISTRING; SCALE_V; WORDWRAP; }; GROUP{ COLUMNS 2; LONG ANIMATION_CLONER_FROM { MIN 0; ANIM OFF; }; LONG ANIMATION_CLONER_TO { MIN 0; ANIM OFF; }; LONG ANIMATION_CLONER_SPAN { MIN 1; ANIM OFF; }; GROUP{ COLUMNS 1; SEPARATOR ANIMATION_CLONER_SEPARATOR{ LINE; }; REAL ANIMATION_CLONER_MULTIPLIER { MIN 0.1 ; STEP 0.1 ; ANIM OFF; }; } } GROUP{ COLUMNS 2; REAL SWEEP_PRO_RADIUS { UNIT METER ; STEP 0.1 ; MIN 0.1; ANIM OFF; }; REAL SWEEP_PRO_MULTIPLIER { MIN 0.1; ANIM OFF; }; } STATICTEXT UI_FILLER{SCALE_V;} GROUP{ COLUMNS 2; LONG PRESET { ANIM OFF; CYCLE { ANIMATION_CLONER; SWEEP_PRO; CUSTOM_INPUT; } } } } but when i try to hide it from the "GetDDescription()" the description "description.GetParameterI(paramId)" is empty ! ,in the "GetDDescription()" in my source code i have the hiding for the other parameters implemented as well but didn't copy them to keep the snippet at minimum lines def GetDDescription(self, node: c4d.GeListNode, description: c4d.Description, flags: int) -> typing.Union[bool, tuple[bool, int]]: if not description.LoadDescription(node.GetType()): return False, flags paramId: c4d.DescID = c4d.DescID(c4d.DescLevel(c4d.UI_FILLER, c4d.DTYPE_STRING, 0)) evalId: c4d.DescID = description.GetSingleDescID() if (evalId and not paramId.IsPartOf(evalId)): return True, flags paramData: c4d.BaseContainer = description.GetParameterI(paramId) #paramData for the "c4d.UI_FILLER" is empty if paramData is None: return True, flags # parameter ID_HIDE_CONDITION. paramData[c4d.DESC_HIDE] = True if node[c4d.PRESET] == c4d.CUSTOM_INPUT else False return True, flags | c4d.DESCFLAGS_DESC_LOADED
  • 0 Votes
    5 Posts
    1k Views
    G
    Ok, I ran into the issue of polling the BatchRender.IsRendering. I don't have the python skills to do multi-threading to check when a render is complete. I was able to hack in a time.sleep function but it is very problematic for longer renders and crashes a lot. Instead I went the route of Takes though Take are a bit cumbersome to setup but it is working nicely. I'll post the code here for anyone looking to do something similiar. I can just RenderAllTakes command and get each object rendered with its name using a $Take render token. def main(): doc = c4d.documents.GetActiveDocument() inEx = op[c4d.ID_USERDATA,4] # In/Exclude User Data for i in range(0 , op[c4d.ID_USERDATA,4].GetObjectCount()): #Iterate through each shot based on our shot slider in user data activeObj = inEx.ObjectFromIndex(doc, i) #deterimine which object is active if op[c4d.ID_USERDATA,1] == i: activeObj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = False #turn visibility On activeObj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = False render_filename = inEx.ObjectFromIndex(doc, i).GetName() #Gets the name of the currently active object op[c4d.ID_USERDATA,5] = render_filename else: activeObj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = True #turn visibility Off activeObj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = True c4d.EventAdd() ################ SEND ALL def BuildTakes(): #Sequencer() takedata = doc.GetTakeData() obj = doc.GetActiveObject() #print( Description.GetParameterI(op[c4d.ID_USERDATA,1], ar=None)) inEx = op[c4d.ID_USERDATA,4] # In/Exclude User Data for i in range(0,op[c4d.ID_USERDATA,4].GetObjectCount()): #Sequencer() take = takedata.AddTake(inEx.ObjectFromIndex(doc, i).GetName(), None, None) take.FindOrAddOverrideParam(takedata, obj , c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 1),c4d.DescLevel(1)), i , backupValue=None, deleteAnim=False) take.FindOrAddOverrideParam(takedata, inEx.ObjectFromIndex(doc, i), c4d.ID_BASEOBJECT_VISIBILITY_EDITOR, False, backupValue=None, deleteAnim=False) take.FindOrAddOverrideParam(takedata, inEx.ObjectFromIndex(doc, i), c4d.ID_BASEOBJECT_VISIBILITY_RENDER, False, backupValue=None, deleteAnim=False) #op[c4d.ID_USERDATA,1] = 0 #Sequencer() #c4d.MSG_DESCRIPTION_CHECKUPDATE #Sequencer() #c4d.EventAdd() def ClearTakes(): tk = doc.GetTakeData() tk.ResetSystem()
  • 8 Votes
    23 Posts
    24k Views
    DunhouD
    Hi community! Add Basic CentiLeo Material support, also with ConvertPorts data, This a "new" GPU Renderer and in active development. I am very interested in it. Not add AOV due to still being in the early stages of development, waiting for this. Cheers~ DunHou